Skip to content

Commit

Permalink
Formatting fixes (#11)
Browse files Browse the repository at this point in the history
Updated ApexDox - css
Reworked Prettier as it interacts with ApexDox - multiple config files means more granular formatting
Updated a lot of comments
Added one method to the handler - returns a Set of bypassed handler names
  • Loading branch information
dschach committed Mar 25, 2022
1 parent 8c082c0 commit ac5257c
Show file tree
Hide file tree
Showing 38 changed files with 5,543 additions and 3,741 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
- name: "Wait for Apex parser server startup"
run: timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' 127.0.0.1 2117

# Prettier formatting
# Prettier Apex formatting
- name: "Code formatting EXECUTION with Prettier"
run: npm run prettier:apex:local

# Prettier format check
- name: "Code formatting verification with Prettier"
run: npm run prettier:verify

# Stop local Apex parser server for Prettier
- name: "Stop local Apex parser server for Prettier"
if: always()
Expand Down
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run precommit
npm run precommit
npm run prettier:docs
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

**/staticresources/**
node_modules
.localdevserver
.sfdx
.vscode
Expand All @@ -11,7 +12,6 @@ coverage/

# ApexDox website
docs/assets/*.js
!docs/*
doc-assets/highlight.js

# markdown
Expand Down
6 changes: 5 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"printWidth": 180,
"bracketSameLine": true,
"bracketSpacing": true,
"tabWidth": 2,
"apexInsertFinalNewline": false,
"htmlWhitespaceSensitivity": "ignore",
"overrides": [
{
"files": "**/lwc/**/*.html",
Expand All @@ -14,6 +14,10 @@
{
"files": "*.{cmp,page,component}",
"options": { "parser": "html" }
},
{
"files": "*.html",
"options": { "useTabs": false, "tabWidth": 2 }
}
]
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ trigger OpportunityTrigger on Opportunity (before update, after update) {
new OpportunityTriggerHandler().run();
}
```
There is also a faster way to write the trigger, specifying the handler class name so the handler does not need to describe the class for its name, saving precious execution time:
```apex
trigger OpportunityTrigger on Opportunity (before update, after update) {
new OpportunityTriggerHandler('OpportunityTriggerHandler').run();
}
```

## Cool Stuff

Expand Down
8 changes: 2 additions & 6 deletions apexdox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ engine:
sourceUrl: https://github.com/dschach/salesforce-trigger-framework/tree/main/force-app/main/default/classes
- path: "${workspaceFolder}/sample-handler/main/default/classes"
sourceUrl: https://github.com/dschach/salesforce-trigger-framework/tree/main/sample-handler/main/default/classes
# - path: "${workspaceFolder}/force-app/main/default/tests"
# sourceUrl: https://github.com/dschach/salesforce-trigger-framework/tree/main/force-app/main/default/tests
targetDirectory: "${workspaceFolder}/docs"
#excludes:
# - "*Test.cls"
title: Salesforce Trigger Handler code documentation
subtitle: Documentation for <a target="_blank" rel="noopener noreferrer" href="https://github.com/dschach/salesforce-trigger-framework">Trigger Framework</a>
sortOrder: alpha
cleanDir: false
cleanDir: false # keep prettier config file
showTOCSnippets: true
scope:
- global
- public
- protected
- private
- webService
- protected
- testMethod
homePagePath: "${workspaceFolder}/doc-assets/homePage.html"
#pages:
Expand Down
22 changes: 11 additions & 11 deletions config/project-scratch-def.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"orgName": "dschach company",
"edition": "Developer",
"features": ["EnableSetPasswordInApi"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
}
}
"orgName": "dschach company",
"edition": "Developer",
"features": ["EnableSetPasswordInApi"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
}
}
}
3 changes: 3 additions & 0 deletions doc-assets/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bracketSameLine": true
}
30 changes: 15 additions & 15 deletions doc-assets/highlight.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
display: block;
overflow-x: auto;
padding: 1em;
}
code.hljs {
padding: 3px 5px;
padding: 3px 5px;
}
.hljs {
background: #fff;
color: #000;
background: #fff;
color: #000;
}
.hljs-comment,
.hljs-quote,
.hljs-variable {
color: green;
color: green;
}
.hljs-built_in,
.hljs-keyword,
.hljs-name,
.hljs-selector-tag,
.hljs-tag {
color: #00f;
color: #00f;
}
.hljs-addition,
.hljs-attribute,
Expand All @@ -31,28 +31,28 @@ code.hljs {
.hljs-template-variable,
.hljs-title,
.hljs-type {
color: #a31515;
color: #a31515;
}
.hljs-deletion,
.hljs-meta,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #2b91af;
color: #2b91af;
}
.hljs-doctag {
color: grey;
color: grey;
}
.hljs-attr {
color: red;
color: red;
}
.hljs-bullet,
.hljs-link,
.hljs-symbol {
color: #00b0e8;
color: #00b0e8;
}
.hljs-emphasis {
font-style: italic;
font-style: italic;
}
.hljs-strong {
font-weight: 700;
font-weight: 700;
}
58 changes: 58 additions & 0 deletions doc-assets/highlight_old.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
}
code.hljs {
padding: 3px 5px;
}
.hljs {
background: #fff;
color: #000;
}
.hljs-comment,
.hljs-quote,
.hljs-variable {
color: green;
}
.hljs-built_in,
.hljs-keyword,
.hljs-name,
.hljs-selector-tag,
.hljs-tag {
color: #00f;
}
.hljs-addition,
.hljs-attribute,
.hljs-literal,
.hljs-section,
.hljs-string,
.hljs-template-tag,
.hljs-template-variable,
.hljs-title,
.hljs-type {
color: #a31515;
}
.hljs-deletion,
.hljs-meta,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #2b91af;
}
.hljs-doctag {
color: grey;
}
.hljs-attr {
color: red;
}
.hljs-bullet,
.hljs-link,
.hljs-symbol {
color: #00b0e8;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: 700;
}

0 comments on commit ac5257c

Please sign in to comment.