Skip to content
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

Fix overriding a rule with a disable one #274

Merged
merged 2 commits into from
Jun 16, 2019

Conversation

mdaloia
Copy link
Contributor

@mdaloia mdaloia commented Jan 28, 2019

If we want to disable a rule from an inherited set of rules through overriding it in the child ruleset (*) the disabled rule is not created but the rule from the parent is left on the set of active rules.

Example:

require: default
rules:
    - name: openapi-tags-alphabetical
      disabled: true

(openapi-tags-alphabetical is defined in default)

This fix this situation by deleting the rule (if exists) from the set of active rules if the most specific rule is declared as disabled.

I took the liberty to add a deprecation message with an estimated version in which the enabled property would be removed. I can revert it if you think that it is not necessary.

The lines range 16-22 should be removed when enabled is deleted.

(*): Another option would be using skip but I think this option more like a temporal option used under some situation while you develop. Having it disabled in the ruleset is more organized (and, for example, you can leave a comment why you are disabling it).

@mdaloia
Copy link
Contributor Author

mdaloia commented Mar 27, 2019

@djtarazona Could you have a look at this PR and merge it if it's ok?

Additionally, I have 2 other open PR (#278 and #269) that would be great if you could have a look at them.

Thanks in advance!

@djtarazona
Copy link
Contributor

@mdaloia Feel free to resolve the conflicts and I'll take another look at merging this in. Thanks!

Martin D'Aloia added 2 commits May 19, 2019 13:02
If we want to disable a rule from an inherited set of rules through
overriding it in the child ruleset the disabled rule is not created but
the rule from the parent is left on the set of active rules.

This fix this situation by deleting the rule (if exists) from the set of
active rules if the most specific rule is declared as disabled.
In order to avoid the 'enabled' property we adapt it to 'disabled' (only
if 'disabled' is not already defined).

Also, it emits a warning in the console about this deprecated property
and its replacement.
@mdaloia mdaloia force-pushed the fix-override-with-disabled-rule branch from 6326bec to e0e6067 Compare May 19, 2019 17:52
@mdaloia
Copy link
Contributor Author

mdaloia commented May 19, 2019

@djtarazona Done! Fixed and rebased with master. Thanks

@djtarazona djtarazona merged commit 84c78ba into wework:master Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants