Skip to content

Uses CheckStyle (8.24) (https://checkstyle.sourceforge.io/cmdline.html) to check the styling of your java files.

License

LGPL-2.1, Apache-2.0 licenses found

Licenses found

LGPL-2.1
LICENSE
Apache-2.0
LICENSE.apache20
Notifications You must be signed in to change notification settings

Lindsay-Needs-Sleep/java-checkstyle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-checkstyle

About

Use this to check the style of any java files you have in your node project.

This uses the CheckStyle library (8.24) to actually check your files.

installation

npm install java-checkstyle --save-dev

--save-dev is optional, but odds are you are only interested in this plugin for development

cmd line use

> npx java-checkstyle [-c optional path to config file] <dirs or files to check, space delimited>

If the config file is not specified it defaults to sun_checks.xml (/res/sun_checks.xml)

module usage

runJavaCheck

Logs any discovered style errors to the console

param {Array or String} path or paths of files to check (can dirs)
param {String} configFile (optional) - if not specified defaults to sun_checks.xml (/res/sun_checks.xml). See here for details on the config file.
param {function(err)} - An err will possibly returned. See config file notes.

var checkstyle = require('java-checkstyle');

checkstyle.runJavaCheck([./file1.java, ./dir1], configFilePath, function (err) {
    // Done checking
})

Config file notes

If you have specified:

<property name="severity" value="error"/>

In your config file then if any style errors are found the checkstyle.runJavaCheck callback will be called with a string like "Check ends with 3 errors".

If you have instead specified:

<property name="severity" value="warning"/>

And if the check still only finds "warnings" the callback will not be called with an error string. But the actual warning will still be printed to console.error.

Contributing

Before submitting a pull request please:

  • Update the documentation as necessary
  • Run npm run style to ensure consistent styling
  • Run npm run test and ensure all tests pass
  • Added automated test coverage as appropriate for this change

About

Uses CheckStyle (8.24) (https://checkstyle.sourceforge.io/cmdline.html) to check the styling of your java files.

Resources

License

LGPL-2.1, Apache-2.0 licenses found

Licenses found

LGPL-2.1
LICENSE
Apache-2.0
LICENSE.apache20

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published