-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Have you verified this is Salesforce Code Analyzer specific?
Yes
Description
I am trying to run a scan with the PMD-Appexchange engine, on a metadata of type LightningMessageChannel where I know there is a violation of the rule: AvoidLmcIsExposedTrue.
Here is the sample file which has the violation:
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
<masterLabel>SampleMessageChannel</masterLabel>
<isExposed>true</isExposed>
<description>This is a sample Lightning Message Channel.</description>
</LightningMessageChannel>
This sample has been taken from the Sample given on the Metadata API Guide for LightningMessageChannel
The last version of Salesforce Code Analyzer where I am able to get the violation is version 3.26.0 of Salesforce Code Analyzer, I am unable to run it on any 4.x versions of Salesforce Code Analyzer.
Output / Logs
It says, no rule violations found.

Steps To Reproduce
- Install the latest v4.6.0 version of Salesforce Code Analyzer.
- Create a sample LightningMessageChannel component in your source directory

- Run
sf scanner run --engine pmd-appexchange --target ./
Expected Behavior
Get a violation from pmd-appexchange engine, like it used to throw with versions until 3.26 like following

Operating System
MacOS Ventura 13.5.2
Salesforce CLI Version
@salesforce/cli/2.62.6 darwin-arm64 node-v20.17.0
Code Analyzer Plugin (@salesforce/sfdx-scanner) Version
@salesforce/sfdx-scanner@4.6.0 (latest)
Additional Context (Screenshots, Files, etc)
- The Test you have in the repo for this rule, is running on .object file, this is incorrect, and this is likely why the tests didn't fail for this issue.
- When I create the same file unclean.object in my repo and then run it, I can see the violation now.

- The violation should be coming in for the LightningMessagingChannel file instead and NOT for the object file.

Workaround
Use the Salesforce Code Analyzer version 3.26

Urgency
Moderate