Sonarqube and sonarLint ConnectedMode

  • Operating system: Linux
  • SonarLint plugin version: 7.13
  • Is connected mode used: yes
  • Connected to SonarQube and version : 8.9

I have defined the quality profile with custom test rules in the project that I’m using in connected mode in sonarlint in the eclipse. But the test rules are not getting applied. While these are getting analysed in server . May I know the reason and where I was making the mistake ?

FYI: Pre-defined source rules are working in the connected mode, only the test rules are not getting applied.

Thanks in advance .

Hi,

You mention that “pre-defined” source rules are working. Does this imply that the test rules that aren’t working are custom rules, coded on your side?

Also, your SonarQube version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.9 → 9.9.1 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

 
Ann

1 Like

Both the custom and pre-defined rules.

Hi,

I’m a bit confused. If the problem persists after upgrade, please come back to us.

 
Thx,
Ann

1 Like

Thanks @ganncamp for your response.

I have upgraded the server but still facing this issue. Both pre-defined and custom test rules are not getting applied in connected mode.

FYI: Pre-defined and custom source rules are working in the connected mode, only the test rules are not getting applied.

Hi,

What’s the coding language the rules are applied to?

 
Thx,
Ann

1 Like

Coding language : JAVA

Hi,

Thanks for getting back to me. In the meantime, a new SonarLint version has been released. Sorry to make you jump through hoops, but could you upgrade SonarLint and make sure this is still replicable? (I suspect it will be, but I need to dot the i’s.

 
Thx,
Ann

1 Like

Updated and tried again . But still facing the same issue @ganncamp .

1 Like

Hi,

Thanks for trying. I’ve flagged this for the SonarLint experts.

 
Ann

1 Like

Thanks @ganncamp

Hi @Anusha_jesuraj,

thanks for approaching us with that issue. In order to reproduce and find the root cause, may I ask if you have configured analyzer properties for your Eclipse project that differ from the actual properties handed over to the build like sonar.sources and sonar.tests?
Also, have you implemented the custom rules via XPath or Java with a custom SonarQube plugin?

Can you provide me with the logs when analyzing the files? This can be found in the Console → SonarLint Console and the extra logs required are activated via the Gear symbol → Verbose output and Gear symbol → Analysis logs.

Best,
Tobias

1 Like

Hi @Anusha_jesuraj,

In order for SonarLint to determine test files we either check if the source folder on the build path has the option Contains test sources enabled or if the file matches the test file glob patterns configured in the workspace settings, see the screenshot below:


The analyzer properties are set based on that (therefore my proposed fix won’t work in the end).

Can you provide me with the information on your project configuration (what is set in the .classpath file) or if you have the workspace setting set for the glob pattern.

Best,
Tobias

1 Like

Thanks @tobias.hahnen , The issue has been solved after setting the Test file glob patterns.

I’m so sorry for raising these much questions. I haven’t even seen that option earlier.
I have declared the files with sonar.tests and sonar.test.inclusions properties but it doesn’t work after setting it as global its working fine.

Once again thanks @ganncamp and @tobias.hahnen for your help and sorry .

1 Like

Hi @Anusha_jesuraj,

no worries regarding your questions, we’re here to help :slight_smile:

Big thanks to you for raising this point, we also discussed it internally (as the topic hasn’t been touched on in quite some time) with the conclusion of creating THIS ticket for later development. This way we can also ensure to set the configuration of the test file patterns on a project level and not only globally, hope that will have some benefit!

Best and have a wonderful weekend,
Tobias

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.