Contact

Get More Out of PMD

Get More Out of PMD

PMD catches bugs, code smells, and duplicated code before they reach production, as long as it is set up to fit your codebase and your workflow. MicroDoc introduces PMD into running and green-field projects, tailors rulesets to your coding standards, builds custom rules and extensions, and supports your team over the long term.

Static Code Analysis That Works for Your Team

PMD is one of the most established open-source tools for static code analysis. It checks source code against a large set of rules and reports potential bugs, dead code, overly complex methods, questionable API usage, and violations of coding conventions. The bundled copy-paste detector, CPD, finds duplicated code across a wide range of languages.

Out of the box, though, PMD rarely gives teams what they hope for. Turn on every rule and the first report on an existing codebase lists thousands of findings, many of them irrelevant to the project. Developers start ignoring the report, the build gate gets switched off, and the tool quietly fades away. PMD pays off when the rules reflect what your organization actually cares about, when it runs automatically in every build, and when someone on hand understands how it works.

That is what we do. MicroDoc helps you introduce PMD, shape it around your coding standards, extend it where the built-in rules stop, and keep it running as your projects and PMD itself evolve.

Our PMD Expertise

  • Rules and rulesets: In-depth knowledge of the more than 400 built-in rules, including which ones catch real defects and which mostly produce noise.
  • Languages: Experience with Java, Apex, and the many other languages PMD supports, such as Kotlin, JavaScript, PL/SQL, and XML.
  • PMD internals: A solid understanding of the parsers, abstract syntax trees, type resolution, and rule engine underneath, which is the foundation for custom rules and extensions.
  • Duplicate detection: Practical know-how with CPD, including configuring it to find meaningful duplication rather than boilerplate.
  • Tooling: Familiarity with the Maven and Gradle plugins, the command line, CI systems, report formats such as SARIF, and IDE integrations that bring PMD into everyday development.

Introducing PMD into Running Projects

Large and long-lived codebases are where static analysis delivers the most value and where introducing it is the hardest. Nobody can stop feature work to fix ten thousand findings, and a build that fails on day one will not stay enabled for long.

We start with an analysis of your codebase and turn the results into a rollout plan:

  • Assessment: We run PMD with a broad ruleset, identify the findings that point to real defects and risks, and separate them from stylistic noise.
  • Baseline: Existing violations are recorded as a baseline, so the build only reports new issues. Your team gets immediate feedback on fresh code without having to clean up the past first.
  • Incremental tightening: Additional rules are enabled step by step, starting with those that have the best ratio of value to effort. Legacy findings are addressed as part of regular maintenance, not as a big-bang refactoring.
  • Integration: PMD runs in your Maven or Gradle build, in your CI pipeline, and in your developers’ IDEs, with results visible in pull requests where they are easiest to act on.

The result is a quality gate your developers accept, because it reports what matters and never blocks them for problems they did not introduce.

Starting Green-Field Projects Right

New projects have the advantage of starting clean, and that is the best moment to establish quality standards. We help you define a ruleset from the outset, configure strict build gates, and set up CI and IDE integration before the first feature is written. Developers see violations while they type rather than in a report weeks later, and the codebase stays consistent as the team grows.

For organizations that run many projects, we create a shared ruleset that is maintained centrally and versioned like any other dependency, so every new project starts with the same baseline.

Rulesets Tailored to Your Coding Standards

Most companies already have coding guidelines, often written down in a wiki that few developers read. We translate these guidelines into a PMD configuration, so they are checked automatically on every build. This includes selecting rules, adjusting thresholds such as complexity limits, excluding generated code, and documenting why each rule is part of the ruleset.

<ruleset name="Company Java Standard"
         xmlns="http://pmd.sourceforge.net/ruleset/2.0.0">
  <description>Coding standard for all Java projects</description>

  <exclude-pattern>.*/generated-sources/.*</exclude-pattern>

  <rule ref="category/java/errorprone.xml"/>
  <rule ref="category/java/bestpractices.xml">
    <exclude name="GuardLogStatement"/>
  </rule>
  <rule ref="category/java/design.xml/CyclomaticComplexity">
    <properties>
      <property name="methodReportLevel" value="12"/>
    </properties>
  </rule>
</ruleset>

A ruleset like this is short, reviewable, and lives next to your code, so changes to the coding standard follow the same review process as any other change.

Custom Rules and Extensions

Every organization has conventions that no generic tool knows about: architectural boundaries between modules, approved and forbidden APIs, framework-specific patterns, naming schemes, or security requirements. PMD can enforce these too, with custom rules.

  • XPath rules: Many conventions can be expressed as XPath queries over PMD’s syntax tree. These rules are quick to write and easy to maintain.
  • Java rules: For more complex checks that need type information, data flow, or cross-file context, we implement rules in Java against PMD’s rule API.
  • PMD enhancements: When a fix or feature belongs in PMD itself, such as a bug fix, an improvement to an existing rule, or support for additional language constructs, we implement it in PMD directly and contribute it upstream.

Every custom rule comes with tests, documentation, and examples of compliant and non-compliant code, and is packaged so it can be added to your build like any other dependency.

Ongoing Support and Training

Static analysis is not a one-time setup. New PMD versions add rules and change existing ones, your codebase grows, and your coding standards evolve. We stay with you after the introduction:

  • Version upgrades: We migrate your configuration and custom rules to new PMD releases, including major versions with API changes.
  • Troubleshooting: We analyze false positives, unexpected findings, and performance issues in large builds.
  • Ruleset maintenance: We review and adapt your rulesets as your guidelines and technology stack change.
  • Workshops: We train your team in using PMD effectively, interpreting findings, suppressing violations responsibly, and writing their own rules.

One Partner for Everything Around PMD

Whether you want to bring PMD into a large legacy codebase, set up a new project with clear quality standards from day one, or enforce company-specific conventions with custom rules, MicroDoc supports you from the first assessment through to long-term operation.

Get in touch to discuss your project.