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

Refactor data generation to be cleaner and more principled. #1001

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

obi1kenobi
Copy link
Owner

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.

@obi1kenobi obi1kenobi force-pushed the data_generation_refactor branch 10 times, most recently from 42d615f to 084ab40 Compare November 21, 2024 04:51
@obi1kenobi obi1kenobi marked this pull request as ready for review November 21, 2024 04:52
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.
@obi1kenobi obi1kenobi force-pushed the data_generation_refactor branch from 084ab40 to 936c264 Compare November 21, 2024 04:52
@obi1kenobi obi1kenobi enabled auto-merge (squash) November 21, 2024 04:53
@obi1kenobi obi1kenobi merged commit 2615b5d into main Nov 21, 2024
31 checks passed
@obi1kenobi obi1kenobi deleted the data_generation_refactor branch November 21, 2024 05:01
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.

1 participant