Skip to content

The -sourcefiles argument doesn't work with relative paths #726

@nre-ableton

Description

@nre-ableton

I was very excited to see the addition of the -sourcefiles argument in CodeNarc 3.2.0, however it doesn't work for me. I get an error, ERROR: org.codenarc.analyzer.AnalyzerException: Error analyzing source file: <filename>; java.lang.IllegalArgumentException: 'other' is different type of Path. Here's the full output:

$ java -Dorg.slf4j.simpleLogger.showThreadName=false -Dorg.slf4j.simpleLogger.defaultLogLevel=debug -classpath /home/nre/Code/Ableton/groovy
lint/resources:/home/nre/Code/SDKs/groovy-3.0.10/lib/*:/home/nre/Code/Ableton/groovylint/resources/CodeNarc-3.2.0.jar:/home/nre/Code/Ableton/groovylint/resources/GMetrics-2.1.0.jar:/home/nre/
Code/Ableton/groovylint/resources/activation-1.1.1.jar:/home/nre/Code/Ableton/groovylint/resources/jaxb-api-2.4.0-b180830.0359.jar:/home/nre/Code/Ableton/groovylint/resources/slf4j-api-2.0.6.
jar:/home/nre/Code/Ableton/groovylint/resources/slf4j-simple-2.0.6.jar org.codenarc.CodeNarc -failOnError=true -rulesetfiles=ruleset.groovy -report=xml:/tmp/tmppwnengf9/codenarc-report.xml -s
ourcefiles=./Jenkinsfile
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v9.Java9 (file:/home/nre/Code/SDKs/groovy-3.0.10/lib/groovy-3.0.10.jar) to method com.sun.org.apache.xerces.internal.jaxp.va
lidation.AbstractXMLSchema.newValidator()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v9.Java9
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
ERROR: org.codenarc.analyzer.AnalyzerException: Error analyzing source file: ./Jenkinsfile; java.lang.IllegalArgumentException: 'other' is different type of Path
org.codenarc.analyzer.AnalyzerException: Error analyzing source file: ./Jenkinsfile; java.lang.IllegalArgumentException: 'other' is different type of Path
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
        at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:59)
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:263)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:277)
        at org.codenarc.analyzer.FilesSourceAnalyzer.analyze(FilesSourceAnalyzer.groovy:82)
        at org.codenarc.analyzer.SourceAnalyzer$analyze.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at org.codenarc.CodeNarcRunner.execute(CodeNarcRunner.groovy:92)
        at org.codenarc.CodeNarcRunner$execute.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
        at org.codenarc.CodeNarc.execute(CodeNarc.groovy:226)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:193)
        at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:73)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
        at org.codenarc.CodeNarc.main(CodeNarc.groovy:195)
CodeNarc - static analysis for Groovy,
Usage: java org.codenarc.CodeNarc [OPTIONS]
  <additional help output follows...>

Using -includes=<filename> works fine. Also, I used ./Jenkinsfile in the above example, but the same problem occurs with Jenkinsfile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions