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

Add --avoid-proc-macros. #76

Merged
merged 2 commits into from
Dec 5, 2024
Merged

Add --avoid-proc-macros. #76

merged 2 commits into from
Dec 5, 2024

Conversation

Grinkers
Copy link
Contributor

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"

@Grinkers Grinkers marked this pull request as ready for review February 25, 2024 13:22
@kazuk
Copy link

kazuk commented Nov 25, 2024

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!

Copy link
Collaborator

@dalance dalance left a 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> {
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

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);
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@Grinkers
Copy link
Contributor Author

Grinkers commented Dec 4, 2024

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!

@dalance
Copy link
Collaborator

dalance commented Dec 5, 2024

Thank you for you work.
I'll merge this PR.

@dalance dalance merged commit 5e6d9de into onur:master Dec 5, 2024
1 check passed
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.

3 participants