pmd/docs/pages/customizing/how_pmd_works.md
Andreas Dangel b193bb28d8 Add 'docs/' from commit '106142b25c9387ffd002437027ced1b04f494205'
git-subtree-dir: docs
git-subtree-mainline: 23545aa7ea599faf17737de9879733a1bde700d1
git-subtree-split: 106142b25c9387ffd002437027ced1b04f494205
2017-05-25 10:01:42 +02:00

1.3 KiB

title short_title tags summary series weight last_updated sidebar permalink folder
PMD How it Works How it Works
customizing
How PMD Works Customizing PMD 1 July 3, 2016 mydoc_sidebar how_pmd_works.html mydoc

{% include custom/series_customizing.html %}

How it works

PMD checks source code against rules and produces a report. Like this:

  • Something passes a file name and a RuleSet into PMD.
  • PMD hands an InputStream of the source file to a JavaCC-generated parser.
  • PMD gets a reference to an Abstract Syntax Tree back from the parser.
  • PMD hands the AST off to the symbol table layer which builds scopes, finds declarations, and find usages.
  • If any rules need data flow analysis, PMD hands the AST over to the DFA layer for building control flow graphs and data flow nodes.
  • Each Rule in the RuleSet gets to traverse the AST and check for problems. The rules can also poke around the symbol table and DFA nodes.
  • The Report is now filled with RuleViolations, and those get printed out in XML or HTML or whatever.

Not much detail here… if you think this document can be improved, please post here and let us know how. Thanks!

{% include custom/series_customizing_previous.html %} {% include custom/series_customizing_next.html %}

{% include links.html %}