Run a static analysis of apex classes with PMD

Task Id

Version

sfpwowerscripts-analyzewithpmd-task

7.0.6

This task is used to run a static analysis of the apex classes in a project directory using PMD. This is a task execution wrapper around the command sfpowerkit:source:pmd which you can read here

This task attaches the code analysis result into the build artifacts and also provides a timeline update in the build summary page.

This task when used in a build pipeline features a report window that gets displayed along with the logs.

Prerequisites

Install SFDX CLI with sfpowerkit task must be added to the pipeline before utilizing this task

Task Snapshot

Parameters

Input Parameters
Output Parameters
YAML Example
Input Parameters

Classic Designer Labels are in Bold, YAML Variables are in italics

  • Source directory that needs to be analyzed / directory The directory to be analyzed. Note: If left blank, the default directory from sfdx-project.json will be used

  • Select the ruleset to be used for analysis / ruleset sfpowerkit comes with a default ruleset. Select custom if you want to use your own ruleset

  • Path to ruleset / rulesetpath Specify the ruleset path for PMD if using the custom option, leaving this blank will result in using the default options as of sfpowerkit

  • Format for the static analysis to be displayed in the console and written to the result file / format Select the format for the code analysis report to be generated

  • Output file / outputPath The name or path to the file if you want the report to be saved to a particular location, The result of PMD analysis will also be uploaded into the build artifacts

  • Report the build as failure if there is critical defects / isToBreakBuild Select this option if you want the build to be failed if PMD observes any critical defects in the code being analyzed

  • Project Directory / project_directory The directory to the folder containing the sfdx-project.json file Note: Leave this blank if the sfdx-project.json file is in the root of the repository

Output Parameters

None

YAML Example
- task: [email protected]<version>
displayName: PMD Static Code Coverage
inputs:
ruleset: Custom
rulesetpath: '$(Parameters.rulesetpath)'
format: html

Changelog

  • 7.0.0 #113 Fix PMD Apex Analysis dashboard

  • 6.0.4 Remove Telemetry collection

  • 5.0.9 Refactored to use revamped folder structure

  • 4.3.10 Minor Fixes for buffer size

  • 4.3.0 Updated with minor changes for the data to be displayed in PMD Analysis Tab

  • 4.0.1 Updated with Telemetry

  • 3.1.0 Initial Version

Edit on GitHub