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

Aberta
#2,109 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
tooling

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
TypeScript
Estrelas
241
Forks
53
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de forcedotcom/code-analyzer

Todas as issues de forcedotcom/code-analyzer

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.