-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
False negative: Removing an empty module should be a breaking change #482
Comments
Thanks for offering to help! Adding a lint for this is not difficult but it does require a bit of context on a few different moving parts, since it requires changes in both schema and lints. To be honest, the schema change here isn't the easiest to pull off — it isn't difficult but it does require a bunch of related changes in different places, and I don't trust our onboarding docs enough to feel like I'd be setting you up for success rather than frustration. If you'd rather just add the lint, I'm happy to take care of the schema editing (though I'm also happy to guide you through it, if you feel up for a challenge!) I'm also happy to find you an easier case where you can make a schema extension and write some new lints with it where there wouldn't be as many moving pieces to learn about on day 1. Make sure to read the CONTRIBUTING guide, especially the section on adding new lints: https://github.com/obi1kenobi/cargo-semver-checks/blob/main/CONTRIBUTING.md It would also be helpful to read through this prior issue, where another new contributor exposed traits' supertraits to the linter by similarly adding new schema and then using it in a new lint: #232 Here's what needs to be done:
Again, I'm happy to do the first two points here so you can focus on the last three, and once you've gotten a chance to "warm up" here I can suggest another issue where you can try out making edits to the schema and writing more lints. We also have a playground where you can write queries against rustdoc. It uses the same underlying code as |
This is prerequisite for solving obi1kenobi/cargo-semver-checks#482
This is prerequisite for solving obi1kenobi/cargo-semver-checks#482
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Nick Mathewson <nickm@freehaven.net>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Nick Mathewson <nickm@freehaven.net>
* Add adapter support for a Module item type. This is prerequisite for solving obi1kenobi/cargo-semver-checks#482 * fixup! Add adapter support for a Module item type. Remove extraneous empty lines from test_crates/modules. * fixup! Add adapter support for a Module item type. In resolve_module_edge, tolerate item re-exports. * fixup! Add adapter support for a Module item type. In test, use @fold to combine all module members. * fixup! Add adapter support for a Module item type. Modules:items: only return supported items. * fixup! Add adapter support for a Module item type. In modules test, check item types. * Implement a root_module edge from Crate. * Update src/rustdoc_schema.graphql * fixup! Add adapter support for a Module item type. Remove "is_crate" property. --------- Co-authored-by: Nick Mathewson <nickm@freehaven.net>
…modules (#534) * Update lockfile to latest trustfall-rustdoc-adapter(s) * Add a new "module_missing" lint Resolves #482. * module_missing: Add expected positives for trait_missing* * fixup! Add a new "module_missing" lint Tweak error message. * fixup! Add a new "module_missing" lint Adjust formatting on test_crates/module_missing * Update test_crates/module_missing/new/src/lib.rs --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
Steps to reproduce the bug with the above code
Check out the demo repository at https://github.com/nmathewson/cargo-semver-checks-demo-1 .
Note that in
main
, lib.rs is empty.Note that in
v0.1.0
, lib.rs contains an empty public module.Run
cargo semver-checks --baseline-rev v0.1.0
.Actual Behaviour
The output is:
Expected Behaviour
There should be an error, since any code that tried to import the empty module from an external crate will be broken by a removal of the empty module.
I think this is plausible in realistic scenarios. For example, you could make a crate with an (empty) prelude, and tell people that they are expected to say
use mycrate::prelude::*
, even if you don't yet have anything in the prelude.Generated System Information
cargo version
Compile time information
The text was updated successfully, but these errors were encountered: