I’m facing an issue with sonarcloud that I’m not facing when I’m running sonarcube locally. The problem is the sonar.exclusions, which seems to be completely ignored. Sonar.inclusions are working well on sonarcloud, which is the weird part
My directory path is as such:
I would like to exclude the folder: Application_admin/third_party/
I have tried the following sonar.exclusions values:
sonar.exclusions = application_admin/third_party/**
sonar.exclusions = **/third_party/**
sonar.exclusions = **third_party**
However the files in the third_party folder is still included.
However if I specify the inclusion filter as such:
sonar.inclusions = Application_front/**
Then it works as intended and the Application_admin folder is excluded. However, I want to only exclude the Application_admin/third_party/ folder and I do not want add a new folder to the inclusion filter evertime a new folder is added to the source.
Is there something wrong with the sonar.exclusions filter on sonarcloud?
- ALM used: GitHub
- Languages of the repository: PHP
- Your analysis with ID “AXEtW_NI_gvX44VAKq6H” has failed.
Hi @andersbl and welcome to the community !
Exclusions (with relative paths provided), even if you can exclude directories, are based on files. (See the doc here)
For example, i think this one might work :
sonar.exclusions = Application_admin/third_party/**/*
Let us know if it works.
Thanks a lot for your suggestion. I had to try it immediately when I saw the post but sadly it didn’t work. I checked in the scan context to see if the filter was set and it was.
I tried the coverage.exclusions filter because i got desperate but did not help either.
Project server settings:
Your analysis with ID “AXEvbnhTrwvFd9BVOU-h” has failed: your number of lines exceeds your organization plan.
Thank for your answer.
It appears that we have (maybe) the same sort of issues in this thread : Issue in file scope excluded still showing. Counted also in number of lines
We are currently looking into it, and let you know if some fixes have to be made on our side.
Okay that makes sense, it was also a strange behavior
I can see that the issue you referred to has been open for only 4 days. I’m wondering if this issue has been open for a long time in general or if this is an “Easy fix”.
The reason I’m asking is because that I am still on my trial period and I don’t want to pay for a service that I cannot use.
We’re still investigating this, in the meantime, you can find a workaround on the other thread.
The workaround worked So that’s fine for now but I would prefer it to be set in the SonarCloud project and not in the source.
Thanks for the help!
I confirm, currently it’s not possible to set this property using the UI.
I created a ticket to track the issue: SCCOMM-24
@andersbl This has now been fixed, the exclusions set in the UI are now taken into account.