Skip to content

Commit

Permalink
Merge pull request #23 from fabioschiozer/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
fschiozerSFDC authored May 22, 2024
2 parents a65d563 + 2f58429 commit e9eb5c6
Show file tree
Hide file tree
Showing 13 changed files with 1,315 additions and 265 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/codeAnalyzerOnPR.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Salesforce Code Analyzer on PR

name: Salesforce Code Analyzer - on pull request

on:
pull_request:
Expand All @@ -8,7 +9,6 @@ on:
jobs:
salesforce-code-analyzer-workflow:
runs-on: ubuntu-latest

steps:
- name: Check out files
uses: actions/checkout@v4
Expand All @@ -19,17 +19,21 @@ 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: 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 ${{ 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
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";


export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReactConfig,
];
6 changes: 2 additions & 4 deletions force-app/main/default/classes/DummyClass.cls
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
public with sharing class DummyClass {

public DummyClass() {

}

public static String getStatic(){
String a = 'DOIS RETORNOS';

String a = 'Analiza o código';

return a;
}
Expand Down
35 changes: 35 additions & 0 deletions force-app/main/default/classes/DummyClassTest.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* This class contains unit tests for validating the behavior of Apex classes
* and triggers.
*
* Unit tests are class methods that verify whether a particular piece
* of code is working properly. Unit test methods take no arguments,
* commit no data to the database, and are flagged with the testMethod
* keyword in the method definition.
*
* All test methods in an org are executed whenever Apex code is deployed
* to a production org to confirm correctness, ensure code
* coverage, and prevent regressions. All Apex classes are
* required to have at least 75% code coverage in order to be deployed
* to a production org. In addition, all triggers must have some code coverage.
*
* The @isTest class annotation indicates this class only contains test
* methods. Classes defined with the @isTest annotation do not count against
* the org size limit for all Apex scripts.
*
* See the Apex Language Reference for more information about Testing and Code Coverage.
*/
@isTest
private class DummyClassTest {

@isTest
static void myUnitTest() {
// TO DO: implement unit test

String a = DummyClass.getStatic();

System.Assert(a == 'Analiza o código', 'Test failed !!!');


}
}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/DummyClassTest.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<actionOverrides>
<actionName>Accept</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Accept</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Accept</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>CancelEdit</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>CancelEdit</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>CancelEdit</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Clone</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Clone</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Clone</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Delete</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Delete</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Delete</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Edit</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Edit</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Edit</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>List</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>List</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>List</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>New</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>New</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>New</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>SaveEdit</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>SaveEdit</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>SaveEdit</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Tab</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Tab</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>Tab</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>View</actionName>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>View</actionName>
<formFactor>Large</formFactor>
<type>Default</type>
</actionOverrides>
<actionOverrides>
<actionName>View</actionName>
<formFactor>Small</formFactor>
<type>Default</type>
</actionOverrides>
<allowInChatterGroups>false</allowInChatterGroups>
<compactLayoutAssignment>SYSTEM</compactLayoutAssignment>
<deploymentStatus>Deployed</deploymentStatus>
<enableActivities>false</enableActivities>
<enableBulkApi>true</enableBulkApi>
<enableFeeds>false</enableFeeds>
<enableHistory>true</enableHistory>
<enableLicensing>false</enableLicensing>
<enableReports>true</enableReports>
<enableSearch>true</enableSearch>
<enableSharing>true</enableSharing>
<enableStreamingApi>true</enableStreamingApi>
<externalSharingModel>Private</externalSharingModel>
<label>Eu vou ser deletado</label>
<nameField>
<label>Eu vou ser deletado Name</label>
<trackHistory>false</trackHistory>
<type>Text</type>
</nameField>
<pluralLabel>Nós vamos ser deletados</pluralLabel>
<searchLayouts></searchLayouts>
<sharingModel>ReadWrite</sharingModel>
<visibility>Public</visibility>
</CustomObject>
4 changes: 4 additions & 0 deletions log.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
7526ada,Fabio de Agostini Schiozer,2 hours ago,Update codeAnalyzerOnPR.yml
d969a34,Fabio de Agostini Schiozer,3 hours ago,Update codeAnalyzerOnPR.yml
849a41b,Fabio de Agostini Schiozer,3 hours ago,Update DummyClass.cls
0733066,Fabio de Agostini Schiozer,3 hours ago,Create codeAnalyzerOnPR.yml
4 changes: 2 additions & 2 deletions manifest/buildfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"type": "metadata",
"manifestFile": "manifest/package.xml",
"testLevel": "RunLocalTests",
"testLevel": "RunSpecifiedTests",
"classPath": "force-app/main/default/classes",
"timeout": "33",
"ignoreWarnings": true
Expand All @@ -17,4 +17,4 @@
"command": "sf --version"
}
]
}
}
7 changes: 6 additions & 1 deletion manifest/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>DummyClass</members>
<members>DummyClassTest</members>
<name>ApexClass</name>
</types>
<version>58.0</version>
<types>
<members>Eu_vou_ser_deletado__c</members>
<name>CustomObject</name>
</types>
<version>60.0</version>
</Package>
7 changes: 7 additions & 0 deletions manifest/postDestructive/destructiveChanges.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Eu_vou_ser_deletado__c</members>
<name>CustomObject</name>
</types>
</Package>
4 changes: 4 additions & 0 deletions manifest/postDestructive/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>60.0</version>
</Package>
Loading

0 comments on commit e9eb5c6

Please sign in to comment.