Showing content from https://docs.pmd-code.org/latest/pmd_devdocs_how_pmd_works.html below:
How PMD Works | PMD Source Code Analyzer
Processing overview of the different steps taken by PMD.
Table of Contents Overview
The processing starts with the main class PmdAnalysis
.
- Parse command line parameters (see net.sourceforge.pmd.cli.PMDParameters) Also load the incremental analysis cache file
- Load rulesets/rules
- Determine languages (rules of different languages might be mixed in rulesets)
- Determine files (uses the given source directory, filter by the languageâs file extensions)
- Prepare the renderer
- Sort the files by name
- Check whether we can use the incremental analysis cache (if the rulesets changed, it will be invalid)
- Prepare the SourceCodeProcessor based on the configuration
- Analyze the files. Either single threaded or multi-threaded parallel. This task is encapsulated in
net.sourceforge.pmd.processor.PMDRunnable
:
- Create input stream
- Call source code processor (
net.sourceforge.pmd.SourceCodeProcessor
):
- Determine the language
- Check whether the file is already analyzed and a result is available from the analysis cache
- Parse the source code. Result is the root AST node.
- Always run the SymbolFacade visitor. It builds scopes, finds declarations and usages.
- Run DFA (data flow analysis) visitor (if at least one rule requires it) for building control flow graphs and data flow nodes.
- Run TypeResolution visitor (if at least one rule requires it)
- FUTURE: Run multifile analysis (if at least one rule requires it)
- Execute the rules:
- First run the rules that opted in for the rule chain mechanism
- Run all the other rules and let them traverse the AST. The rules can use the symbol table, type resolution information and DFA nodes.
- The rules will report found problems as RuleViolations.
- Render the found violations into the wanted format (XML, text, HTML, â¦)
- Store the incremental analysis cache
- Depending on the number of violations found, exit with code 0 or 4.
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4