Skip to content

Commit

Permalink
SLE-1000: Embed CFamily analyzer
Browse files Browse the repository at this point in the history
Embed the CFamily analyzer conditionally and provide documentation to the forks.

Update the NOTICE.txt to include the note about the non-Open Source analyzer.
  • Loading branch information
thahnen committed Dec 10, 2024
1 parent 8e88d8d commit 64ab66d
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 10 deletions.
4 changes: 3 additions & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ mailto:info AT sonarsource DOT com

This program is distributed with SonarQube analyzers that are subject to specific license terms.

All of the analyzers distributed with this program are published under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. For more details see https://sonarsource.com/license/ssal/
The sonar-cfamily-plugin is a SonarQube analyzer published under the following proprietary license: SonarSource SA grants you a non-transferable, non-sublicensable, limited license to use the aforementioned plugins solely as part of this program. Any use, reproduction, distribution, or modification of the plugins outside the scope of this program is strictly prohibited.

All of the other analyzers distributed with this program are published under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. For more details see https://sonarsource.com/license/ssal/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Normally, m2e will automatically suggest to install missing connectors (Tycho co
missing lifecycle mappings. This can all be done later.

1. Run `mvn clean verify -DskipTests` on the command line to fetch artifacts referenced in the parent pom
- for forks use `-Dskip-sonarsource-repo` as the reference to the CFamily analyzer is not available on Maven Central
2. In Eclipse, import the project root as a Maven project
3. In Eclipse, import the project root of the ITs as a Maven project and add them to the main project
4. Open `target-platforms/dev.target` with the target platform editor
Expand Down Expand Up @@ -69,6 +70,8 @@ With Maven:

mvn clean verify

- for forks use `-Dskip-sonarsource-repo` as the reference to the CFamily analyzer is not available on Maven Central

Running ITs
-----------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public void defaultLinkVisibilityRoundTrip() {
public void open_rules_configuration() {
var ruleConfigurationPreferences = RuleConfigurationPreferences.open();

assertThat(ruleConfigurationPreferences.getItems()).hasSize(9 /* CSS, HTML, Java, JavaScript, PHP, Python, Secrets, TypeScript, XML */);
/* C, C++, CSS, HTML, Java, JavaScript, PHP, Python, Secrets, TypeScript, XML */
assertThat(ruleConfigurationPreferences.getItems()).hasSize(11);
var cssNode = ruleConfigurationPreferences.getItems().get(0);

assertThat(cssNode.getText()).isEqualTo("CSS");

Check failure on line 133 in its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java

View check run for this annotation

Cirrus CI / qa_standaloneMode CIRRUS_AWS_ACCOUNT:275878209202 CIRRUS_AWS_ACCOUNT:275878209202 TARGET_PLATFORM:latest-java-17_e431

its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java#L133

org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration no-configuration
Raw output
org.opentest4j.AssertionFailedError: 

expected: "CSS"
 but was: "C"
	at org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration(RulesConfigurationTest.java:133)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunTestMethod.evaluate(RunTestMethod.java:48)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBefores.evaluate(RunBefores.java:85)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeTestExtensions.evaluate(RunIBeforeTestExtensions.java:73)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfters.evaluate(RunAfters.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterTestExtensions.evaluate(RunIAfterTestExtensions.java:59)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.runChild(RequirementsRunner.java:171)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBeforeClasses.evaluate(RunBeforeClasses.java:81)
	at org.eclipse.reddeer.junit.internal.runner.statement.FulfillRequirementsStatement.evaluate(FulfillRequirementsStatement.java:46)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeClassExtensions.evaluate(RunIBeforeClassExtensions.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfterClasses.evaluate(RunAfterClasses.java:68)
	at org.eclipse.reddeer.junit.internal.runner.statement.CleanUpRequirementStatement.evaluate(CleanUpRequirementStatement.java:45)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterClassExtensions.evaluate(RunIAfterClassExtensions.java:57)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.run(RequirementsRunner.java:153)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:137)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:148)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:88)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:140)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.runTests(AbstractUITestApplication.java:51)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$0(E4Testable.java:79)
	at java.base/java.lang.Thread.run(Thread.java:840)

