Comments (9)
Tried to get it working a different way and it just doesn't show output for the second file...
bash-5.0# npm-groovy-lint --path "./test" --files "**/*.groovy" --verbose
/test/good.groovy
2 warning Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
npm-groovy-lint results in 2 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 0 │
│ 1 │ 'Warning' │ 1 │
│ 2 │ 'Info' │ 0 │
As from above, I have a good.groovy
and a bad.groovy
, the good is a syntax-correct file, and the bad is set to:
/* Hello World in Groovy */
pr ('some dank")
Does it seem to just skip it in output?
from npm-groovy-lint.
I think that if you want to analyze the results of several groovy files, you should use --output json :)
The text output is more for a human to read
from npm-groovy-lint.
@nvuillam Can you help me understand why it's not showing data for the second file with the bad data? Is my command incorrect or am I looking at this wrong? Any help is much appreciated
from npm-groovy-lint.
Plz can you fork the repo , add your test case in errors.test.js and send me the link, so I can reproduce the issue ?
from npm-groovy-lint.
Hey @nvuillam sorry got sidetracked and didn't have a ton of time...
You can recreate this test by:
- Install
npm-groovy-lint
- create a folder called
test
mkdir test
- create file groovy-bad.groovy
class Example {
static void main(String[] args) {
File file = new File("E:/Example.txt")
println "The file ${file.absolutePath} has ${file.length()} bytes"
}
}
class Example{
some noise here
}
- Run linter against the file
bash-5.0# npm-groovy-lint --failon error --path "./test" --files "**/bad.groovy"
npm-groovy-lint results in 1 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 0 │
│ 1 │ 'Warning' │ 0 │
│ 2 │ 'Info' │ 0 │
└─────────┴───────────┴─────────────┘
bash-5.0# echo $?
0
As you can see, it shows 1 linted file, but none of the output, and error code is 0
Can you help me understand what i may be doing wrong?
Working case
If I point it to a file with decent data, it works as expected
Example of good.groovy:
class Example {
static void main(String[] args) {
File file = new File("E:/Example.txt")
println "The file ${file.absolutePath} has ${file.length()} bytes"
}
}
Output
bash-5.0# npm-groovy-lint --failon error --path "./test" --files "**/good.groovy"
/tests/good.groovy
1 warning Class `Example` is the only class in `good.groovy`. In such a case the file and the class should have the same name. ClassNameSameAsFilename
1 warning Class should be marked with one of @GrailsCompileStatic, @CompileStatic or @CompileDynamic CompileStatic
2 info Class does not start with a blank line after the opening brace ClassStartsWithBlankLine
2 info The method main in class Example is at the incorrect indent level: Expected column 5 but was 4 Indentation
3 info The statement on line 3 in class Example is at the incorrect indent level: Expected column 9 but was 7 Indentation
3 warning The use of java.io.File violates the Enterprise Java Bean specification JavaIoPackageAccess
3 info The String 'E:/Example.txt' can be wrapped in single quotes instead of double quotes UnnecessaryGString
4 info The statement on line 4 in class Example is at the incorrect indent level: Expected column 9 but was 7 Indentation
5 info Line ends with whitespace characters TrailingWhitespace
6 info Class does not end with a blank line before the closing brace ClassEndsWithBlankLine
npm-groovy-lint results in 1 linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity │ Total found │
├─────────┼───────────┼─────────────┤
│ 0 │ 'Error' │ 0 │
│ 1 │ 'Warning' │ 3 │
│ 2 │ 'Info' │ 7 │
└─────────┴───────────┴─────────────┘
bash-5.0#
from npm-groovy-lint.
It seems that CodeNarc does not write in its XML output file when there is a parse error
I'll try to find a solution
from npm-groovy-lint.
Working on the solution... I'll keep you informed :)
from npm-groovy-lint.
@nvuillam awesome. Even if it just marked the file as failed to parse and exited with error, that would achieve the main goal
from npm-groovy-lint.
@admiralAwkbar please can you check with latest version ? (v5.7.0)
I had to embed Ant in the package, but now every file is parsed before being sent to CodeNarc, so all parsing errors are returned
Please reopen if you still see any problem :)
from npm-groovy-lint.
Related Issues (20)
- Is there a way to ignore unknown rules? HOT 2
- Using npm-groovy-lint as a module giving webpack errors HOT 3
- npm-groovy-lint --version returns wrong CodeNarc version HOT 1
- Upgrade logback to 1.4.14 HOT 3
- Groovy4 support? HOT 3
- The console.log statements output in NeoVim formatting HOT 1
- o.c.r.PropertiesFileRuleSetConfigurer -- RuleSet configuration properties file [codenarc.properties] not found. HOT 6
- Wrong lint fix indentation HOT 2
- o.c.r.PropertiesFileRuleSetConfigurer -- RuleSet configuration properties file [codenarc.properties] not found. HOT 4
- proposal: ci improvements HOT 7
- Custom rule HOT 1
- temp directories aren't cleaned up HOT 3
- Error when running as pre-commit hook: SyntaxError: Unexpected token ; HOT 2
- Error with latest version of the docker container when running in GHA HOT 13
- CodeNarcServer unexpected error HOT 11
- Make a warning when enabling non-disabled rule HOT 5
- Critical vulnerabilities with axios package in latest version HOT 4
- Incorrect indentation in blocks and braces HOT 2
- Error running npm-groovy-lint in Docker container: GroovyLint: Unable to start CodeNarc Server. HOT 1
- In case of grouped imports linter returns error NglParseError: unable to find class 'TestGroup.CAN' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from npm-groovy-lint.