From 26b8a0ffe16481c6f1bde2dcfaa87df41186b4c5 Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 28 Feb 2024 11:43:29 +0100 Subject: [PATCH 1/3] Update calls to sfdx-scanner to output a CSV file for Aura & LWC --- CHANGELOG.md | 1 + megalinter/descriptors/salesforce.megalinter-descriptor.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63f8177beab..e8c30ee2bea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Fixes - Trivy: use `misconfig` instead of the deprecated `config` scanner, updating the default arguments + - Update calls to sfdx-scanner to output a CSV file for Aura & LWC - Doc - Removed obsolete warning for semgrep as the issue has been fixed diff --git a/megalinter/descriptors/salesforce.megalinter-descriptor.yml b/megalinter/descriptors/salesforce.megalinter-descriptor.yml index 3271ba20591..e3b2492da2c 100644 --- a/megalinter/descriptors/salesforce.megalinter-descriptor.yml +++ b/megalinter/descriptors/salesforce.megalinter-descriptor.yml @@ -121,6 +121,8 @@ linters: - "**/aura/**/*.js" - "--severity-threshold" - "2" + - "--outfile" + - "{{REPORT_FOLDER}}/sfdx-scanner-report-aura.csv" - "--format" - "csv" cli_lint_mode: project @@ -179,6 +181,8 @@ linters: - "**/lwc/**/*.js" - "--severity-threshold" - "2" + - "--outfile" + - "{{REPORT_FOLDER}}/sfdx-scanner-report-lwc.csv" - "--format" - "csv" cli_lint_mode: project From e16200d140c101ffbeb15066f1b20f3c59ae2a7c Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 28 Feb 2024 12:07:44 +0100 Subject: [PATCH 2/3] Fix SF config files --- .../bad/force-app/main/default/aura/.eslintrc.json | 0 .../good/force-app/main/default/aura/.eslintrc.json | 0 .github/linters/.eslintrc-lwc.json | 11 ----------- TEMPLATES/.eslintrc-lwc.json | 11 ----------- 4 files changed, 22 deletions(-) rename .github/linters/.eslintrc-aura.json => .automation/test/salesforce/bad/force-app/main/default/aura/.eslintrc.json (100%) rename TEMPLATES/.eslintrc-aura.json => .automation/test/salesforce/good/force-app/main/default/aura/.eslintrc.json (100%) delete mode 100644 .github/linters/.eslintrc-lwc.json delete mode 100644 TEMPLATES/.eslintrc-lwc.json diff --git a/.github/linters/.eslintrc-aura.json b/.automation/test/salesforce/bad/force-app/main/default/aura/.eslintrc.json similarity index 100% rename from .github/linters/.eslintrc-aura.json rename to .automation/test/salesforce/bad/force-app/main/default/aura/.eslintrc.json diff --git a/TEMPLATES/.eslintrc-aura.json b/.automation/test/salesforce/good/force-app/main/default/aura/.eslintrc.json similarity index 100% rename from TEMPLATES/.eslintrc-aura.json rename to .automation/test/salesforce/good/force-app/main/default/aura/.eslintrc.json diff --git a/.github/linters/.eslintrc-lwc.json b/.github/linters/.eslintrc-lwc.json deleted file mode 100644 index 49ca97d4beb..00000000000 --- a/.github/linters/.eslintrc-lwc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": ["@salesforce/eslint-config-lwc/recommended"], - "overrides": [ - { - "files": ["*.test.js"], - "rules": { - "@lwc/lwc/no-unexpected-wire-adapter-usages": "off" - } - } - ] -} diff --git a/TEMPLATES/.eslintrc-lwc.json b/TEMPLATES/.eslintrc-lwc.json deleted file mode 100644 index 49ca97d4beb..00000000000 --- a/TEMPLATES/.eslintrc-lwc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": ["@salesforce/eslint-config-lwc/recommended"], - "overrides": [ - { - "files": ["*.test.js"], - "rules": { - "@lwc/lwc/no-unexpected-wire-adapter-usages": "off" - } - } - ] -} From 42653b2ef1f0d644999482b12a44cc6f6cfda4ec Mon Sep 17 00:00:00 2001 From: nvuillam Date: Wed, 28 Feb 2024 13:40:50 +0100 Subject: [PATCH 3/3] Fix regexes to count Aura / LWC violations --- .../descriptors/salesforce.megalinter-descriptor.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/megalinter/descriptors/salesforce.megalinter-descriptor.yml b/megalinter/descriptors/salesforce.megalinter-descriptor.yml index e3b2492da2c..48c66456054 100644 --- a/megalinter/descriptors/salesforce.megalinter-descriptor.yml +++ b/megalinter/descriptors/salesforce.megalinter-descriptor.yml @@ -134,8 +134,8 @@ linters: - "plugins" cli_version_arg_name: "" version_extract_regex: "(?<=@salesforce/sfdx-scanner )\\d+(\\.\\d+)+" - cli_lint_errors_count: regex_count - cli_lint_errors_regex: '"[0-9]+",' + cli_lint_errors_count: regex_sum + cli_lint_errors_regex: "found ([0-9]+) violation" examples: - "sfdx scanner:run" install: @@ -194,8 +194,8 @@ linters: - "plugins" cli_version_arg_name: "" version_extract_regex: "(?<=@salesforce/sfdx-scanner )\\d+(\\.\\d+)+" - cli_lint_errors_count: regex_count - cli_lint_errors_regex: '"[0-9]+",' + cli_lint_errors_count: regex_sum + cli_lint_errors_regex: "found ([0-9]+) violation" examples: - "sfdx scanner:run" install: