Skip to content

[False Result] Unable to invoke the rule "AvoidLmcIsExposedTrue" for a Lightning Message Channgel #1654

@abhisheksaxena7

Description

@abhisheksaxena7

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.
image

Steps To Reproduce

  1. Install the latest v4.6.0 version of Salesforce Code Analyzer.
  2. Create a sample LightningMessageChannel component in your source directory
    image
  3. 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
image

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)

  1. 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.
  2. When I create the same file unclean.object in my repo and then run it, I can see the violation now.
    image
  3. The violation should be coming in for the LightningMessagingChannel file instead and NOT for the object file.
    image

Workaround

Use the Salesforce Code Analyzer version 3.26
image

Urgency

Moderate

Metadata

Metadata

Assignees

No one assigned

    Labels

    PMD-AppExchangeIssues related to the pmd-appexchange engine rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions