Open vt89 opened 8 months ago
This might be related to an issue with the sfdx scanner cli plugin - see this issue for more details - but I will take a look after work.
@mitchspano Could it happen because the Salesforce Code Analyzer does not consider files having .object
extension?
I tried with a different Custom PMD Rule checking if a new custom field is added and the result is the same: no comment added.
The Custom PMD Rule used for this test is:
<!-- CUSTOM OBJECTS / FIELDS RULES -->
<rule name="NewCustomFieldCreated" language="xml"
message="The new Custom Field creation has to be approved"
class="net.sourceforge.pmd.lang.rule.XPathRule">
<priority>2</priority>
<properties>
<property name="version" value="2.0" />
<property name="xpath">
<value><![CDATA[
boolean(//CustomObject/fields/fullName/text())
]]></value>
</property>
</properties>
</rule>
And the Pull Request contains the following added change for the Account.object
:
<fields>
<fullName>Test_VT_No_Description__c</fullName>
<defaultValue>false</defaultValue>
<externalId>false</externalId>
<label>Test VT No Description</label>
<trackFeedHistory>false</trackFeedHistory>
<trackHistory>false</trackHistory>
<type>Checkbox</type>
</fields>
I found [Feature Request]Allow for scanning of salesforce metadata where this topic was discussed.
I am using multiple PMD rulesets within the scan:
pmd ├── pmd-ruleset.xml ├── custom-pmd-ruleset.xml
The
pmd-ruleset.xml
is:The
custom-pmd-ruleset.xml
contains two rules:I have created a Pull Request containing:
description
tag:I am using the following step on the GitHub Action executed on the Pull Request:
A comment is added for the XML related to the Apex Class since the API version is < 60 but no comment is added for the Custom Field even if it does not have the description field.