-
Notifications
You must be signed in to change notification settings - Fork 116
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 severity
setting to ERBLint rules
#1634
Conversation
…d from the erblint-github CustomHelpers module
🦋 Changeset detectedLatest commit: 3f473bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
What a fantastic idea, thank you @mxriverlynn!!
Co-authored-by: Cameron Dutro <[email protected]>
Description
This PR adds the ability to set a
severity
level in our custom ERBLint rules, through the use of the newSeveritySchema
linter schema. The goal is to provide a configuration option for linters, allowing us to set the failure severity in a project'serb-lint.yml
file. This will help us with cleaning up the deprecated components counter failures in dotcom, by allowing us to re-enable that rules but only warn about the failures, giving us time to clean up the issues in smaller PRsFor this PR, only the
DeprecatetdComponentsCounter
linter is using the new severity schema. Tests for theDeprecatetdComponentsCounter
have been updated to ensure the severity is used as expected.Integration
No change required, as the new setting is optional. Once we are ready, the following configuration in dotcom's
erb-lint.yml
file needs to be made:Setting the Severity
The options for
severity
in ERBLint come from ERBLint::Utils::SeverityLevels in ERBLint, and include the following::info
:refactor
:convention
:warning
:error
:fatal
NOTE: With all other settings defaulted, only the
:info
severity appears to ignore the failures. setting this to:warning
or any other level (including the default / removing the setting) causes it to treat linting issues as failures. This is possible to change by updating thegithub-lint
step to include the following command-line option for ERBLint, however:For example:
bin/bundle exec erblint --fail-severity :error
should allowseverity: :warning
to still pass the CI step, while allowing:error
and:fatal
to fail the step. Without further testing, though, it's unknown how the defaultnil
severity would behave.Proof of Concept in dotcom
Using this branch, I ran two examples of erblint on dotcom. the first was with the severity set to
:warning
and the second set to:info
, using this proof of concept PR in dotcomseverity: :warning
https://janky.githubapp.com/71857737/outputseverity: :info
https://janky.githubapp.com/71860174/outputMerge checklist