-
Notifications
You must be signed in to change notification settings - Fork 115
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
In strict mode, check only for violations unlisted in package_todo.yml #368
Conversation
I'm not sure having a configurable mode is necessary. Let's just make that the default behavior of strict. If you have recorded violations and you enable strict mode, those should be fine, but new violations aren't. If you don't have any recorded violation and you enable strict mode same thing apply. |
@rafaelfranca ok. In your opinion, is it still the Checker's role to determine whether a violation is strict or not depending on whether it was listed or not in the package_todo.yml? |
So the strict refers to the checker's level of enforcement, not the violation itself. When the level is "true," we fail check on unlisted violations already and also permit new violations to be added. When the level is "strict," we do not permit any violations ever. It sounds like you want something in the middle -- allow listed violations, but no new ones. I think @rafaelfranca 's suggestion makes sense. The only downside is now strict is less strict than it used to be -- a package with strict enforcement may have violations (or more easily regress to having them), and there's no mode to say "violation free." Upside is "strict" mode becomes a lot more useful to stop the bleeding. Curious what others think! |
My proposal was to avoid having too big of a breaking change. If organizations rely on the previous definition of 'strict' to function then it might be a complicated upgrade. Keeping two distinct modes could have upsides, for instance not all violations for a given package are recorded within its package_todo.yml (I'm thinking of the privacy checker). Maintaining a 'zero violation policy' (existing strict mode behavior) with packwerk only enforcing a 'no new violation' policy could become a challenge for package owners as they don't own the file where the violations are being written. This may be a separate issue though.
I believe this can be true if strict mode only applies to unlisted violations. If we wanted to support two different modes such as 'strict' and 'strict_for_new', then it's the violation that is either strict or not depending on the package configuration (source or destination) and the listed status of the violation. In any case I've updated the PR to reflect this direction, i.e. the check command may only fail because of strict mode violations if they're coming from unlisted offenses. |
@rafaelfranca @alexevanczuk I'm available to continue the discussion or amend the PR as needed :) I did make the change to support the behavior suggested by Rafael, ie. change the existing strict mode to not account for violations that are already present in the package_todo.yml file. |
I suggest keeping This I think an approach like B might probably be simpler to implement but most importantly it wouldn't be a problem when we're just moving a file from one package to another or stuff like that. In that situation, an implementation like A will force us to change the mode to I think the most important thing here is to avoid increasing the number of dependency/privacy/etc violations. If we add a new violation but solve one, even if it's a really new one... well... at least we're violations-neutral (like carbon-neutral, 😅). |
Other possible names for the new mode could be: not_more, not_worse, healing, flexible... |
@oboxodo I had initially proposed a
|
@alxckn ah, ok. I hadn't seen that. I agree on both points. Anyway, I think any of the proposed solutions would be better than the current strict mode. |
Let's just change the strict mode. It means no new violation. If you have 0 violation (the current implementation) nothing changed for you. If you have violations, now you can enable strict mode. |
What are you trying to accomplish?
Following #367, this PR changes the behavior of strict mode to only consider unlisted violations: only new violations, unlisted in the package_todo.yml file will result in an error when using the 'check' command.
Type of Change
Additional Release Notes
Organization relying on the previous definition of strict mode would need to be warned.
Checklist