Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

PMD - Salesforce APEX code analyzer action

  • This action allows to use PMD Source Code Analyzer from GitHub Actions
  • You can easily validate whole Apex codebase every time when push happens against any/certain branches
  • Latest version uses PMD 7.22.0

Example usage

  • Run PMD rules defined in pmd-rules.xml
name: scan-codeon: [push]jobs:
apex:
runs-on: ubuntu-lateststeps:
- name: Checkout codeuses: actions/checkout@v6with:
fetch-depth: 0
- name: Setup PMDuses: legetz/setup-pmd@7.22.0
- name: APEX full scanrun: pmd check --dir ./force-app/main/default/classes/*.cls --rulesets ./pmd-rules.xml -f text
  • Run only PMD design.xml default rules:
name: scan-codeon: [push]jobs:
apex:
runs-on: ubuntu-lateststeps:
- name: Checkout codeuses: actions/checkout@v6with:
fetch-depth: 0
- name: Setup PMDuses: legetz/setup-pmd@7.22.0
- name: APEX full scan for design rules onlyrun: pmd check --dir ./force-app/main/default/classes -R category/apex/design.xml -f text
name: scan-delta-codeon:
pull_request:
types: [opened, reopened, synchronize]jobs:
apex:
runs-on: ubuntu-lateststeps:
- name: Checkout codeuses: actions/checkout@v6with:
fetch-depth: 0
- name: APEX delta scanuses: mitchspano/sfdx-scan-pull-request@v0.1.16with:
pmdconfig: pmd-rules.xmlenv:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

About

PMD for GitHub Actions

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages