GithubHelp home page GithubHelp logo

ecc's Introduction

Easy Clean Code (ECC)

tdx

TLDR; CLI setup

  • Fork this
  • run npm install
  • run prettier --write "sfdx-source/ecc/main/default/**/*.{trigger,cls}"
  • download a PMD release build and copy it into /build/pmd
  • run sh build/pmd/bin/run.sh pmd -d sfdx-source/ecc/main/default -R apex-ruleset.xml -f csv >> static-code-analysis.csv

Use Code Templates

  • copy-paste a standard logicless Trigger
  • copy-paste a standard TriggerHandler

Use a Code Framework

  • Common methods
  • Utils class
  • TestDataFactory with standard Objects
  • git submodule include in client projects

Standardize Formatting

GOAL: Consistent formatting in IDE, pre-commit and during Continuous Integration / Pull Request

Code Review with PMD

GOAL: Catch bad code design early and also clean as you go

In VS Code

CLI

  • Download from https://github.com/pmd/pmd/releases
  • place in /build/pmd
  • sh build/pmd/bin/run.sh pmd -d sfdx-source/ecc/main/default -R apex-ruleset.xml -f csv >> build/pmd-output.csv
  • Bonus: host your own stripped down copy and include it as a submodule, PMD is big

CI

  • in .gitlab-ci.yml
    • creates a csv or xml artifact on gitlab you can download
  • Bonus: Use Codacy to block PRs only when the Diff is worse / new issues were created

Automate Apex Tests with Circle CI

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ci_circle_config_env.htm https://github.com/forcedotcom/sfdx-circleci

  • add server.key.enc to /assets

Automate Apex Tests with Gitlab

https://gitlab.com/sfdx

Automate PMD, ESLint, etc. with Codacy

  • It will honor/use the apex-ruleset.xml file if you have one for PMD
  • It will honor/usea ESLint and other config files as well

Jest for LWC

https://github.com/salesforce/lwc-jest

Thanks

There a ton of great people and resources out there that have helped me get this far.

ecc's People

Contributors

jimbtek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.