Skip to content

legetz/setup-pmd

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.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/setup-pmd@7.1.0
    - 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/setup-pmd@7.1.0
    - 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/sfdx-scan-pull-request@v0.1.16
      with:
        pmdconfig: pmd-rules.xml
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

About

PMD for GitHub Actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%