-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add eslint-ratchet #239
Merged
Merged
Add eslint-ratchet #239
Conversation
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
laurenfrederick
approved these changes
Mar 12, 2018
scisco
reviewed
Mar 12, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this requires a new step in the PR process for every developer, we should update the README and and the PR template
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a Ruby gem called
quality
that runs a variety of variety of static code analysis tools against your Ruby code. One of the interesting features of that gem is that it records the number of errors in your code. If you make a change which increases the number of errors, it complains. If you make a change which decreases the number of errors, it records that lower number, and that is the new upper limit. By doing that, it causes the number of errors to trend down over time.We talked about doing something similar in the Cumulus architecture meeting yesterday to address the large number of eslint errors that are generated in our code. This PR replicates some of the functionality that the
quality
gem provides.This PR introduces a bash script called
bin/eslint-ratchet
. That script runseslint
against your code and determines the number of errors thateslint
has found. It also reads the previous best score from.eslint-ratchet-high-water-mark
. If there are more errors now than before, it fails and indicates that there has been an increase in the number of errors. If there are less errors than before, it updates.eslint-ratchet-high-water-mark
with that new and improved number. That updated.eslint-ratchet-high-water-mark
file should be checked into git.Circle CI also runs
eslint-ratchet
. It expects the number of errors reported to match the number in the.eslint-ratchet-high-water-mark
file. If it does not, it will fail the CI run. That means that you either 1) introduced new errors or 2) forgot to runeslint-ratchet
and commit.eslint-ratchet-high-water-mark
with the new, lower score.