mirror of
https://github.com/Jaganpro/sf-skills.git
synced 2026-09-19 07:52:00 +08:00
8ace846293
2 3 Adds OOTB linting via sf code-analyzer CLI to augment custom 150-point 4 scoring. Hooks auto-trigger on Write/Edit of Apex and Flow files. 5 6 NEW INFRASTRUCTURE (shared/code_analyzer/): 7 - scanner.py: Core wrapper for `sf code-analyzer run` CLI 8 - dependency_checker.py: Multi-path Java detection (Homebrew support) 9 - score_merger.py: Combines custom scoring with CA violations 10 - parser.py: JSON result normalization 11 - formatter.py: Terminal output formatting 12 - config/code-analyzer.yml: Engine configuration 13 14 HOOK INTEGRATION: 15 - sf-apex/hooks: Added Edit matcher, post-tool-validate.py 16 - sf-flow/hooks: Added Edit matcher, post-tool-validate.py 17 - Timeout increased to 120s for CA scans 18 19 KEY FEATURES: 20 - 7 engines: PMD, CPD, SFGE, ESLint, RetireJS, Flow Scanner, Regex 21 - Graceful degradation when deps missing (Java, Node, Python) 22 - Auto-detects Java in Homebrew paths (/opt/homebrew/opt/openjdk@*) 23 - Propagates JAVA_HOME to sf CLI subprocess 24 - Filters engine errors from violation output 25 26 FIXES INCLUDED: 27 - Java detection: Handles Salesforce wrapper scripts 28 - SFGE errors: No longer shown as CRITICAL violations 29 - Class name parsing: Excludes "class" keyword in comments 30 - Flow Python: Explicit python_command in config 31 32 VALIDATION OUTPUT FORMAT: 33 🔍 Apex Validation: AccountService.cls 34 📊 Score: 138/150 ⭐⭐⭐⭐ Very Good 35 🔬 Code Analyzer: pmd, regex (3482ms) 36 ❗ Issues: [sf-skills] + [CA:pmd] combined 37 38 STATS: 14 files changed, ~3500 insertions
51 lines
2.1 KiB
YAML
51 lines
2.1 KiB
YAML
# =============================================================================
|
|
# Salesforce Code Analyzer V5 Configuration for sf-skills
|
|
# =============================================================================
|
|
# This configuration augments the 150-point custom scoring with OOTB engines.
|
|
# All engines enabled by default with graceful degradation when deps missing.
|
|
#
|
|
# Documentation: https://developer.salesforce.com/docs/platform/salesforce-code-analyzer
|
|
# =============================================================================
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Engine Configuration
|
|
# -----------------------------------------------------------------------------
|
|
# Note: Using default PMD rules (80+ Apex rules) which cover:
|
|
# - Bulkification (OperationWithLimitsInLoop, AvoidSoqlInLoops)
|
|
# - Security (ApexCRUDViolation, ApexSharingViolations, ApexSOQLInjection)
|
|
# - Testing (ApexUnitTestClassShouldHaveAsserts, ApexUnitTestShouldNotUseSeeAllDataTrue)
|
|
# - Clean Code (CognitiveComplexity, EmptyCatchBlock, AvoidDeeplyNestedIfStmts)
|
|
# - Documentation (ApexDoc)
|
|
# -----------------------------------------------------------------------------
|
|
engines:
|
|
# PMD - Static analysis for Apex, Visualforce, XML (requires JDK 11+)
|
|
pmd:
|
|
disable_engine: false
|
|
|
|
# CPD - Copy-Paste Detection (requires JDK 11+)
|
|
# Note: cpd configuration requires special format, using defaults
|
|
cpd:
|
|
disable_engine: false
|
|
|
|
# Salesforce Graph Engine - Data flow analysis (requires JDK 11+)
|
|
sfge:
|
|
disable_engine: false
|
|
|
|
# ESLint - JavaScript/LWC linting (requires Node.js)
|
|
eslint:
|
|
disable_engine: false
|
|
|
|
# RetireJS - JavaScript dependency vulnerability scanning (requires Node.js)
|
|
retire-js:
|
|
disable_engine: false
|
|
|
|
# Flow Scanner - Salesforce Flow validation (requires Python 3.10+)
|
|
flow:
|
|
disable_engine: false
|
|
# Explicit Python path for environments where sf CLI can't find it
|
|
python_command: /opt/homebrew/opt/python@3.14/bin/python3
|
|
|
|
# Regex - Pattern-based rules (no external dependencies)
|
|
regex:
|
|
disable_engine: false
|