Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-groovy-lint

Package Overview
Dependencies
Maintainers
1
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-groovy-lint

NPM CodeNarc wrapper to easily lint Groovy files

  • 2.0.0-beta3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.9K
decreased by-22.02%
Maintainers
1
Weekly downloads
 
Created
Source

NPM GROOVY LINT

Version Downloads/week CircleCI codecov GitHub contributors GitHub stars License HitCount PRs Welcome Say Thanks!

Wrapper for excellent groovy linter CodeNarc, using the great jdeploy and Groovy!

npm-groovy-lint allows you to run CodeNarc via command line without any installation issue

Easy to integrate in a CD/CI process (Jenkins Pipeline,CircleCI...) to lint your groovy or Jenkinsfile :)

INSTALLATION

    $ npm install -g npm-groovy-lint

For advanced usage, you may need to define RuleSet file(s)

You can use as starters :

USAGE

    $ npm-groovy-lint OPTIONS

npm-groovy-lint OPTIONS

ParameterDescriptionExample
--ngl-output=formatnpm-groovy-lint provided output (reformatted from CodeNarc output).
Available formats:
- text (default)
- json
--ngl-output=json
--ngl-output=text

CodeNarc OPTIONS

ParameterDescriptionExample
-basedir=DIRThe base (root) directory for the source code to be analyzed. Defaults to the current directory (".").-basedir=src/main/groovy
-includes=PATTERNSThe comma-separated list of Ant-style file patterns specifying files that must be included. Defaults to "**/*.groovy".-includes=**/*.gr
-excludes=PATTERNSThe comma-separated list of Ant-style file patterns specifying files that must be excluded. No files are excluded when omitted.-excludes=/templates/, **/Test.
-rulesetfiles=FILENAMESThe path to the Groovy or XML RuleSet definition files. This can be a single file path, or multiple paths separated by commas. By default, the paths specified are relative to the classpath. But these paths may be optionally prefixed by any of the valid java.net.URL prefixes, such as "file:" (to load from a relative or absolute path on the filesystem), or "http:". If it is a URL, its path may be optionally URL-encoded. That can be useful if the path contains any problematic characters, such as comma (',') or hash ('#'). For instance: "file:src/test/resources/RuleSet-,#.txt" can be encoded as: "file:src%2Ftest%2Fresources%2FRuleSet-%2C%23.txt" See URLEncoder#encode(java.lang.String, java.lang.String). Defaults to "rulesets/basic.xml".-rulesetfiles=rulesets/imports.xml, rulesets/naming.xml
-report=REPORT-TYPE[:FILENAME]The definition of the report to produce. The option value is of the form TYPE[:FILENAME], where TYPE is one of the predefined type names: "html", "xml", "text", "console" or else the fully-qualified class name of a class (accessible on the classpath) that implements the org.codenarc.report.ReportWriter interface. And FILENAME is the filename (with optional path) of the output report filename. If the report filename is omitted, the default filename for the report type is used ("CodeNarcReport.html" for "html" and "CodeNarcXmlReport.xml" for "xml"). If no report option is specified, default to a single "html" report with the default filename.-report=html -report=html:MyProject.html -report=xml -report=xml:MyXmlReport.xml -report=org.codenarc.report. HtmlReportWriter
-maxPriority1Violations=MAXThe maximum number of priority 1 violations allowed (int).-maxPriority1Violations=0
-maxPriority2Violations=MAXThe maximum number of priority 2 violations allowed (int).-maxPriority2Violations=0
-maxPriority3Violations=MAXThe maximum number of priority 3 violations allowed (int).-maxPriority3Violations=0
-title=REPORT TITLEThe title for this analysis; used in the output report(s), if supported by the report type(s). Optional.-title="My Project"
-helpDisplay the command-line help. If present, this must be the only command-line parameter.-help

See OPTIONS in CodeNarc documentation

EXAMPLES

    // npm-groovy-lint output

    $ npm-groovy-lint --ngl-output=text


    // npm-groovy-lint output

    $ npm-groovy-lint -includes=**/Jenkinsfile -rulesetfiles="file:config/codenarc/RuleSet-Groovy.groovy" --ngl-output=json


    // CodeNarc output

    $ npm-groovy-lint -includes=**/Jenkinsfile -rulesetfiles="file:config/codenarc/RuleSet-All.groovy" -title="MyJenkinsfileLinterReport" -maxPriority1Violations=0 -report="html:MyJenkinsfileLinterReport.html"


    // CodeNarc output

    $ npm-groovy-lint -basedir="src" -rulesetfiles="file:config/codenarc/RuleSet-Groovy.groovy" -title="MyGroovyLinterReport" -maxPriority1Violations=0 -report="html:MyGroovyLinterReport.html"

TROUBLESHOOTING

  • Embedded Groovy 3.0.1 has issues with JDK12, please use JDK11 or a precedent version if possible

CONTRIBUTE

Contributions are very welcome !

  • Fork the repo and clone it on your computer
  • Run npm run lint then npm run test to check your updates
  • Once your code is ready, documented and linted, please make a pull request :)

THANKS

This package is just a bundle with a little script, it relies on :

Keywords

FAQs

Package last updated on 20 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc