Wow, crazy to see this project still alive and thriving. I was using it 10+ years ago when I worked exclusively in Java. It was great to find those "obvious" issues that slip in that you didn't notice when you should of. I think I had it as a SVN pre-commit hook at one point.
At one point Sven Jacob added some data flow analysis. It was interesting stuff; I feel like we could have taken that a lot further. But anyhow, the combination of PMD and FindBugs can find quite a few bugs that would be hard to track down otherwise.
I'm not sure why this is on the frontpage since PMD (like Checkstyle and FindBugs) has been around for years. Still If your not familiar with PMD you should take a look. Anyway these days you probably want to invest in setting up SonarQube which is a superior tool in many ways (multi-language code analysis with webbassd dashboard etc)
Yes agreed. FindBugs appears to be kind of defunct anyway; there hasn't been a release since 2015 and the main developer isn't working on it any more. SonarSource has been gradually dropping the PMD and FindBugs rules from SonarQube and writing their own replacements.
Here's a shameless plug for https://coala.io/ which is a sort of a meta-linter — coala can run PMD on your code along with ~100 other linters and code checkers.
This seems especially useful when you don't want to think about how to set up linting, and what rules you want to use. There's a similar tool for Python, called prospector: https://github.com/landscapeio/prospector
With coala you need to configure which linters run on which files, and we recognize this as a thing we can improve upon. We're soon going to ship a feature which will allow configuration to just specify where the files are (e.g. 'src/*.py') and what aspects to check (e.g. 'syntax,smells,duplication,security'). Then coala will decide which tools are appropriate, get them from pip/npm/wherever, and run them.
It might be interesting to split those native linters out into separate projects so that other meta-linters like flycheck, check-all-the-things, various IDEs etc can also use them.
Indeed. However, you can run just those native linters with coala too (on specific files or entire projects). And we currently have plugin support for a few editors.
I'm not entirely sure what that format is, but coala can be formatted to output in any format you want using a `--format` flag. You have the result components such as message, line number, line, and several other parameters and you can build your own line.
And if that's not enough, you can also output as JSON.
Edit: and this applies to all linters - native and external.
You can specify exactly which linters you want though a coafile (a config file). For example, we have something called a GitCommitBear that lints your git commit messages. It's entirely written by us.
You can use just that bear:
[Commit]
bears = GitCommitBear
shortlog_trailing_period = False # disallow periods at the end of the shortlog
You can have other sections too (imagine the following section is in the same file as the above):
I've checked out Coala, I've been using FindBugs and SonarQube in the past, and sadly, all of the solutions I've seen miss support for Lisp language family. I could use some kind of linter for my Common Lisp code.
35 comments
[ 19.1 ms ] story [ 276 ms ] threadIn fact, the lead dev wrote a book "PMD Applied" and I wrote a review of it: http://caseysoftware.com/blog/book-review-pmd-applied
It's since been implemented in PHP too: https://phpmd.org/
"PMD scans source code in Java and other languages and looks for potential problems like:
- Possible bugs - empty try/catch/finally/switch statements
- Dead code - unused local variables, parameters and private methods
- Suboptimal code - wasteful String/StringBuffer usage Overcomplicated expressions - unnecessary if statements, for loops that could be while loops
- Duplicate code - copied/pasted code means copied/pasted bugs"
[0] http://pmd.sourceforge.net/snapshot/
1. https://github.com/facebook/infer
[1] https://github.com/coala/coala-emacs
With coala you need to configure which linters run on which files, and we recognize this as a thing we can improve upon. We're soon going to ship a feature which will allow configuration to just specify where the files are (e.g. 'src/*.py') and what aspects to check (e.g. 'syntax,smells,duplication,security'). Then coala will decide which tools are appropriate, get them from pip/npm/wherever, and run them.
Drat, I liked the name "Red Herring".
https://anonscm.debian.org/cgit/collab-maint/check-all-the-t...
And if that's not enough, you can also output as JSON.
Edit: and this applies to all linters - native and external.
We don't have support for SHA-1 sums for example, but these could be added very easily.
I've created an issue to support this in coala: https://github.com/coala/coala/issues/3525
Thanks!
You could take a look at the list of bears we support[1] (a bear is basically a plugin) though.
[1] https://github.com/coala/bear-docs
You can use just that bear:
You can have other sections too (imagine the following section is in the same file as the above): Again, LineLengthBear is a native solution.Of course, you can also combine native and external linters in the same section - they are virtually the same to the user.
I haven't used the one you linked to yet (thanks for the link!). Seems like it could be useful.