Automating your way to a higher standard

Peter Breuls
Mar 22, 2018 · 7 min read
Image for post
Image for post

Local automation: make sure you never check in ‘bad code’

We have two kinds of software projects: applications that are mainly PHP, and ones that are built in Javascript. We do have combinations of the two, but for this article, we’re pretending it’s either-or.

"scripts": {
...
"precommit": "yarn lint && yarn test --coverage",
"commitmsg": "node scripts/validateCommitMessage.js",
"lint": "stylelint 'src/**/*.css' ; eslint --ext=js --ext=jsx src",
...
}
{
"parser": "babel-eslint",
"extends": "airbnb",
...
}
"jest": {
"coverageThreshold": {
"global": {
"statements": 80,
"branches": 80,
"functions": 80,
"lines": 80
}
},
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
]
},

CI automation: fire and forget

When the commit is approved, we know that we’ve written code that does not break any tests, adheres to coding standards and has a (mostly) useful commit message. After a series of commits, it’s time to push the branch to the Git server and that’s where some more magic happens.

Image for post
Image for post

SIM Developers Blog

Behind the scenes at SIM

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store