NglParseError appears when using "$PWD/src", but not "$PWD"
ryeleo opened this issue · 5 comments
For some reason, I am getting slightly inconsistent messages when I am running the linter within my 'src' directory vs running it in my project's directory.
Frankly, the output from running in 'src' directory is a bit more complete. I'd love to see the NglParseError always, but only see it when running in 'PWD/src', which is a bit more clunky.
Running from 'PWD' (less output)
$ docker run --rm -u "$(id -u):$(id -g)" -w=/tmp -v "$PWD":/tmp nvuillam/npm-groovy-lint --failon warning --verbose src
/tmp/src/edu/uoregon/nts/DockerImage.groovy
9 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
9 warning The class edu.uoregon.nts.DockerImage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
33 warning Violation in class DockerImage. The method 'buildAndPush' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
33 info Method "buildAndPush" has a dynamic return type MethodReturnTypeRequired
38 info Method "getDockerTags" has a dynamic return type MethodReturnTypeRequired
42 warning Violation in class DockerImage. The method 'build' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
42 info Method "build" has a dynamic return type MethodReturnTypeRequired
60 warning The line exceeds 120 characters. The line is 133 characters. LineLength
63 warning The line exceeds 120 characters. The line is 146 characters. LineLength
68 info Method "push" has a dynamic return type MethodReturnTypeRequired
77 info Method "dockerImageName" has a dynamic return type MethodReturnTypeRequired
100 info Method "getDockerTagsCLI" has a dynamic return type MethodReturnTypeRequired
104 info Method "pushGitTag" has a dynamic return type MethodReturnTypeRequired
109 info Method "pushDockerImage" has a dynamic return type MethodReturnTypeRequired
123 info Method "properties" has a dynamic return type MethodReturnTypeRequired
/tmp/src/edu/uoregon/nts/PythonPackage.groovy
10 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
10 warning The class edu.uoregon.nts.PythonPackage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
21 warning The line exceeds 120 characters. The line is 121 characters. LineLength
43 info When an if statement block ends with a return statement the else is unnecessary UnnecessaryElseStatement
58 info Method "runTests" has a dynamic return type MethodReturnTypeRequired
83 info Method "publishToPyPI" has a dynamic return type MethodReturnTypeRequired
98 info Method "publishToUOPackageIndex" has a dynamic return type MethodReturnTypeRequired
138 info Method "publish" has a dynamic return type MethodReturnTypeRequired
/tmp/src/edu/uoregon/nts/Defaults.groovy
11 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
11 warning The class edu.uoregon.nts.Defaults implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
19 info Method "bitbucketBuildParameters" has a dynamic return type MethodReturnTypeRequired
26 warning The line exceeds 120 characters. The line is 126 characters. LineLength
35 warning The line exceeds 120 characters. The line is 125 characters. LineLength
41 warning The line exceeds 120 characters. The line is 164 characters. LineLength
51 warning Violation in class Defaults. The method 'buildDiscarder' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
51 info Method "buildDiscarder" has a dynamic return type MethodReturnTypeRequired
60 info Method "cronNightly" has a dynamic return type MethodReturnTypeRequired
64 info Method "cronWeeknights" has a dynamic return type MethodReturnTypeRequired
/tmp/src/edu/uoregon/nts/Utilities.groovy
6 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
6 warning The class edu.uoregon.nts.Utilities implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
14 info Method "convertGitOriginSSH" has a dynamic return type MethodReturnTypeRequired
26 info Method "pushGitTag" has a dynamic return type MethodReturnTypeRequired
46 warning Method parameter [gitCommitMessage] is never referenced in the method releaseCandidateFromLatestGitCommit of class edu.uoregon.nts.Utilities UnusedMethodParameter
51 info Line ends with whitespace characters TrailingWhitespace
54 info The public static method releaseCandidateFromGitCommit in class edu.uoregon.nts.Utilities is declared after a public instance method StaticMethodsBeforeInstanceMethods
71 info Method "replaceInFile" has a dynamic return type MethodReturnTypeRequired
96 info When an if statement block ends with a return statement the else is unnecessary UnnecessaryElseStatement
/tmp/src/edu/uoregon/nts/LintTinker.groovy
9 info Line ends with whitespace characters TrailingWhitespace
13 info Line ends with whitespace characters TrailingWhitespace
npm-groovy-lint results in 5 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 0 │
│ 1 │ 'Warning' │ 14 │
│ 2 │ 'Info' │ 30 │
└─────────┴───────────┴─────────────┘
Failure: 0 error(s) have been found
14 warning(s) have been found
Running from 'PWD/src' (more output)
docker run --rm -u "$(id -u):$(id -g)" -w=/tmp -v "$PWD/src":/tmp nvuillam/npm-groovy-lint --failon warning --verbose
/tmp/edu/uoregon/nts/Defaults.groovy
11 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
11 warning The class edu.uoregon.nts.Defaults implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
19 info Method "bitbucketBuildParameters" has a dynamic return type MethodReturnTypeRequired
26 warning The line exceeds 120 characters. The line is 126 characters. LineLength
35 warning The line exceeds 120 characters. The line is 125 characters. LineLength
41 warning The line exceeds 120 characters. The line is 164 characters. LineLength
51 warning Violation in class Defaults. The method 'buildDiscarder' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
51 info Method "buildDiscarder" has a dynamic return type MethodReturnTypeRequired
60 info Method "cronNightly" has a dynamic return type MethodReturnTypeRequired
64 info Method "cronWeeknights" has a dynamic return type MethodReturnTypeRequired
/tmp/edu/uoregon/nts/DockerImage.groovy
9 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
9 warning The class edu.uoregon.nts.DockerImage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
33 warning Violation in class DockerImage. The method 'buildAndPush' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
33 info Method "buildAndPush" has a dynamic return type MethodReturnTypeRequired
38 info Method "getDockerTags" has a dynamic return type MethodReturnTypeRequired
42 warning Violation in class DockerImage. The method 'build' matches the regular expression /(build.*|create.*)/ and does not appear in a class matching /*.Builder/ FactoryMethodName
42 info Method "build" has a dynamic return type MethodReturnTypeRequired
60 warning The line exceeds 120 characters. The line is 133 characters. LineLength
63 warning The line exceeds 120 characters. The line is 146 characters. LineLength
68 info Method "push" has a dynamic return type MethodReturnTypeRequired
77 info Method "dockerImageName" has a dynamic return type MethodReturnTypeRequired
100 info Method "getDockerTagsCLI" has a dynamic return type MethodReturnTypeRequired
104 info Method "pushGitTag" has a dynamic return type MethodReturnTypeRequired
109 info Method "pushDockerImage" has a dynamic return type MethodReturnTypeRequired
123 info Method "properties" has a dynamic return type MethodReturnTypeRequired
/tmp/edu/uoregon/nts/LintTinker.groovy
8 error Invalid method declaration: LintTest @ line 8, column 5. NglParseError
9 info Line ends with whitespace characters TrailingWhitespace
13 info Line ends with whitespace characters TrailingWhitespace
/tmp/edu/uoregon/nts/PythonPackage.groovy
10 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
10 warning The class edu.uoregon.nts.PythonPackage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
21 warning The line exceeds 120 characters. The line is 121 characters. LineLength
43 info When an if statement block ends with a return statement the else is unnecessary UnnecessaryElseStatement
58 info Method "runTests" has a dynamic return type MethodReturnTypeRequired
83 info Method "publishToPyPI" has a dynamic return type MethodReturnTypeRequired
98 info Method "publishToUOPackageIndex" has a dynamic return type MethodReturnTypeRequired
138 info Method "publish" has a dynamic return type MethodReturnTypeRequired
/tmp/edu/uoregon/nts/Utilities.groovy
6 info Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
6 warning The class edu.uoregon.nts.Utilities implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
14 info Method "convertGitOriginSSH" has a dynamic return type MethodReturnTypeRequired
26 info Method "pushGitTag" has a dynamic return type MethodReturnTypeRequired
46 warning Method parameter [gitCommitMessage] is never referenced in the method releaseCandidateFromLatestGitCommit of class edu.uoregon.nts.Utilities UnusedMethodParameter
51 info Line ends with whitespace characters TrailingWhitespace
54 info The public static method releaseCandidateFromGitCommit in class edu.uoregon.nts.Utilities is declared after a public instance method StaticMethodsBeforeInstanceMethods
71 info Method "replaceInFile" has a dynamic return type MethodReturnTypeRequired
96 info When an if statement block ends with a return statement the else is unnecessary UnnecessaryElseStatement
npm-groovy-lint results in 5 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 1 │
│ 1 │ 'Warning' │ 14 │
│ 2 │ 'Info' │ 30 │
└─────────┴───────────┴─────────────┘
Failure: 1 error(s) have been found
14 warning(s) have been found
This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.
If you think this issue should stay open, please remove the O: stale 🤖
label or comment on the issue.
a new version solving many issues is coming soon :)
As of Dec 7th, I can confirm this seems fixed! I can now run docker using only my 'src' directory, instead of my whole 'current working directory.'
Please pardon all the 'warning' and 'info' messages in the output below 😅
The "LintTest.groovy" source code file, with an error (missing return type)
class MyClass {
Foo() { // Foo is missing "return type!"
}
}
The output definitely indicates the "Invalid method declaration: Foo" parse error:
$ docker run --rm -u "$(id -u):$(id -g)" -w=/tmp -v "$PWD":/tmp nvuillam/npm-groovy-lint --failon warning --verbose src
/tmp/src/edu/uoregon/nts/Defaults.groovy
11 warning The class edu.uoregon.nts.Defaults implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
15 info "script" parameter of "<init>" method is dynamically typed MethodParameterTypeRequired
/tmp/src/edu/uoregon/nts/DockerImage.groovy
9 warning The class edu.uoregon.nts.DockerImage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
100 info "gitBranch" parameter of "getDockerTagsCLI" method is dynamically typed MethodParameterTypeRequired
104 info "scmVars" parameter of "pushGitTag" method is dynamically typed MethodParameterTypeRequired
156 info "dockerImage" parameter of "prepareDockerTags" method is dynamically typed MethodParameterTypeRequired
156 info "gitBranch" parameter of "prepareDockerTags" method is dynamically typed MethodParameterTypeRequired
/tmp/src/edu/uoregon/nts/LintTest.groovy
3 error Invalid method declaration: Foo @ line 3, column 5. NglParseError
/tmp/src/edu/uoregon/nts/PythonPackage.groovy
4 info The [java.nio.file.Files] import is never referenced UnusedImport
5 info UnnecessaryGroovyImport
5 info The [java.io.File] import is never referenced UnusedImport
6 info The [java.nio.file.Path] import is never referenced UnusedImport
7 info The [java.util.stream.Stream] import is never referenced UnusedImport
8 info The [java.util.stream.Collectors] import is never referenced UnusedImport
14 warning The class edu.uoregon.nts.PythonPackage implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
27 info "sourceDir" parameter of "<init>" method is dynamically typed MethodParameterTypeRequired
27 info "versionFile" parameter of "<init>" method is dynamically typed MethodParameterTypeRequired
27 warning Number of parameters in constructor of class edu.uoregon.nts.PythonPackage exceeds maximum allowed (5). ParameterCount
41 info The statement on line 41 in class edu.uoregon.nts.PythonPackage is at the incorrect indent level: Expected column 9 but was 11 Indentation
46 warning Violation in class PythonPackage. The method 'buildPackage' is named like a builder method but has a void return type BuilderMethodWithSideEffects
46 info "packageType" parameter of "buildPackage" method is dynamically typed MethodParameterTypeRequired
55 info Line ends with whitespace characters TrailingWhitespace
55 info The String 'dist/*,dist-hyphenated/*' can be wrapped in single quotes instead of double quotes UnnecessaryGString
72 info Line ends with whitespace characters TrailingWhitespace
132 info Line ends with whitespace characters TrailingWhitespace
154 info setPackageVersion("${this.getPackageVersion()}${releaseCandidateSuffix}") can probably be rewritten as packageVersion = "${this.getPackageVersion()}${releaseCandidateSuffix}" UnnecessarySetter
/tmp/src/edu/uoregon/nts/Utilities.groovy
6 warning The class edu.uoregon.nts.Utilities implements Serializable but does not define a serialVersionUID SerializableClassMustDefineSerialVersionUID
46 warning Method parameter [gitCommitMessage] is never referenced in the method releaseCandidateFromLatestGitCommit of class edu.uoregon.nts.Utilities UnusedMethodParameter
51 info Line ends with whitespace characters TrailingWhitespace
54 info The public static method releaseCandidateFromGitCommit in class edu.uoregon.nts.Utilities is declared after a public instance method StaticMethodsBeforeInstanceMethods
npm-groovy-lint results in 5 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 1 │
│ 1 │ 'Warning' │ 7 │
│ 2 │ 'Info' │ 22 │
└─────────┴───────────┴─────────────┘
Failure: 1 error(s) have been found
7 warning(s) have been found
TIL that DockerHub doesn't really support 'digests' as of today... but I am using the docker image that was deployed '14 hours ago.'
$ date
Thu 07 Dec 2023 01:29:00 PM PST
$ docker image ls | grep groovy
nvuillam/npm-groovy-lint latest 9cedc4a8018d 14 hours ago 406MB
codenarc/codenarc 2.0.0-groovy2.5.12 d5a9c8f796ed 3 years ago 212MB
Thanks for your feedback:)