Skip to content

Commit

Permalink
Merge pull request #26 from SalesforceFoundation/feature/pre-commit
Browse files Browse the repository at this point in the history
[W-8840996] Outbound Funds NPSP: Add automated checks + dev tools
  • Loading branch information
gaganpsandhu authored Feb 8, 2021
2 parents b2accf5 + d6d05c5 commit 12ad5a6
Show file tree
Hide file tree
Showing 62 changed files with 11,077 additions and 2,049 deletions.
120 changes: 120 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
// See https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell#cspelljson-sections
// for more information.
// Always 0.1
"version": "0.1",
"language": "en-US",
"enableFiletypes": ["apex", "javascript", "html", "SQL", "python"],
"allowCompoundWords": true,
// List of words to be considered correct.
"words": [
// SFDO
"cumulusci",
"outfunds",
"outfundsnpspext",
"sfdobase",
"unpackaged",
"unmanaged",
// SFDC
"instanceof",
"canvasapp",
"flexi",
"flexipage",
"flexipages",
"appendable",
"prependable",
"sobject",
"sobjects",
"permset",
"sforce",
"ISBLANK",
"ISPICKVAL",
"upsert",
"outputdir",
"sfsites",
"valueOf",
"stubbable",
"ISNULL",
"noopener",
"noreferrer",
"reparentable",
// LWC
"onrowselection",
"onrowaction",
"onsearch",
"recordid",
"onremove",
"onupdate",
"ondelete",
// Python
"pylint",
"pytest",
"toprettyxml",
"VARCHAR",
"esprima",
"Punctuator",
"isupper",
"nargs",
"tostring",
"testdoc",
"mkdtemp",
"noyaml",
// HTML
"arial",
"onslotchange",
"iframe",
// Robot tests
"kwtable",
"kwrow",
"kwname",
"kwdoc",
"XHTTP",
"CUSTENT",
// Storytelling data
"Englewood",
"Takagawa",
"Atterberry",
"Meiko",
"Kumar",
// Local
"Behrens",
"Expendatures"
],
// List of words to be always considered incorrect.
"flagWords": [],
// List of words to be ignored (even if they are in the flagWords).
"ignoreWords": [],
// List of globs to specify which files are to be ignored.
"ignorePaths": [
"node_modules/**",
"robot/**/results/**",
"venv/**",
".github/**",
".cci/**",
"./pytest_cache",
".sfdx/**",
".vscode/**",
"force-app/main/default/objectTranslations/**",
"force-app/main/default/translations/**",
"coverage/**"
],
// defaults to 4 - the minimum length of a word before it is checked.
"minWordLength": 5,
"languageSettings": [
{
// Add HTML dictionary to python since robot tests contain HTML.
"languageId": "python",
"local": "*",
"ignoreRegExpList": [],
"dictionaries": ["html"],
"dictionaryDefinitions": []
}
],
"ignoreRegExpList": [
// customThemeLayoutType has randomish IDs
"<customThemeLayoutType>[\\S\\s]+?</customThemeLayoutType>",
// Salesforce IDs: trying to be as restrive as possible in regex pattern
// See: https://help.salesforce.com/articleView?id=000325244&language=&type=1&mode=1
"\\b[0-9aemzkXC][A-Za-z0-9]{14,17}\\b"
]
}
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!**/
!**/lwc/**/*.js
node_modules
.cci
venv
31 changes: 31 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
env:
browser: true
es6: true
extends:
- eslint:recommended
- prettier
- plugin:prettier/recommended
- "@salesforce/eslint-config-lwc/recommended"
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018
sourceType: module
parser: babel-eslint
plugins:
- prettier
- "@lwc/eslint-plugin-lwc"
rules:
"prettier/prettier": error
"@lwc/lwc/no-deprecated": error
"@lwc/lwc/valid-api": error
"@lwc/lwc/valid-track": error
"@lwc/lwc/valid-wire": error
"@lwc/lwc/no-document-query": error
"@lwc/lwc/consistent-component-name": error
"@lwc/lwc/no-leading-uppercase-api-name": error
"@lwc/lwc/no-dupe-class-members": error
"@lwc/lwc/no-inner-html": error
"@lwc/lwc/no-async-operation": error
"no-unused-vars": warn
11 changes: 11 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Black-compatible flake8 config

[flake8]
ignore = E203, E266, E402, E501, W503, C901
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude =
node_modules,
venv,
.cci
9 changes: 8 additions & 1 deletion .forceignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
**/jsconfig.json
# LWC Jest tests
**/__mocks__/**
**/__tests__/**

# eslint config for Lightning Web Components
**/jsconfig.json
**/.eslintrc.json

# All markdown files. This means you can add READMEs to class and component directories.
**/*.md
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
# CumulusCI
/cumulusci.yml @SalesforceFoundation/release-engineering-reviewers
/tasks/ @SalesforceFoundation/release-engineering-reviewers

# GitHub Actions
.github/workflows/** @SalesforceFoundation/release-engineering-reviewers
package.json @SalesforceFoundation/release-engineering-reviewers
24 changes: 24 additions & 0 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Spell Checking
on: [push]
jobs:
cspell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Determine Node Version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Packages
run: |
yarn install
- name: cspell
run: |
npx cspell "**/*.{cls,apex,trigger,js,html,md,xml,sql,py,yml,yaml}"
24 changes: 24 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Linting
on: [push]
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Determine Node Version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Packages
run: |
yarn install
- name: eslint
run: |
npx eslint "**/*.js"
24 changes: 24 additions & 0 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Jest
on: [push]
jobs:
jest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Determine Node Version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Packages
run: |
yarn install
- name: Run Jest Tests
run: |
npx lwc-jest
25 changes: 25 additions & 0 deletions .github/workflows/label_audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Label Audit
on: [push]
jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Determine Python Version
id: python-version
run: |
echo "::set-output name=ver::$(python --version)"
- uses: actions/cache@v2
with:
path: venv
key: ${{ runner.os }}-${{ steps.python-version.outputs.ver }}-${{ hashFiles('requirements.txt') }}
- name: Install Packages
run: |
python3 -m venv venv
venv/bin/pip install -r requirements.txt
- name: Label Audit
run: |
venv/bin/python scripts/label_audit.py
24 changes: 24 additions & 0 deletions .github/workflows/lockfile-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lockfile
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Determine Node Version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Packages
run: |
yarn install
- name: lockfile-lint
run: |
npx lockfile-lint
24 changes: 24 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Formatting
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Determine Node Version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-${{ hashFiles('package.json', 'yarn.lock') }}
- name: Install Packages
run: |
yarn install
- name: prettier
run: |
npx prettier "**/*.{cls,apex,js,html,md,yml,yaml,json}" --check
25 changes: 25 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python
on: [push]
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Determine Python Version
id: python-version
run: |
echo "::set-output name=ver::$(python --version)"
- uses: actions/cache@v2
with:
path: venv
key: ${{ runner.os }}-${{ steps.python-version.outputs.ver }}-${{ hashFiles('requirements.txt') }}
- name: Install Packages
run: |
python3 -m venv venv
venv/bin/pip install -r requirements.txt
- name: Pytest
run: |
venv/bin/pytest
Loading

0 comments on commit 12ad5a6

Please sign in to comment.