Check failure on line 133 in its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java

View check run for this annotation

Cirrus CI / qa_standaloneMode CIRRUS_AWS_ACCOUNT:275878209202 CIRRUS_AWS_ACCOUNT:275878209202 TARGET_PLATFORM:latest-java-21

its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java#L133

org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration no-configuration
Raw output
org.opentest4j.AssertionFailedError: 

expected: "CSS"
 but was: "C"
	at org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration(RulesConfigurationTest.java:133)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunTestMethod.evaluate(RunTestMethod.java:48)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBefores.evaluate(RunBefores.java:85)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeTestExtensions.evaluate(RunIBeforeTestExtensions.java:73)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfters.evaluate(RunAfters.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterTestExtensions.evaluate(RunIAfterTestExtensions.java:59)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.runChild(RequirementsRunner.java:171)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBeforeClasses.evaluate(RunBeforeClasses.java:81)
	at org.eclipse.reddeer.junit.internal.runner.statement.FulfillRequirementsStatement.evaluate(FulfillRequirementsStatement.java:46)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeClassExtensions.evaluate(RunIBeforeClassExtensions.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfterClasses.evaluate(RunAfterClasses.java:68)
	at org.eclipse.reddeer.junit.internal.runner.statement.CleanUpRequirementStatement.evaluate(CleanUpRequirementStatement.java:45)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterClassExtensions.evaluate(RunIAfterClassExtensions.java:57)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.run(RequirementsRunner.java:153)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:137)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:148)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:88)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:140)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.runTests(AbstractUITestApplication.java:51)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$0(E4Testable.java:79)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Check failure on line 133 in its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java

View check run for this annotation

Cirrus CI / qa_standaloneMode CIRRUS_AWS_ACCOUNT:275878209202 CIRRUS_AWS_ACCOUNT:275878209202 TARGET_PLATFORM:oldest-java-11_e48

its/org.sonarlint.eclipse.its.standalone/src/org/sonarlint/eclipse/its/standalone/RulesConfigurationTest.java#L133

org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration no-configuration
Raw output
java.lang.AssertionError: 

expected: "CSS"
 but was: "C"
	at org.sonarlint.eclipse.its.standalone.RulesConfigurationTest.open_rules_configuration(RulesConfigurationTest.java:133)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunTestMethod.evaluate(RunTestMethod.java:48)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBefores.evaluate(RunBefores.java:85)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeTestExtensions.evaluate(RunIBeforeTestExtensions.java:73)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfters.evaluate(RunAfters.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterTestExtensions.evaluate(RunIAfterTestExtensions.java:59)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.runChild(RequirementsRunner.java:171)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunBeforeClasses.evaluate(RunBeforeClasses.java:81)
	at org.eclipse.reddeer.junit.internal.runner.statement.FulfillRequirementsStatement.evaluate(FulfillRequirementsStatement.java:46)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIBeforeClassExtensions.evaluate(RunIBeforeClassExtensions.java:72)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunAfterClasses.evaluate(RunAfterClasses.java:68)
	at org.eclipse.reddeer.junit.internal.runner.statement.CleanUpRequirementStatement.evaluate(CleanUpRequirementStatement.java:45)
	at org.eclipse.reddeer.junit.internal.runner.statement.RunIAfterClassExtensions.evaluate(RunIAfterClassExtensions.java:57)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.reddeer.junit.internal.runner.RequirementsRunner.run(RequirementsRunner.java:153)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:316)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:240)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:214)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:155)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:137)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:148)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:88)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:140)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.runTests(AbstractUITestApplication.java:51)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$0(E4Testable.java:73)
	at java.base/java.lang.Thread.run(Thread.java:829)
Expand Down
45 changes: 45 additions & 0 deletions org.sonarlint.eclipse.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,49 @@
</plugin>
</plugins>
</build>

