Open php-coder opened 8 years ago
The only one workaround for that is to use @SuppressWarnings
but it requires to modify many files :-((
Is that" codenarc.properties" definitely on the classpath when running CodeNarc?
You can try setting the "codenarc.properties.file" system property to the path or URL of the properties file. Maybe try setting it to an absolute file path with a "file:" prefix just to make sure it "can" get picked up.
Is that" codenarc.properties" definitely on the classpath when running CodeNarc?
I tried to put it to a different places but it didn't work because when plugin constructs classpath it includes only some artifacts and log4j config: https://github.com/gleclaire/codenarc-maven-plugin/blob/36a22bd524ef8aa0c55abde708f8999ba1e06d64/src/main/groovy/org/codehaus/mojo/codenarc/CodeNarcMojo.groovy#L351-L378
Setting "codenarc.properties.file" system property with a "file:" + absolute path should work.
let me know if that works. In a future release we look at adding that to the plugin to pass it through.
@gleclaire
let me know if that works
No, it doesn't work:
$ mvn -Dcodenarc.properties.file=file:$PWD/src/main/config/codenarc.properties codenarc:codenarc
...
[INFO] totalPriority3Violations is 2
...
$ cat $PWD/src/main/config/codenarc.properties
UnnecessaryReturnKeyword.enabled = false
I think that file:$PWD is being treated as a relative path. For me, $PATH is "/home/Chris". And I think that file:/home/Chris is not the proper way to specify an absolute path.
https://en.wikipedia.org/wiki/File_URI_scheme
So I think what you'd need is file://$PWD
@chrismair No, it doesn't work either. Does it work for you?
I've created
codenarc.properties
and put it tosrc/test/resources/codenarc.properties
but the plugin doesn't pick it up:The same with
src/main/resources
. How to configure codenarc withcodenarc.properties
?