Sonarlint fail to run with PDT (8.2) installed

Hi Tobias,

I’ve changed build_directory to ${ProjDirPath}/target
then as I told you the build fail because in ${ProjDirPath}/target ther’s not the makefile.
Then I close and re-open eclipse, but unfortunately the “No file to analyze” is still here.

please find attached the full log.

I think it should not correct to filter out all the build directory, because usually is where the makefile and the source files resides.

The output artifact folder could be in particular folders that in eclipse CDT are mapped via: see screenshot:

Anyway I think that are very complex and not so clean configurations(CDT configuration is a bit a mess ).
In our project we have a very big and complex schema, we have got more than one build folder… so I think should be easier to configure sonarlint to exclude some folder via the sonar lint project configuration in eclipse (file exclusion like in the 9.x version or something similar).

let me know if you need more test my side

By
Alessandro

(attachments)

EclipseSonarLint10.8_Error2.log (19 Bytes)

Hi @alef75,

just wanted to make you aware that we just released SonarLint for Eclipse 10.9 that includes some bug fixes regarding the CDT integration and and overall hardening of how SonarLint interacts with other Eclipse plug-ins.
There is also now the option to opt out of the interaction which might be beneficial in some cases and has to be configured on the project level (in the project preferences)

Please, check it out and provide me with some feedback if something is still not working as intended.

Best,
Tobias

Hi Tobias,

Thank you for the info and for your work.

I’ve upgraded to 10.9 on a test eclipe cdt installation That I’m using to testing sonalint ver > 9.x
I’ve unistall PDT (because it eas causing my original problem).

Starting from 10.8 and still present on 10.9, I can’t use sonarlint on my project, because all prject source files are filtered by sonalint an so are not scanned and I can’t see sonar finding on the IDE.

Here you can find the relevant short log: that I obtain every time I save the file.

This is the new issue I got with sonarlint >=10.8.

Than I’ve got my old problem that sonrlint >=10.0 that take long time (>= 30 minutes) to index every single file on the project (build, node, python_env, and opensource sources folders that are in my project but I don’t want to analyze with sonar)

Tell me if you need more info from me

regards
Alessandro

