Nitpicking over Code Standards with Nitpick CI
There are many ways to make sure your code respects a given code standard – we’ve covered several before. But enforcing a standard team-wide and making sure everyone knows about mistakes before they’re applied to the project isn’t something that’s very easy to do. Travis and Jenkins can both be configured to do these checks, but aren’t as easygoing about it as the solution we’re about to look at: Nitpick CI.
Nitpick CI is a dead simple single-click tool for making sure submitted Github pull requests adhere to the PSR-2 standard. Unfortunately, Nitpick currently only works with these two specific (but popular) vectors – only Github, and only PSR-2. It’s free for open source projects, so let’s give it a try.
To test Nitpick, we’ll create a brand new repository based on thephpleague/skeleton and pretend we’re building a new PHP package. The skeleton already respects PSR-2, so it’s a perfect candidate for an invalid PR. Feel free to follow along!
git clone https://github.com/thephpleague/skeleton nitpick-test cd nitpick-test find . -type f -print0 | xargs -0 sed -i 's/:author_name/Bruno Skvorc/g' find . -type f -print0 | xargs -0 sed -i 's/:author_usernamename/swader/g' find . -type f -print0 | xargs -0 sed -i 's/:author_website/http://bitfalls.com/g' find . -type f -print0 | xargs -0 sed -i 's/:author_email/[email protected]/g' find . -type f -print0 | xargs -0 sed -i 's/:vendor/sitepoint/g' find . -type f -print0 | xargs -0 sed -i 's/:package_name/nitpick-test/g' find . -type f -print0 | xargs -0 sed -i 's/:package_description/nitpick-test package for a SitePoint tutorial/g' rm CONDUCT.md rm -rf .git
The above commands clone the skeleton, replace placeholder values with real values, and delete some files we don’t need. The project is now ready to be committed and pushed online (as long as you created a repo on Github).
Continue reading %Nitpicking over Code Standards with Nitpick CI%