Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple CLI Java linter? [closed]

Tags:

java

lint

I've been trying to find a Java linter capable of running on the CLI that is separate from Eclipse that I can call as a commit hook for git or from our automated build script. Does such a thing exist?

Ideally it needs to check for unused imports and variables, that style guidelines are followed, exceptions are used properly, etc. Though some subset of those features would be better that what we have now - nothing!

like image 575
BlueDragonX Avatar asked Feb 04 '13 17:02

BlueDragonX


1 Answers

  • SpotBugs (earlier Findbugs) for finding existing bugs. VERY GOOD!
  • PMD for finding patterns that can lead to bugs (e.g. unused variables)
  • Checkstyle to enforce coding standards and conventions (e.g. whitespace, Javadoc)
  • Error Prone hooks right into your application's compile step
  • clang-format supports java and may be available on your system already

All these tools have some overlapping rules. There are many other similar tools, but these are the most popular and supported.

like image 180
mikeslattery Avatar answered Oct 01 '22 05:10

mikeslattery