Skip to content

PMD Reviewdog Reporter

Actions

About

Run PMD static analysis and report issues in PRs via reviewdog comments
v1.0.0
Latest
Star (0)

PMD Reviewdog Reporter

Run PMD static analysis on your code and report issues as GitHub PR comments via reviewdog.

ℹ️ Note: This action only integrates PMD with reviewdog.
If you want GitHub annotations instead of reviewdog comments, use the original pmd-github-action.


Example Output

By default, this action uses the github-pr-review reporter mode.
In this mode, reviewdog posts PMD findings as PR comments, which you can see in different tabs:

  • Conversation tab PMD comments in PR Conversation

  • Files Changed tab PMD comments in Files Changed

Usage

name: PMD Check

on:
  pull_request:
    paths:
      - '**/*.java'

jobs:
  pmd-review:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - name: Set up Java
        uses: actions/setup-java@v5
        with:
          distribution: temurin
          java-version: 21

      - name: Run PMD + Reviewdog
        uses: RodionKorneev/pmd-reviewdog-action@v1
        with:
          rulesets: 'rulesets/java/quickstart.xml'

⚠️ Java must be installed on the runner, since PMD runs on the Java Virtual Machine.

This is not handled by the action itself because:

  • The required Java version may vary between projects.
  • Users may already have Java installed on the runner.
  • GitHub-hosted runners or self-hosted runners may use different Java distributions.

Therefore, the action assumes that a compatible Java runtime is already available in the environment.

Inputs

Input Default Description
rulesets ⚠️Requred

Comma-separated list of PMD rulesets to use.

You can use default rulesets provided by PMD, or create your own custom ruleset and reference it.

See rulesets in https://github.com/pmd/pmd-github-action.

github_token ${{github.token}} GitHub token used by PMD to determine modified files and by reviewdog to post comments.
pmd_version latest

PMD version to use. Using latest automatically downloads the latest release.

Available versions: https://github.com/pmd/pmd/releases.

See version in https://github.com/pmd/pmd-github-action.

pmd_download_url

Optionally specify a custom URL for downloading the PMD binary.

See downloadUrl in https://github.com/pmd/pmd-github-action.

workdir .

Directory to run PMD in.

See sourcePath in https://github.com/pmd/pmd-github-action.

analyze_modified_only false

Only analyze files modified in a PR or push instead of all files in workdir.

See analyzeModifiedFilesOnly in https://github.com/pmd/pmd-github-action.

upload_sarif_report true

Upload generated SARIF report as artifact named "PMD Report".

See uploadSarifReport in https://github.com/pmd/pmd-github-action.

reviewdog_version latest

Reviewdog version.

See reviewdog_version in https://github.com/reviewdog/action-setup.

tool_name PMD Tool name for reviewdog reporter.
reporter github-pr-review

Reviewdog reporter type.

See available options at: https://github.com/reviewdog/reviewdog#reporters

level error Reviewdog report level (info, warning, error).
fail_level any

Reviewdog fail level. Determines at which level the step fails.

See https://github.com/reviewdog/reviewdog?tab=readme-ov-file#exit-codes.

filter_mode nofilter

Reviewdog filtering mode.

See https://github.com/reviewdog/reviewdog?tab=readme-ov-file#filter-mode.

reviewdog_flags Additional flags to pass to reviewdog command.

Outputs

This action does not produce outputs, all results are reported via reviewdog in PR comments or GitHub checks.

How it Works

This action is a composite GitHub Action that combines:

  1. pmd/pmd-github-action — runs PMD static analysis.
  2. reviewdog/action-setup — installs reviewdog CLI.

All inputs you provide to pmd-reviewdog-action are used as follows:

  • rulesets, workdir, pmd_version, etc. → forwarded to pmd/pmd-github-action.
  • tool_name, reporter, level, fail_level, filter_mode, reviewdog_flags → passed to the reviewdog CLI when reporting issues.

A few internal parameters are handled internally, but in general you can configure PMD analysis and reviewdog reporting in a way very similar to using the underlying tools directly.

License

This action is licensed under the MIT License © Rodion Korneev.

PMD Reviewdog Reporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Run PMD static analysis and report issues in PRs via reviewdog comments
v1.0.0
Latest

PMD Reviewdog Reporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.