Overview
PMD is an open-source, multi-language static code analyzer designed to identify common programming flaws such as unused variables, empty catch blocks, and unnecessary object creation. It supports a wide range of languages, including Java, Apex, JavaScript, Kotlin, Swift, and others. PMD parses source code into abstract syntax trees (AST) using JavaCC and Antlr, then applies rules against these ASTs to detect violations. Rules can be defined in Java or using XPath queries, offering flexibility in customizing code analysis. It integrates into build processes as a Maven goal, Ant task, Gradle task, or via command-line execution. Additionally, PMD includes CPD, a copy-paste-detector that finds duplicated code across various programming languages, enhancing code maintainability and reducing redundancy.
