-
Notifications
You must be signed in to change notification settings - Fork 8
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
Introducing enforcement_globs_ignore #189
Introducing enforcement_globs_ignore #189
Conversation
if serialized_pack == "{}\n" { | ||
"".to_owned() | ||
} else { | ||
serialized_pack.replace("\n-", "\n -") |
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.
I removed this line because there's 2 levels of nesting.
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.
So @perryqh is this basically a more configurable version of the ignore
field in packwerk.yml
? So a pack can say that it basically opts out of any violations related to references it makes in some files it owns?
Yes! A pack can also ignore outgoing violations. This change gives finer grain control of |
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.
Looks good!
Only thing I'm not 100% sold on is the name of enforcement_globs_ignore
. The language is not super clear to me but I can't think of a better alternative right now 🤷🏼
Separately, the naming is enforce_xyz
... but we also refer to these as checkers. I think since we already use the enforce language it's fine but now that I'm thinking of it I think I wish packwerk just used "check" everywhere, e.g. check_dependencies
, check_privacy
, etc. Not in scope here though...
fn folder_visible(from_pack: &Pack, to_pack: &Pack) -> Result<bool> { | ||
if to_pack.enforce_folder_visibility().is_false() { | ||
return Ok(true); | ||
fn folder_visible(referencing_pack: &Pack, defining_pack: &Pack) -> bool { |
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.
nice name change
use super::*; | ||
|
||
#[macro_export] | ||
macro_rules! test_ignore { |
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.
Dang, you're fancy with these macros.
I haven't gotten into the rust macros yet. I've never liked meta-programming in Ruby, but mostly because it's hard to verify. I love how Rust's meta-programming is statically type checked!
@perryqh This is in draft mode. Let me know when it's ready to go and I'll merge it! |
Thanks for the review @alexevanczuk! I'm going to do a lot more testing today before I mark it as "ready for review". If you think of better names, please let me know! |
46e2c40
to
4fd7c4c
Compare
4fd7c4c
to
16b4838
Compare
Ready for review @alexevanczuk. Thanks! |
What
The ability to ignore violations by glob patterns.
The above configuration will enforce privacy and visibility violation references only in
packs/product_services/foo
Why
We have groupings of packs that we call
product_services
. Inside a product service, we don't care aboutprivacy
violations. We need a mechanism toenforce_privacy
, but only for packs outside of the product service.This also gives us the ability to lock down a pack with
strict
even if there are offending packs, which can prevent new violations.Notes
This might be a break from packwerk as we don't plan on immediately making this change to packwerk-extensions. It might not make sense to merge this.