Skip to content

PMD - Salesforce APEX code analyzer action

Actions
Check Salesforce APEX code using PMD
7.0.0-rc4
Latest
Star (10)

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.1.0

Example usage

  • Run PMD rules defined in pmd-rules.xml
    • Custom ruleset should be hosted at your project repository
    • Check pmd-rules-example.xml if you are unfamiliar with PMD custom ruleset definition
name: scan-code
on: [push]
jobs:
  apex:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Setup PMD
      uses: legetz/[email protected]
    - name: APEX full scan
      run: pmd check --dir ./force-app/main/default/classes/*.cls --rulesets ./pmd-rules.xml -f text
  • Run only PMD design.xml default rules:
name: scan-code
on: [push]
jobs:
  apex:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Setup PMD
      uses: legetz/[email protected]
    - name: APEX full scan for design rules only
      run: pmd check --dir ./force-app/main/default/classes -R category/apex/design.xml -f text
name: scan-delta-code
on:
  pull_request:
    types: [opened, reopened, synchronize]
jobs:
  apex:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: APEX delta scan
      uses: mitchspano/[email protected]
      with:
        pmdconfig: pmd-rules.xml
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

PMD - Salesforce APEX code analyzer action 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

Check Salesforce APEX code using PMD
7.0.0-rc4
Latest

PMD - Salesforce APEX code analyzer action 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.