-
Notifications
You must be signed in to change notification settings - Fork 37
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 --avoid-proc-macros
.
#76
Conversation
Hello, This pull request has been open for a while, but it seems no one has reviewed it yet. If possible, could someone take a look and help move the review process forward? Thank you for your time and support! |
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.
Sorry for the late reply.
The function seems to be good.
I commented about some naming issues.
@@ -19,6 +19,23 @@ fn normalize(license_string: &str) -> String { | |||
list.join(" OR ") | |||
} | |||
|
|||
fn get_proc_macro_node_names(metadata: &Metadata, opt: &GetDependenciesOpt) -> HashSet<String> { |
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.
This function name doesn't shows the result value is affected by opt.avoid_proc_macros
.
How about removing if opt.avoid_proc_macros
and adding it at the calling site of this function?
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 could, but I think it'll make things less clear. The pattern is being used elsewhere already. If we moved everything out to the calling site, it sort of defeats the purpose of the functions.
Line 22 in 33b857a
fn get_node_name_filter(metadata: &Metadata, opt: &GetDependenciesOpt) -> Result<HashSet<String>> { |
src/lib.rs
Outdated
@@ -164,6 +182,7 @@ pub fn get_dependencies_from_cargo_lock( | |||
let metadata = metadata_command.exec()?; | |||
|
|||
let filter = get_node_name_filter(&metadata, &opt)?; | |||
let proc_macro_filter = get_proc_macro_node_names(&metadata, &opt); |
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.
The above fileter
means it should be passed, but proc_macro_filter
means is shouldn't be passed.
So it may be bit confusable.
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.
Agreed, this naming is not good. I've done a renaming pass. I think proc_macro_exclusions
is better. If anybody has a better idea, feel free to comment.
I took the opportunity to fix some formatting on old code and clippy pedantic as of 1.83 too. If you would like me to squash or separate things out, just say so. Have a nice day! |
Thank you for you work. |
I found some discussion about this in #38.
Used on this crate, it filters out
"serde_derive", "quote", "clap_derive", "serde", "syn", "heck", "proc-macro2", "thiserror-impl"