Refactor data generation to be cleaner and more principled. #1001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cargo-semver-checks outgrew its previous data generation system. Over the previous 2+ years, this code was slowly turning into spaghetti as we discovered we needed to add ever more functionality and work around ever more issues. It was borderline unmaintainable, and impossible to extend in a meaningful fashion.
As part of rust-lang/rust-project-goals#104, we aim to start supporting manifest linting. That would require generating more data -- not just rustdoc JSON but also project metadatasuch as package features and targets. Plumbing that data though the existing data generation spaghetti code was proving infeasible.
This PR tackles the lion's share of the spaghetti problem. It introduces a new submodule,
data_generation
, that handles data generation tasks and has its own internal invariants and data structures which are not tied into CLI considerations like "should we use color when printing to the terminal". That will make it easier to extend with project metadata in subsequent PRs.There is still some clean-up work remaining -- this PR is just the start of that work. But here we untangle the biggest mess in the tool, which will let us move more quickly elsewhere.