forcedotcom / forcedotcom/code-analyzer

[BUG][code-analyzer] Potential PMD Issue: exclude-pattern in Referenced Ruleset Not Respected

オープン
#1,820 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

WaitingForFixFromPMD
主要言語
TypeScript
スター
240
フォーク
52
平均マージ
1日 23時間
マージ済み PR(30日)
5

説明

I'm encountering an issue with configuring code-analyzer to exclude files with specific prefixes. This is for a Salesforce org repository, and I'm using the PMD engine with a custom custom-ruleset.xml file. Despite specifying the prefixes to be ignored, the scanner still seems to process those files. For example I want to exclude Apex classes that have a prefix of fflib_ or TM. This is what the custom-ruleset.xml file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Custom Apex Rules"
         xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
                             https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

  <description>
    PMD ruleset that excludes fflib-related and TM-prefixed classes and their metadata files.
  </description>

  <!-- Exclude patterns -->
  <exclude-pattern>.*/fflib_.*\.(cls|trigger|cls-meta\.xml|trigger-meta\.xml)$</exclude-pattern>
  <exclude-pattern>.*/fflib-.*/.*\.(cls|trigger|cls-meta\.xml|trigger-meta\.xml)$</exclude-pattern>
  <exclude-pattern>.*/TM[^/]*\.(cls|trigger|cls-meta\.xml|trigger-meta\.xml)$</exclude-pattern>

  <!-- Apex rules -->
  <rule ref="category/apex/design.xml/CognitiveComplexity"/>
  <rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveAsserts"/>
</ruleset>

Do you have any suggestions on what I might be missing? Thanks in advance for your help!

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供された custom-ruleset.xml と PMD エンジンを使ってスキャンを再現することから始め、ルールが参照されたときに 3 つの exclude-pattern エントリが適用されるかを確認します。fflib_ および TM プレフィックスを持つファイルが処理されず、列挙された Apex ルールが引き続き実行されれば完了です。

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

評価

領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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