Problem with comma separated list item in a Sonar Cloud sonar-project.properties file

GitHub
NodeJs

Following the responses of this other post we’ve tried multiline in our sonar-project.properties file. It seems like we are doing something wrong because is not ignoring the files anymore.
Just for clarification. It does work when put in one line, we just wanted to improve readability.

Here is the problematic part of the file

sonar.coverage.exclusions=\ 
        pataka-upgrade/**/*,\
        # pataka \
        pataka/**/Abstract*.js,\
        pataka/**/index.js,\
        pataka/docs/js/**/*,\
        pataka/middleware/**/*,\
        pataka/public/js/**/*,\
        pataka/schemas/**/*,\
        
        # pataka-components 
        pataka-components/build.js,\
        # pataka-base 
        pataka-base/src/**/Abstract*.js,\
        pataka-base/src/**/index.js,\
        pataka-base/src/templates/*.js,\
        pataka-base/src/lib/database/models/Document.js,\


Comments don’t seem to make a difference, but we’ve tried multiple versions and none of the files are ignored anymore

Hi,

Is there anything on the lines after the \? From what I’m reading, it must be the last character on the line before the linebreak.

Also, you should clean up the trailing ,\ at the end of each property value.

 
Ann

Made a typo in my original example. My latest test looks like this

sonar.coverage.exclusions=\ 
        pataka-upgrade/**/*,\
        pataka/**/Abstract*.js,\
        pataka/**/index.js,\
        pataka/docs/js/**/*,\
        pataka/middleware/**/*,\
        pataka/public/js/**/*,\
        pataka/schemas/**/*,\
        pataka-components/build.js,\
        pataka-base/src/**/Abstract*.js,\
        pataka-base/src/**/index.js,\
        pataka-base/src/templates/*.js,\
        pataka-base/src/lib/database/models/Document.js

So without comments or spaces, no characters after the \ and the last item does not have a \ nor a coma.
I’m going to test changing back to CRLF, but please let me know if you see anything else

Hi,

I don’t see anything else.

I’ll be honest, your use case isn’t common, so I had to read up on it and from what I saw in my reading this should work. The sonar-project.properties file started life as a simple Java properties file, so your \ syntax should work. However, it’s possible it has migrated away from that over the years.

According to the Javadoc, your CRLF test probably won’t work, but I’ll ask first: did it?

 
Ann

Changing it to CRLF did make it work, but I had to remove the comments

1 Like