Checkstyle for Java using GitHub Action and Reviewdog

ReviewDog + GitHub Actions: enforce team agreements without breaking your flow

Code style agreements are essential for long-term maintainability. But in most teams, enforcing them is tricky: warnings get ignored, and blocking the CI for every style rule can feel excessive. That’s where ReviewDog shines.

This setup uses ReviewDog in combination with CheckStyle and GitHub Actions to surface violations directly in pull requests — without interrupting builds. Developers get inline comments tied to their changes, keeping the review focused on business logic while still catching style issues early.

The GitHub Action acts as a bridge between your linter and ReviewDog, translating CLI output into annotated feedback on your PR. This creates a lightweight but highly visible layer of enforcement for your team’s coding standards.

Even better: it scales with your rules. Whether you’re just starting with a few basic checks or managing a full custom CheckStyle config, ReviewDog integrates seamlessly — and enforces agreements without friction.

⚙️ Example: GitHub Action for CheckStyle + ReviewDog

Here’s a minimal example of how to integrate CheckStyle and ReviewDog in a GitHub Action:

name: reviewdog-checkstyle

on: [pull_request]

jobs:
  checkstyle:
    name: CheckStyle Lint
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Java
        uses: actions/setup-java@v3
        with:
          distribution: 'temurin'
          java-version: '17'

      - name: Run CheckStyle
        run: |
          ./gradlew checkstyleMain -PcheckstyleOutputFile=checkstyle-result.xml

      - name: Run ReviewDog
        uses: reviewdog/action-checkstyle@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review
          checkstyle_reporter_output: checkstyle-result.xml

Make sure your CheckStyle task is configured to output in XML format, and that checkstyle-result.xml points to the correct path.

Result

CheckStyle and ReviewDog Integration

You can see the example here

Project link: https://github.com/dberna2/check-style

Nifty tech tag lists from Wouter Beeftink