Created
November 21, 2014 05:39
-
-
Save hackling/5cf712a3f56ae6cf73fc to your computer and use it in GitHub Desktop.
Linters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Automated Styleguide Enforcement | |
Why bother having a styleguide? | |
- It gives your code a uniform look and feel | |
- Makes it easier to read | |
Why you should automate this? | |
- Ensures crappy looking code never hits production | |
- Reduces review time overall | |
Linters | |
- a name commonly given to programs that check over your code and flag questionable aspects | |
- Example Output: | |
- put rubocop example | |
Rubocop | |
- the Ruby linter | |
- configurable and customizable (Cops) | |
- Examples of Cops | |
- violation of style 'Using double quotes for all strings' | |
- unaccessable code paths | |
- unused variables | |
- Bonus: Free | |
HoundCI | |
- utilizes Rubocop | |
- connects via webhooks to github and comments on cop violations in pull requests | |
Our Journey | |
HoundCI subscription | |
- creates way too much noise | |
- not configured properly | |
Configuring Rubocop | |
- Example code here of the file it generates | |
- cleaning up existing code: run the code here | |
Conflicting styles | |
- bring the issue up on Slack | |
- provide both styles | |
- enable cop of the chosen style | |
- fix all cases of conflicting style | |
Integrating Rubocop into build process | |
- example of our build script | |
- Build fails if style violation present | |
Run Rubocop locally before pushing | |
- provide team with script to run rubocop on local branch | |
Other steps | |
- integrate Haml-Lint as well | |
- provide pull request on Haml-Lint | |
- slowly enable or reconfigure cops touched by the generated config file | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment