Hi guys,

In my current properties file I have a very very long line of code for the exclusions.
Example, sonar.exclusions=src/main/scala/**/**/**/**/Main.scala,src/main/scala/**/**/**/**/Local.scala,src/main/scala/**/**/**/**/pa.scala,src/main/scala/**/**/**/**/infrato/*.scala,src/main/scala/**/**/**/**/dominate/settings/*.scala,src/main/scala/**/**/**/**/BotAppCall.scala,src/main/scala/**/**/**/**/**/**/**/**/com/*.scala

Is there a better way to format this instead of having this long line of code?
It just a horizontal scroll in my file, is there a way to concatenate it to be better formated?

That’s… a lot of wildcards. And there’s no reason for them, because just one ** looks through all directories. So if you really need to keep the initial source directory…


Which is already easier to read.

And, there’s a good chance you don’t need to specify src/main/scala, which means this could be reduced to:


Which is much more manageable.

And, it’s not possible to break this up on different lines. However you can specify these in your Project Settings as well, under Analysis Scope, which accepts these on different lines. It ultimately is just sent to the scanner as comma separated values.

Awesome thank you so much! Can the same be done if the directory is specific to a module or would I need to keep the initial source directory?

If you’re analyzing with the SonarScanner CLI you don’t have to worry much about modules.

If you’re saying that within the repository there is another /dominate/ folder indexed as source you don’t want to exclude, yes you’ll need to still specify /src/main/scala/

Does that make sense? Happy to clarify if you have questions.

Is it possible to do something like **/parent/child/Main.* Will it find any file name and match it to the extension of the file?

Yes, this should work.

Sorry I just have one last question. When reading the Narrowing the focus with analysis documentation I am unclear if a pattern like this will work. I want to exclude any sub packages under this folder, would **/parent/child/.* work or would it have to be like **/parent/child/*

**/parent/child/.* and **/parent/child/* probably(?) have the same effect. I haven’t tested it, but I assure you the latter is more common.

**/parent/child/* will exclude only files directly under the child directory. **/parent/child/** will exclude files recursively in the child directory (including any subdirectories)