forcedotcom/sf-skills / plugins/builder/salesforce-code-quality/skills/dx-code-analyzer-configure
dx-code-analyzer-configure
FlaggedSet up, configure, and troubleshoot Salesforce Code Analyzer for any project. Handles installation, prerequisite checks, diagnosing broken setups, creating and editing code-analyzer.yml overrides, engine-specific settings, ignore patterns, severity overrides, and CI/CD pipeline setup. TRIGGER when: user says 'set up code analyzer', 'configure code analyzer', 'install code analyzer', 'code analyzer not working', 'fix my setup', 'scan failing', 'check my setup', 'enable/disable engine', 'exclude files', 'change severity', 'set up GitHub Actions', 'set up CI/CD', 'add to pipeline', 'pipeline fail', 'update my workflow', 'quality gate', 'fail on violations', 'scan changed files only', 'add SARIF', 'code-analyzer.yml', 'ESLint config', 'increase SFGE memory', or reports errors running Code Analyzer. DO NOT TRIGGER when: user wants to run a scan (use dx-code-analyzer-run), fix violations, explain rules, create custom rules (use dx-code-analyzer-custom-rule-create), or suppress violations.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 22.0 KB |
| examples/apex-project-config.yml | config | 1.2 KB |
| examples/ci-github-actions.yml | config | 2.5 KB |
| examples/fullstack-project-config.yml | config | 1.3 KB |
| examples/lwc-project-config.yml | config | 772 B |
| references/ci-cd-templates.md | markdown | 23.4 KB |
| references/config-schema.md | markdown | 6.7 KB |
| references/diagnostic-flow.md | markdown | 3.1 KB |
| references/engine-prerequisites.md | markdown | 5.1 KB |
| references/rule-name-resolution.md | markdown | 3.1 KB |
| references/troubleshooting.md | markdown | 7.3 KB |
| scripts/check-prerequisites.shexecutable | script | 6.2 KB |
| scripts/generate-config.shexecutable | script | 3.7 KB |
| scripts/validate-config.shexecutable | script | 5.1 KB |
examples/ci-github-actions.yml
View on GitHub# GitHub Actions Workflow — Code Analyzer Quality Gate
#
# Scans pull requests for code quality and security violations.
# Uploads SARIF results to GitHub Code Scanning for inline annotations.
#
# Usage:
# Copy to .github/workflows/code-analyzer.yml in your repository
# Customize severity-threshold and rule-selector as needed
#
# Prerequisites:
# - Repository must have GitHub Advanced Security enabled for SARIF upload
# - Or remove the "Upload SARIF" step for basic artifact-only workflow
name: Code Analyzer
on:
pull_request:
branches: [main, develop]
paths:
- 'force-app/**'
- 'src/**'
- '**/*.cls'
- '**/*.trigger'
- '**/*.js'
- '**/*.ts'
- '**/*.html'
- '**/*.flow-meta.xml'
- 'code-analyzer.yml'
push:
branches: [main, develop]
permissions:
contents: read
security-events: write # Required for SARIF upload
jobs:
code-analysis:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for diff-based scans
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Install Salesforce CLI
run: npm install -g @salesforce/cli
- name: Install Code Analyzer
run: sf plugins install @salesforce/plugin-code-analyzer
- name: Verify installation
run: |
sf --version
sf plugins --core | grep code-analyzer
java -version
node --version
- name: Run Code Analyzer
run: |
sf code-analyzer run \
--rule-selector Recommended \
--severity-threshold 2 \
--output-file results.sarif \
--output-file results.json \
--output-file results.html \
--config-file code-analyzer.yml
- name: Upload SARIF to GitHub Security
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
category: code-analyzer
- name: Upload Results as Artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: code-analyzer-results
path: |
results.json
results.html
retention-days: 30
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |