Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/publish-package-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ on:
type: boolean
required: false
default: false
code-analyzer-flowanalyzer-engine:
description: Should the code-analyzer-flowanalyzer-engine package be released?
type: boolean
required: false
default: false
dryrun:
description: Add --dry-run to npm publish step? (Uncheck to actually publish)
type: boolean
Expand Down Expand Up @@ -118,6 +123,9 @@ jobs:
if [ "${{ inputs.code-analyzer-uibundle-engine }}" == "true" ]; then
PACKAGES_TO_CHECK_ARR+=('code-analyzer-uibundle-engine')
fi
if [ "${{ inputs.code-analyzer-flowanalyzer-engine }}" == "true" ]; then
PACKAGES_TO_CHECK_ARR+=('code-analyzer-flowanalyzer-engine')
fi
PACKAGES_TO_CHECK_STR=$(IFS=' '; echo "${PACKAGES_TO_CHECK_ARR[*]}")
node ./.github/workflows/publish-package-to-npm/validate-packages-as-releasable.js "$PACKAGES_TO_CHECK_STR"
echo "packages_to_release=$PACKAGES_TO_CHECK_STR" >> "$GITHUB_OUTPUT"
Expand Down
266 changes: 263 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/code-analyzer-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@salesforce/code-analyzer-core",
"description": "Core Package for the Salesforce Code Analyzer",
"version": "0.53.0",
"version": "0.54.0-SNAPSHOT",
"author": "The Salesforce Code Analyzer Team",
"license": "BSD-3-Clause",
"homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview",
Expand Down
6 changes: 2 additions & 4 deletions packages/code-analyzer-core/src/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ export class UninstantiableEngineErrorViolation extends AbstractLocationlessViol

override getMessage(): string {
return getMessage('UninstantiableEngineErrorViolationMessage', this.engineName,
this.error.stack ? this.error.stack : // Prefer to get the whole stack when possible
/* istanbul ignore next */ this.error.message);
this.error.message);
}
}

Expand All @@ -351,8 +350,7 @@ export class UnexpectedEngineErrorViolation extends AbstractLocationlessViolatio

override getMessage(): string {
return getMessage('UnexpectedEngineErrorViolationMessage', this.engineName,
this.error.stack ? this.error.stack : // Prefer to get the whole stack when possible
/* istanbul ignore next */ this.error.message);
this.error.message);
}
}

Expand Down
5 changes: 3 additions & 2 deletions packages/code-analyzer-core/src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ export class RuleImpl implements Rule {
const tags: string[] = this.getTags().map(t => t.toLowerCase());
const isApexGuru: boolean = tags.includes('apex-guru');
const isDevPreviewUIBundle: boolean = tags.includes('uibundle');
const isFlowAnalyzer: boolean = tags.includes('flow-analyzer');
let selectables: string[];
if (isApexGuru || isDevPreviewUIBundle) {
// Opt-in rule families (ApexGuru, UIBundle) are only selectable by
if (isApexGuru || isDevPreviewUIBundle || isFlowAnalyzer) {
// Opt-in rule families (ApexGuru, UIBundle, Flow Analyzer) are only selectable by
// engine name, rule name, or explicit tag. 'all' and severity are intentionally
// excluded so broad selectors (e.g. 'all', '4', 'Low') don't pull them in.
selectables = [
Expand Down
39 changes: 39 additions & 0 deletions packages/code-analyzer-core/test/rule-selection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,45 @@ describe('Tests for selecting rules', () => {
});
});

describe('flow-analyzer rule selection behavior', () => {
beforeEach(async () => {
codeAnalyzer = createCodeAnalyzer();
await codeAnalyzer.addEnginePlugin(new stubs.FlowAnalyzerEnginePlugin());
});

it.each([
['the default Recommended selector', 'Recommended'],
['all', 'all'],
['severity number', '4'],
['severity name', 'Low'],
['severity number for High', '2'],
['severity name for High', 'High']
])('flow-analyzer rules are NOT selected by %s', async (_desc, selector) => {
const selection: RuleSelection = await codeAnalyzer.selectRules([selector]);
expect(ruleNamesFor(selection, 'flowAnalyzerEngine')).toEqual([]);
});

it('flow-analyzer rules ARE selected by engine name', async () => {
const selection: RuleSelection = await codeAnalyzer.selectRules(['flowAnalyzerEngine']);
expect(ruleNamesFor(selection, 'flowAnalyzerEngine')).toEqual(['flowAnalyzerRule1', 'flowAnalyzerRule2']);
});

it('flow-analyzer rules ARE selected by rule name', async () => {
const selection: RuleSelection = await codeAnalyzer.selectRules(['flowAnalyzerRule1']);
expect(ruleNamesFor(selection, 'flowAnalyzerEngine')).toEqual(['flowAnalyzerRule1']);
});

it('flow-analyzer rules ARE selected by the flow-analyzer tag', async () => {
const selection: RuleSelection = await codeAnalyzer.selectRules(['flow-analyzer']);
expect(ruleNamesFor(selection, 'flowAnalyzerEngine')).toEqual(['flowAnalyzerRule1', 'flowAnalyzerRule2']);
});

it('flow-analyzer rules ARE selected by other tag they carry', async () => {
const selection: RuleSelection = await codeAnalyzer.selectRules(['Performance']);
expect(ruleNamesFor(selection, 'flowAnalyzerEngine')).toEqual(['flowAnalyzerRule1']);
});
});

describe('UIBundle rule selection behavior', () => {
beforeEach(async () => {
codeAnalyzer = createCodeAnalyzer();
Expand Down
Loading
Loading