forcedotcom / forcedotcom/code-analyzer

[Feature Request] Filename-based suppression per engine or file

オープン
#2,028 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
240
フォーク
52
平均マージ
1日 23時間
マージ済み PR(30日)
5

説明

### Product Area

The "code-analyzer" CLI

### Your Need or Problem

I like the
```yaml
ignores:
files:
- "**/utils.js"
```
feature.

Currently, it exists at the top level, meaning we can only exclude filenames for all engines. I would like to exclude at the engine or file level.

The background: Salesforce provides some stock/standard files (JavaScript, Visualforce, Aura, LWC) that have rule violations in them. Instead of having to fix them all when importing starter metadata, I want to exclude them... but I would like to do that from the config file.

IDEALLY, I could do a suppression PER RULE, but I fear that is too much to ask.

This is resulting in a LOT of false-positives and noise, and is stopping our pipeline every time we create a new kind of Experience Cloud site.

### Your Desired Solution

```yaml
engines:
pmd:
ignores:
- "selfRegister.cmp"
- "CommunityTemplate.page"
```
or

```yaml
rules:
pmd:
"LoadCSSApexStylesheet":
severity: 2
ignores:
- "CommunityTemplate.page"
tags:
- AppExchange
- Security
- Visualforce
```

My vision for using Code Analyzer is that I have a standard config file I use for all my projects as a starting point, and that one would include suppressing checks on those files. I could load that as a default in each of my repos/projects.

### Alternatives Considered

PMD doesn't have a robust "ignore this rule for this filepath" from the ruleset feature, so I know I'm asking for a lot here.

I can exclude files in my custom ruleset, but that only applies to pmd rules.

I can override the specific rule and make a very long XPath exception property, which works, and might be good for some files, but isn't ideal.

### Additional Context (Screenshots, Files, etc)

_No response_

### Workaround

I have been able to suppress for most files (not JavaScript) by editing the file. But I don't want to have to edit each default file as Salesforce creates them.

### Urgency

Moderate

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

エントリーポイントは code-analyzer の CLI 設定です。まず、トップレベルの YAML 設定 `ignores.files` がどのように解析され、適用されるかを追跡します。要求されている engine レベルとルール単位の形式を比較し、ファイル名の抑制を他の engine やルールに影響を与えずにスコープできることを示すカバレッジを定義します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript, yaml
領域
cli, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。