From 849a41b8e4757b3cf31ceabc94401d511777ca3b Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 14:52:49 -0300 Subject: [PATCH 01/13] Update DummyClass.cls --- force-app/main/default/classes/DummyClass.cls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/classes/DummyClass.cls b/force-app/main/default/classes/DummyClass.cls index c4eb583..1cb5430 100644 --- a/force-app/main/default/classes/DummyClass.cls +++ b/force-app/main/default/classes/DummyClass.cls @@ -5,8 +5,8 @@ public with sharing class DummyClass { } public static String getStatic(){ - String a = 'RETORNO'; + String a = 'Analiza o código';; return a; } -} \ No newline at end of file +} From d969a34e36e2743c4c8ffde0e4252e1a5e9b8efa Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:00:56 -0300 Subject: [PATCH 02/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 48851ed..21cede7 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Check out files uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Install Salesforce CLI run: npm install -g @salesforce/cli@latest From 7526adade888832c204dddd5c4d5953d69e751aa Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:13:52 -0300 Subject: [PATCH 03/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 21cede7..fdf9032 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -12,8 +12,6 @@ jobs: steps: - name: Check out files uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - name: Install Salesforce CLI run: npm install -g @salesforce/cli@latest @@ -21,12 +19,24 @@ jobs: - name: Install Salesforce Code Analyzer Plugin run: sf plugins install @salesforce/sfdx-scanner@latest + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v44 + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: | + for file in ${ALL_CHANGED_FILES}; do + echo "$file was changed" + done + - name: Run Salesforce Code Analyzer id: run-code-analyzer uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target . --outfile results.html + run-arguments: --normalize-severity --target ${ALL_CHANGED_FILES} --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From 6510172b3c269c142349703d7f6dfd9ccc2e091b Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:40:05 -0300 Subject: [PATCH 04/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index fdf9032..1d7594f 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -27,6 +27,9 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | + echo 'Todos os arquivos:' + echo ${ALL_CHANGED_FILES} + for file in ${ALL_CHANGED_FILES}; do echo "$file was changed" done From d198ae1c01dbc58b2d5cbab4fde0fc2c90f1ae6b Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:42:08 -0300 Subject: [PATCH 05/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 1d7594f..e95854b 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -39,7 +39,7 @@ jobs: uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target ${ALL_CHANGED_FILES} --outfile results.html + run-arguments: --target ${ALL_CHANGED_FILES} --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From 6fc991d28a5b7f96ed9f8c46cd20997f5db3a903 Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:49:43 -0300 Subject: [PATCH 06/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index e95854b..fd89733 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -32,6 +32,7 @@ jobs: for file in ${ALL_CHANGED_FILES}; do echo "$file was changed" + cat $file done - name: Run Salesforce Code Analyzer From 14eafee25f692bcdb06eb74937e64ad3d4ee033e Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:52:28 -0300 Subject: [PATCH 07/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index fd89733..91a9f06 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -27,20 +27,14 @@ jobs: env: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | - echo 'Todos os arquivos:' - echo ${ALL_CHANGED_FILES} + sf scanner run --target ${ALL_CHANGED_FILES} - for file in ${ALL_CHANGED_FILES}; do - echo "$file was changed" - cat $file - done - - name: Run Salesforce Code Analyzer id: run-code-analyzer uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --target ${ALL_CHANGED_FILES} --outfile results.html + run-arguments: --normalize-severity --target ${ALL_CHANGED_FILES} --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From 59619f0fbe10a387c2a0f6034e8bedb8473ffd13 Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 15:55:22 -0300 Subject: [PATCH 08/13] Update DummyClass.cls --- force-app/main/default/classes/DummyClass.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/main/default/classes/DummyClass.cls b/force-app/main/default/classes/DummyClass.cls index 1cb5430..d33a689 100644 --- a/force-app/main/default/classes/DummyClass.cls +++ b/force-app/main/default/classes/DummyClass.cls @@ -5,7 +5,7 @@ public with sharing class DummyClass { } public static String getStatic(){ - String a = 'Analiza o código';; + String a = 'Analiza o código'; return a; } From 5de96db5856da4f1191bae0d2161f10152cac7f9 Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 16:00:21 -0300 Subject: [PATCH 09/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 91a9f06..317726a 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -34,7 +34,7 @@ jobs: uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target ${ALL_CHANGED_FILES} --outfile results.html + run-arguments: --normalize-severity --target force-app/main/default/classes/DummyClass.cls --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From b7e33836b23ba7c804d767e1f9087ae579f5d46d Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 16:06:24 -0300 Subject: [PATCH 10/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 317726a..82264ef 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -34,12 +34,12 @@ jobs: uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target force-app/main/default/classes/DummyClass.cls --outfile results.html + run-arguments: --normalize-severity --target steps.changed-files.outputs.all_changed_files --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail if: | steps.run-code-analyzer.outputs.exit-code > 0 || steps.run-code-analyzer.outputs.num-sev1-violations > 0 || - steps.run-code-analyzer.outputs.num-violations > 10 + steps.run-code-analyzer.outputs.num-violations > 0 run: exit 1 From fa28c3ac62d74ced7e66f07927f553817f3a20a1 Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 16:12:46 -0300 Subject: [PATCH 11/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 82264ef..8e2387a 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -28,13 +28,17 @@ jobs: ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | sf scanner run --target ${ALL_CHANGED_FILES} + + - name: Check files + run: | + echo "${ALL_CHANGED_FILES}" - name: Run Salesforce Code Analyzer id: run-code-analyzer uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target steps.changed-files.outputs.all_changed_files --outfile results.html + run-arguments: --normalize-severity --target ${{env.ALL_CHANGED_FILES}} --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From 72f220988d51eb885d21a049c91ceeb572d5b2cc Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 16:16:11 -0300 Subject: [PATCH 12/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 8e2387a..657af3e 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -38,7 +38,7 @@ jobs: uses: forcedotcom/run-code-analyzer@v1 with: run-command: run - run-arguments: --normalize-severity --target ${{env.ALL_CHANGED_FILES}} --outfile results.html + run-arguments: --normalize-severity --target ${{ steps.changed-files.outputs.all_changed_files }} --outfile results.html results-artifact-name: salesforce-code-analyzer-results - name: Check the outputs to determine whether to fail From ce34d059ec0029ae60ce8f9e604407c996913206 Mon Sep 17 00:00:00 2001 From: Fabio de Agostini Schiozer <66429123+fabioschiozer@users.noreply.github.com> Date: Thu, 16 May 2024 16:21:01 -0300 Subject: [PATCH 13/13] Update codeAnalyzerOnPR.yml --- .github/workflows/codeAnalyzerOnPR.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/codeAnalyzerOnPR.yml b/.github/workflows/codeAnalyzerOnPR.yml index 657af3e..6f1ddac 100644 --- a/.github/workflows/codeAnalyzerOnPR.yml +++ b/.github/workflows/codeAnalyzerOnPR.yml @@ -22,16 +22,6 @@ jobs: - name: Get changed files id: changed-files uses: tj-actions/changed-files@v44 - - - name: List all changed files - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - sf scanner run --target ${ALL_CHANGED_FILES} - - - name: Check files - run: | - echo "${ALL_CHANGED_FILES}" - name: Run Salesforce Code Analyzer id: run-code-analyzer