When running --locked, check formatting of store files #348
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.
This will detect issues like audits being out of order and unrecognized fields in CI, and should help avoid simple executions of
cargo vet
causing formatting changes locally.The implementation isn't particularly efficient for this, in that it immediately attempts to re-serialize the file after parsing it, and then compares the results (ignoring trailing newlines). As this checks formatting, it is a string-based check, and not structural.
The
similar
library, which we already used for our tests, is used to allow including diffs in the output to make any issues more clear. This also required some changes to the way we read/write files from disk to keep information around.As a side-effect of these changes, we no longer emit an extra unnecessary newline at the end of store files. This won't be detected as an error by the checker, but will be a change when run locally.
Fixes #341