<!--
Since the CFamily plug-in is not uploaded to Maven Central as it is not Open Source, this is not vailable to forks.
Forks must use "-Dskip-sonarsource-repo" when building the plug-in!
-->
<profiles>
<profile>
<id>cfamily-analyzer</id>
<activation>
<property>
<name>!skip-sonarsource-repo</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-cfamily-analyzer</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.sonarsource.cpp</groupId>
<artifactId>sonar-cfamily-plugin</artifactId>
<version>6.61.0.77816</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.basedir}/plugins</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public static Path findEmbeddedXmlPlugin() {
return findEmbeddedPlugin("sonar-xml-plugin-*.jar", "Found XML plugin: ");
}

@Nullable
public static Path findEmbeddedCFamilyPlugin() {
return findEmbeddedPlugin("sonar-cfamily-plugin-*.jar", "Found CFamily plugin: ");
}

@Nullable
private static Path findEmbeddedPlugin(String pluginNamePattern, String logPrefix) {
var pluginEntriesEnum = SonarLintCorePlugin.getInstance().getBundle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ protected IStatus run(IProgressMonitor monitor) {
embeddedPlugins.put("web", requireNonNull(PluginPathHelper.findEmbeddedHtmlPlugin(), "HTML plugin not found"));
embeddedPlugins.put("xml", requireNonNull(PluginPathHelper.findEmbeddedXmlPlugin(), "XML plugin not found"));
embeddedPlugins.put("text", requireNonNull(PluginPathHelper.findEmbeddedSecretsPlugin(), "Secrets plugin not found"));
embeddedPlugins.put("cpp", requireNonNull(PluginPathHelper.findEmbeddedCFamilyPlugin(), "CFamily plugin not found"));

var sqConnections = ConnectionSynchronizer.buildSqConnectionDtos();
var scConnections = ConnectionSynchronizer.buildScConnectionDtos();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public class SonarLintUtils {
*/
private static final Set<SonarLintLanguage> DEFAULT_LANGUAGES = EnumSet.of(SonarLintLanguage.PYTHON, SonarLintLanguage.JS, SonarLintLanguage.TS,
SonarLintLanguage.HTML, SonarLintLanguage.CSS, SonarLintLanguage.PHP, SonarLintLanguage.XML, SonarLintLanguage.SECRETS);
private static final Set<SonarLintLanguage> OPTIONAL_LANGUAGES = EnumSet.of(SonarLintLanguage.JAVA, SonarLintLanguage.JSP);
private static final Set<SonarLintLanguage> OPTIONAL_LANGUAGES = EnumSet.of(SonarLintLanguage.JAVA,
SonarLintLanguage.JSP, SonarLintLanguage.C, SonarLintLanguage.CPP);
private static final Set<SonarLintLanguage> DEFAULT_CONNECTED_LANGUAGES = EnumSet.of(SonarLintLanguage.ABAP,
SonarLintLanguage.APEX, SonarLintLanguage.COBOL, SonarLintLanguage.JCL, SonarLintLanguage.KOTLIN,
SonarLintLanguage.PLI, SonarLintLanguage.PLSQL, SonarLintLanguage.RPG, SonarLintLanguage.RUBY,
SonarLintLanguage.SCALA, SonarLintLanguage.TSQL);
private static final Set<SonarLintLanguage> OPTIONAL_CONNECTED_LANGUAGES = EnumSet.of(SonarLintLanguage.C, SonarLintLanguage.CPP);

private SonarLintUtils() {
// utility class, forbidden constructor
Expand Down Expand Up @@ -119,12 +119,6 @@ public static Set<SonarLintLanguage> getStandaloneEnabledLanguages() {
public static Set<SonarLintLanguage> getConnectedEnabledLanguages() {
var enabledLanguages = EnumSet.noneOf(SonarLintLanguage.class);
enabledLanguages.addAll(DEFAULT_CONNECTED_LANGUAGES);

var configurators = SonarLintExtensionTracker.getInstance().getAnalysisConfigurators();
for (var configurator : configurators) {
var enableLanguages = configurator.enableLanguages();
enableLanguages.stream().filter(OPTIONAL_CONNECTED_LANGUAGES::contains).forEach(enabledLanguages::add);
}
return enabledLanguages;
}

Expand Down

0 comments on commit 64ab66d

Please sign in to comment.