[Feature Request] Support PMD incremental analysis cache in code-analyzer.yml and CLI

未關閉
#2,109 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
tooling

研究方向

Start by reading the PMD engine wrapper and its configuration handling, then trace how sf code-analyzer run builds the PMD command. The issue does not name those files or tests, so locate the existing PMD options and related tests first. Done means a configured cache path reaches PMD as --cache <path> and the behavior is covered for the YAML configuration or CLI option.

由索引模型根據 Issue 內容生成。

描述

Product Area

An Engine

Your Need or Problem

Related to #671 .
Was this implemented in v5 or is it still planned to be implemented in the future?

In large enterprise codebases with hundreds of Apex classes and custom PMD rulesets, running static code analysis via sf code-analyzer run can take a significant amount of time.

Your Desired Solution
1. Configuration in code-analyzer.yml

Expose a configuration property under engines.pmd to specify the cache file path or toggle caching:

engines:
  pmd:
    cache_file: .pmdcache       # Path to the incremental analysis cache file
    custom_rulesets:
      - config/pmd-ruleset.xml
2. Passthrough to PMD Runtime

When cache_file is specified (or enabled via a CLI flag such as --pmd-cache), the PMD engine wrapper should append --cache to the underlying PMD command invocation.

Alternatives Considered
  1. Targeting files via git diff:
    Passing only changed files (--target) works for simple commit-level scans, but it does not maintain a persistent baseline for full-branch audits, nightly builds, or full CI matrix runs where a full repository scan is expected.

  2. Invoking native PMD directly:
    Running native PMD CLI (pmd check --cache ...) allows incremental analysis, but we lose Salesforce Code Analyzer’s unified reporting, severity normalization, exit code management, and multi-engine orchestration (e.g., combining PMD with ESLint or Sfge).

Additional Context (Screenshots, Files, etc)
  • Target Engine: PMD (PMD 7.x)

  • Environment: Enterprise CI/CD pipelines (GitHub Actions, Azure DevOps, GitLab CI) and local pre-commit hooks where reducing turnaround time directly improves developer productivity.

Workaround

No response

Urgency

Low

主要語言
TypeScript
星號
241
分支
53
PR 合併指標
30 天內沒有已合併 PR

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

forcedotcom/code-analyzer 的其他 Issue

查看 forcedotcom/code-analyzer 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。