Skip to content

MervmessInc/SFDX-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b2bb0d3 · May 3, 2024
May 3, 2024
May 3, 2024
Mar 23, 2023
Mar 2, 2021
May 3, 2024
Feb 24, 2021
Oct 19, 2023
Dec 10, 2020
Dec 16, 2020
May 3, 2024
Dec 10, 2020
Dec 14, 2020
Jul 19, 2022
Nov 3, 2023
Mar 23, 2023
Oct 19, 2023
Oct 19, 2023
Oct 19, 2023
Feb 16, 2021
Mar 23, 2023
Mar 2, 2021

Repository files navigation

Example Salesforce DX Project using GitHub Actions.

Example Salesfoce CI using GitHub actions.

  • Static code scan
  • Build scratch org
  • Run unit tests

Intentionally failing workflow

The lighting app in this repo has been specififcally written to highlight the workflow's behaviour. Not implementing Salesforce best practices ultimatly leads to a failed unit test.

=== Apex Code Coverage for Test Run 7073G00000sJ2H1
TEST NAME                            CLASS BEING TESTED  OUTCOME  PERCENT  MESSAGE                                                       RUNTIME (MS)
───────────────────────────────────  ──────────────────  ───────  ───────  ────────────────────────────────────────────────────────────  ────────────
AncestryHelperTest.testGetAncestors  AncestryHelper      Fail     89%      System.LimitException: Too many SOQL queries: 101             
                                                                           Class.AncestryHelper.getAncestors: line 22, column 1          
                                                                           Class.AncestryHelperTest.testGetAncestors: line 23, column 1  594 

Looking at the action log we can see that the potential for this failure is highlighted by the static code scanner.

 LOCATION                                              DESCRIPTION                                           CATEGORY      U R L                                                                                      
 ───────────────────────────────────────────────────── ───────────────────────────────────────────────────── ───────────── ────────────────────────────────────────────────────────────────────────────────────────── 
 force-app/main/default/classes/AncestryHelper.cls:12    Missing ApexDoc comment                             Documentation https://pmd.github.io/pmd-6.55.0/pmd_rules_apex_documentation.html#apexdoc                 
 force-app/main/default/classes/AncestryHelper.cls:14    Validate CRUD permission before SOQL/DML operation  Security      https://pmd.github.io/pmd-6.55.0/pmd_rules_apex_security.html#apexcrudviolation            
                                                         or enforce user mode                                                                                                                                         
 force-app/main/default/classes/AncestryHelper.cls:22    Avoid Soql queries inside loops                     Performance   https://pmd.github.io/pmd-6.55.0/pmd_rules_apex_performance.html#avoidsoqlinloops

The "Avoid Soql queries inside loops" message references the same line as the failed unit test. (force-app/main/default/classes/AncestryHelper.cls:22)

Salesforce CLI documentation