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

Support rustdoc:: lints #8

Open
emilk opened this issue Sep 12, 2022 · 4 comments
Open

Support rustdoc:: lints #8

emilk opened this issue Sep 12, 2022 · 4 comments

Comments

@emilk
Copy link

emilk commented Sep 12, 2022

Currently if I put "rustdoc::missing_crate_level_docs" in warn in Cranky.toml it does nothing.

…though honestly I don't understand the rustdoc lints. cargo clippy -- -D rustdoc::missing_crate_level_docs runs without warnings when there are missing crate level docs.

@Nemo157
Copy link

Nemo157 commented Sep 14, 2022

Tool lints are checked by their respective tools. You need to use cargo rustdoc -- -D rustdoc::missing_crate_level_docs.

That shows a reason why cargo-lints took a tool as the first argument, it would have been possible to expand it to cargo lints rustdoc to support multiple tools (and maybe some cargo lints --all option to rebuild with all the different tools).

Maybe cargo-cranky should run both clippy and rustdoc by default? (EDIT: or based on detecting lint names from the config?) Unfortunately running rustdoc right now will generate docs if it is successful. There is an unstable --check option that allows only running the lints.

@emilk
Copy link
Author

emilk commented Sep 14, 2022

There is also the problem that cargo rustdoc cannot be run in a workspace:

cargo rustdoc -- -D rustdoc::missing_crate_level_docs

❯ cargo rustdoc -- -D rustdoc::missing_crate_level_docs
error: manifest path egui/Cargo.toml` is a virtual manifest, but this command requires running against an actual package in this workspace

cargo doc is supposed to be used for workspaces, but then you cannot supply any lints:

❯ cargo doc -- -D rustdoc::missing_crate_level_docs -D rustdoc::unsafe_op_in_unsafe_fn
error: Found argument '-D' which wasn't expected, or isn't valid in this context

@Nemo157
Copy link

Nemo157 commented Sep 14, 2022

You can do something like RUSTDOCFLAGS=-Drustdoc::... cargo doc --workspace --no-deps

Another reason it'd be great to have all the intricacies handled by a tool like this 😁

@emilk
Copy link
Author

emilk commented Sep 15, 2022

Thanks @Nemo157, that works!

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

No branches or pull requests

2 participants