-
Notifications
You must be signed in to change notification settings - Fork 87
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 config #605
Merged
Merged
Refactor config #605
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If RUST_BACKTRACE is set it would make the output different, this form ignores backtrace always
Nemo157
reviewed
Feb 24, 2024
Jake-Shadle
added a commit
that referenced
this pull request
Feb 24, 2024
An issue was introduced in [#605 ](#605 (comment)) as I had commented out code while iterating on changes and forgot to add back this case because it wasn't covered by any tests. I've added a snapshot test to catch it in the future, as well as added the `deprecated` code to the list of options.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 PR completely refactors the deny configuration, notably:
toml-span
toml-span
is now used for parsing toml files (currently only deny.toml, but eventually cargo manifests as well), replacingtoml
. This was done so that span information is always available for keys and values if we want to use it, as well as just reducing external dependencies and build times, as serde is no longer used.PackageSpec
Specifying a package spec via the name + version combo occurs in many locations in the config, but this has verbose in both the simple case, where you just want to specify a crate name (eg.
[bans.deny]
), as well as needing an entire extra key if you do want to specify the version requirement.In addition, it was not possible to specify just a string previously due to toml + serde making us decide between supporting plain strings for package specs, and span information.
In all cases (and a few new ones) where the package name + version could be used, now a simple string can be used instead, or, if you want/need to supply additional values as a table, the
crate
key can be used instead which follows a simple format as a single string, instead of the separate name/version keys.name
andversion
are still supported, but are deprecated and will be removed in a future release.Format
The string format of
PackageSpec
is quite simple:<crate_name>
=*
<crate_name>@<semver>
==<semver>
<crate_name>:<semver_requirements>
=<semver_requirements>
Add
reason
,use-instead
Many items can now be tagged with a
reason = "<reason>"
and/oruse-instead = "<crate_name>/<url>"
to add explanatory/helpful messages that are surfaced with diagnostic messages. This was added to fix #578 instead of the typical fallback of relying on toml comments that might not be part of the diagnostic span.[advisories.ignore]
Yanked crates can now be ignored by specifying a crate spec + optional reason as a string or table, while still supporting advisory ids.
Root table improved
The
targets
,all-features
,features
,no-default-features
,exclude
, andexclude-dev
keys have been moved to the newgraph
table, as they all affect the dependency graph that cargo-deny performs checks against. Thefeature-depth
key has been moved to theoutput
table. The old locations are still respected, but are deprecated. Note also thattargets
can now just take a string instead oftriple = <target_triple>
.Resolves: #264
Resolves: #539
Resolves: #578
Resolves: #579