Coder Social home page Coder Social logo

Comments (9)

admiralAwkbar avatar admiralAwkbar commented on June 1, 2024

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.

nvuillam avatar nvuillam commented on June 1, 2024

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.

admiralAwkbar avatar admiralAwkbar commented on June 1, 2024

@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.

nvuillam avatar nvuillam commented on June 1, 2024

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.

admiralAwkbar avatar admiralAwkbar commented on June 1, 2024

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.

nvuillam avatar nvuillam commented on June 1, 2024

It seems that CodeNarc does not write in its XML output file when there is a parse error

image

I'll try to find a solution

from npm-groovy-lint.

nvuillam avatar nvuillam commented on June 1, 2024

Working on the solution... I'll keep you informed :)

from npm-groovy-lint.

admiralAwkbar avatar admiralAwkbar commented on June 1, 2024

@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.

nvuillam avatar nvuillam commented on June 1, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.