Relativizing path: /home/afardin/git/EMS/userapps/gavazzi/apps/cmt/src/cmt.c for git repo /home/afardin/git/EMS
Filtered out URIs not user-defined: file:/home/afardin/git/EMS/userapps/gavazzi/apps/cmt/src/cmt.c
Triggering analysis with configuration: [
baseDir: /home/afardin/git/EMS
extraProperties: {sonar.updatecenter.cache.ttl=3600000, sonaranalyzer-cs.nuget.packageVersion=9.19.0.84025, sonaranalyzer.security.cs.pluginVersion=10.4.0.30099, sonar.auth.bitbucket.allowUsersToSignUp=true, sonar.cs.ignoreHeaderComments=true, sonar.c.file.suffixes=.c,.h, sonar.typescript.file.suffixes=.ts,.tsx,.cts,.mts, sonar.auth.github.enabled=false, sonar.python.coverage.reportPaths=coverage-reports/coverage-.xml, sonar.text.activate=true, sonaranalyzer-vbnet.nuget.packageVersion=9.19.0.84025, provisioning.gitlab.enabled=false, sonar.go.file.suffixes=.go, sonar.cs.analyzeRazorCode=true, sonar.auth.saml.applicationId=sonarqube, email.fromName=SonarQube, sonar.python.xunit.skipDetails=false, sonar.dbcleaner.weeksBeforeKeepingOnlyAnalysesWithVersion=104, sonar.plsql.jdbc.driver.class=oracle.jdbc.OracleDriver, sonar.qualitygate.ignoreSmallChanges=true, sonar.auth.saml.signature.enabled=false, sonar.go.exclusions=/vendor/, sonar.php.exclusions=/vendor/, sonar.terraform.file.suffixes=.tf, sonar.forceAuthentication=true, sonar.notifications.delay=60, sonar.cpp.file.suffixes=.cc,.cpp,.cxx,.c++,.hh,.hpp,.hxx,.h++,.ipp, sonar.swift.file.suffixes=.swift, sonar.documentation.baseUrl=SonarQube 10.7, sonar.vbnet.roslyn.ignoreIssues=false, sonar.plsql.ignoreHeaderComments=false, sonar.flex.file.suffixes=as, sonaranalyzer.security.cs.nuget.packageVersion=10.4.0.30099, sonar.filesize.limit=20, sonar.auth.gitlab.groupsSync=false, sonar.auth.github.apiUrl=https://api.github.com/, sonar.ruby.file.suffixes=.rb, sonaranalyzer-cs.ruleNamespace=SonarAnalyzer.CSharp, sonar.auth.github.allowUsersToSignUp=true, sonar.azureresourcemanager.file.identifier=https://schema.management.azure.com/schemas/, sonar.cs.analyzeGeneratedCode=false, sonar.python.xunit.reportPath=xunit-reports/xunit-result-.xml, sonar.builtInQualityProfiles.disableNotificationOnUpdate=false, sonar.javascript.globals=angular,goog,google,OpenLayers,d3,dojo,dojox,dijit,Backbone,moment,casper,_,sap, sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay=24, sonar.yaml.file.suffixes=.yaml,.yml, sonar.dbcleaner.daysBeforeDeletingInactiveBranchesAndPRs=30, sonar.auth.bitbucket.enabled=false, sonar.terraform.activate=true, sonar.css.file.suffixes=.css,.less,.scss,.sass, sonar.cpd.abap.minimumTokens=100, sonar.docker.file.patterns=Dockerfile,.dockerfile, sonar.auth.github.webUrl=https://github.com/, sonar.dbcleaner.branchesToKeepWhenInactive=main,master,develop,trunk, sonar.html.file.suffixes=.html,.xhtml,.cshtml,.vbhtml,.aspx,.ascx,.rhtml,.erb,.shtm,.shtml,.cmp,.twig, sonaranalyzer-vbnet.nuget.packageId=SonarAnalyzer.VisualBasic, sonar.auth.gitlab.enabled=false, sonar.cpd.cross_project=false, email.from=noreply@nowhere, sonaranalyzer-vbnet.pluginVersion=9.19.0.84025, sonar.vbnet.ignoreHeaderComments=true, sonaranalyzer.security.cs.analyzerId=SonarAnalyzer.Security, sonaranalyzer.security.cs.nuget.packageId=SonarAnalyzer.Security, sonar.cfamily.build-wrapper-output=/home/afardin/eclipse-workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/EMS/org.sonarlint.eclipse.core/sonarlint5628968311928370065, sonar.auth.github.groupsSync=false, sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByWeek=4, sonaranalyzer-vbnet.analyzerId=SonarAnalyzer.VisualBasic, email.prefix=[SONARQUBE], sonar.scala.file.suffixes=.scala, sonar.cs.roslyn.ignoreIssues=false, sonar.cloudformation.activate=true, sonaranalyzer-cs.pluginKey=csharp, sonar.kubernetes.activate=true, sonar.java.ignoreUnnamedModuleForSplitPackage=False, sonar.json.file.suffixes=.json, sonaranalyzer.security.cs.pluginKey=securitycsharpfrontend, sonar.cfamily.useCache=false, sonaranalyzer-vbnet.ruleNamespace=SonarAnalyzer.VisualBasic, sonar.cloudformation.file.identifier=AWSTemplateFormatVersion, sonar.auth.saml.providerName=SAML, provisioning.github.project.visibility.enabled=true, sonar.dbcleaner.daysBeforeDeletingAnticipatedTransitions=30, sonar.javascript.ignoreHeaderComments=true, sonar.dbcleaner.daysBeforeDeletingClosedIssues=30, sonar.java.enablePreview=False, sonar.dbcleaner.weeksBeforeKeepingOnlyOneSnapshotByMonth=52, sonar.lf.gravatarServerUrl=https://secure.gravatar.com/avatar/{EMAIL_MD5}.jpg?s={SIZE}&d=identicon, sonar.objc.file.suffixes=.m, sonar.text.inclusions=/*.sh,/.bash,**/.zsh,/*.ksh,/.ps1,**/.properties,/*.conf,/.pem,**/.config,.env,.aws/config, sonar.ruby.coverage.reportPaths=coverage/.resultset.json, sonar.qualityProfiles.allowDisableInheritedRules=true, sonaranalyzer-cs.staticResourceName=SonarAnalyzer-9.19.0.84025.zip, sonar.notifications.runningDelayBeforeReportingStatus=600, sonar.auth.gitlab.allowUsersToSignUp=true, sonar.projectCreation.mainBranchName=main, sonar.jsp.file.suffixes=.jsp,.jspf,.jspx, sonar.javascript.maxFileSize=1000, sonaranalyzer-cs.nuget.packageId=SonarAnalyzer.CSharp, sonar.javascript.environments=amd,applescript,atomtest,browser,commonjs,embertest,greasemonkey,jasmine,jest,jquery,meteor,mocha,mongo,nashorn,node,phantomjs,prototypejs,protractor,qunit,serviceworker,shared-node-browser,shelljs,webextensions,worker, sonar.authenticator.downcase=false, sonar.scm.disabled=false, sonar.ruby.exclusions=/vendor/, sonar.auth.saml.enabled=false, sonar.vbnet.file.suffixes=.vb, sonaranalyzer-cs.analyzerId=SonarAnalyzer.CSharp, sonar.core.id=92D88F0A-AY5CQflvPhaX07DvbBiM, sonar.abap.file.suffixes=.abap,.ab4,.flow,.asprog, sonar.cfamily.ignoreHeaderComments=true, sonar.technicalDebt.ratingGrid=0.05,0.1,0.2,0.5, sonar.technicalDebt.developmentCost=30, sonar.lf.enableGravatar=false, sonar.validateWebhooks=true, sonar.docker.activate=true, sonar.python.file.suffixes=py, sonaranalyzer-cs.pluginVersion=9.19.0.84025, sonaranalyzer.security.cs.staticResourceName=SonarAnalyzer.Security-10.4.0.30099.zip, sonar.cs.file.suffixes=.cs,.razor, sonar.developerAggregatedInfo.disabled=false, sonar.plsql.file.suffixes=sql,pks,pkb, sonaranalyzer.security.cs.ruleNamespace=SonarAnalyzer.Security, sonar.plugins.downloadOnlyRequired=false, sonar.azureresourcemanager.file.suffixes=.bicep, sonar.javascript.file.suffixes=.js,.jsx,.cjs,.mjs,.vue, sonar.cpd.abap.minimumLines=20, sonar.allowPermissionManagementForProjectAdmins=true, sonar.text.inclusions.activate=false, sonaranalyzer-vbnet.staticResourceName=SonarAnalyzer-9.19.0.84025.zip, sonar.vbnet.analyzeGeneratedCode=false, sonar.java.file.suffixes=.java,.jav, sonar.kotlin.file.suffixes=.kt,.kts, sonar.plugins.risk.consent=ACCEPTED, sonar.php.file.suffixes=php,php3,php4,php5,phtml,inc, sonar.auth.gitlab.url=https://gitlab.com, sonar.xml.file.suffixes=.xml,.xsd,.xsl,.config, sonar.dbcleaner.weeksBeforeDeletingAllSnapshots=260, sonaranalyzer-vbnet.pluginKey=vbnet, sonar.azureresourcemanager.activate=true, sonar.updatecenter.url=https://update.sonarsource.org/update-center.properties, sonar.tsql.file.suffixes=.tsql, sonar.core.startTime=2024-08-31T15:17:37+0200}
activeRules: [416 cpp, 24 css, 189 python, 190 c, 28 scala, 109 kotlin, 9 pythonbugs, 55 tsql, 60 secrets, 252 javascript, 130 plsql, 28 ruby, 462 java, 26 Web, 15 xml, 156 php, 253 typescript, 61 abap]
inputFiles: [
]
]

No file to analyze
Done in 37 ms

Hey @alef75,

thanks for your reply and the feedback, this is much appreciated even though the changes didn’t help you that much.

With the newest version could you please enable the IDE-specific tracing in the SonarLint Console and restart so the logs are coming in from the beginning? It will log some lines starting with [CdtUtils#getExcludedPaths] which I’m interested in, these will contain the information what paths are filtered out by our CDT integration. It is now a bit better managing the information what is source and what is compilation output and should better distinguish.

After that, you can go to the project, right-click to open the properties, and then go to the SonarLint preferences listed there. There, uncheck the “Rely on Eclipse plugins for indexing and exclusions” box and restart the IDE.
After that, SonarLint won’t exclude your code anymore based on the CDT configuration, but the indexing will still be slow. The only things then excluded from indexing are the .git (or .hg) folders, the node_modules folder and the pyvenv folder - we hardcoded these as well as some others (like Python virtual environments in venv, pyenv etc.) to exclude them harsh.

The TICKET to take into account the manually configurable file exclusions by you will be done sometime in the future and then will improve your overall performance, but this ticket is quite tricky, and therefore not yet done.

Together with the circumstance that your project is not only quite big but also very complex it is very hard to approach this, therefore the ticket for the manual file exclusions. I hope to tackle it as soon as possible but for now the performance will sadly stay this way. This means when a project is imported it takes a very long time (probably, while long is also subjective) to index everything.

If this still does not help, then I advise you to use an older version of SonarLint for Eclipse for now, as you already did, so no frustration will arise up!

Best,
Tobias

Hi Tobias,

Thank you for the hints.

Unchecking the “Rely on Eclipse plugins for indexing and exclusions" sonarlint starts to work again :slightly_smiling_face:

For the log, I’ve already enabled the IDE specific logs, please see the full log attached.
(I found the tag you told me in the logs)

Just to understand (I’d like make some tests my side), how should I configure my eclipse project to make sonarlint happy ?

For the manual config TICKET, I’ll wait for it, I will be very happy with that mod, but I understand and I will be patient, if you need a tester for beta releases to get feeback, please don’t esitate to conatact me !

(attachments)

sonarlin10.9tEclipseCDT.log (5 MB)

Hi Tobias.

I’ve understood why in my project sonarlint doesn’t scan all my sources:
in my cdt configurations I’ve set as output location, my source folders.

To test it I’ve set the output location of all my CDT build configurations to /target, this way, now sonarlint scans my source files :slightly_smiling_face:.

In order to do another tests, I’ve added to output location of one of my configurations all the folder I’d like sonarlint would not indexes and parses.
than I’ve close and reopen the project, but sonarlint try to parse all the files in the project anyway, also the ones in the output folder.

please find in attachement the full sonar logs (while opening the project) and my .cproject

Best
Alessandro

(Attachment ATT11679.cgcproject is missing)

(attachments)

sonarlin10.9tEclipseCDT_openProject_with_output_build_folders.zip (2.2 MB)

Hi Tobias.

I’ve understood why in my project sonarlint doesn’t scan all my sources:
in my cdt configurations I’ve set as output location, my source folders.

To test it I’ve set the output location of all my CDT build configurations to /target, this way, now sonarlint scans my source files :slightly_smiling_face:.

In order to do another tests, I’ve added to output location of one of my configurations all the folder I’d like sonarlint would not indexes and parses.
than I’ve close and reopen the project, but sonarlint try to parse all the files in the project anyway, also the ones in the output folder.

please find in attachement the full sonar logs (while opening the project) and my .cproject

Best
Alessandro

(attachments)

alef_cproject.zip (19.1 KB)

Hey @alef75,

thank you very much for the logs and so on!
I will take some time tomorrow or on Thursday to have a look; currently, there is a lot to finish.

Best,
Tobias

1 Like

Hi @alef75,

the logs are quite long but I have a guess as to why you assume that SonarLint is trying to parse the files in the output locations, e.g. the target folder.

There are log entries coming from the FileSystemSynchronizer, but there are actually no logs starting with File added: indicating that files or folders from the output directories you defined are actually “added” to SonarLint.
So based on the logs alone and somehow trying to understand the CDT file you posted, your approach should have worked :partying_face:

The reason why SonarLint tries to “parse” the files in the output directories, and the reason for the log, is that Eclipse provides each file on its own to SonarLint, and we cannot just stop the moment it encounters the target directory and then don’t proceed with the directory content. I guess that is a limitation of Eclipse here. And now you only have 3529 files (based on the fact that there is one log line starting with File added: per resource) that SonarLint is caring about and not the build output anymore!

I have to say a big Kudos to you for finding the initial issue with the configuration of CDT and then re-using it to exclude files from SonarLint. Very smart :pray:

When the project is already in the workspace and it is restarted, nearly all of these FileSystemSynchronizer logs should be gone!

If you have further questions or doubt this, please let me know! Due to the importing of projects and the fact that Eclipse hands over every file on its own to SonarLint, the import should be a bit slower, but afterward, no more, at least after the workspace (re-) starts and for further actions like the full project analysis. For ~3500 files it might still be long but that is due to the number of files ^^

Best,
Tobias