Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
- name: Link Checker
uses: lycheeverse/[email protected]
with:
args: "--verbose --cache --max-cache-age 1d ."
args: "--verbose --cache --max-cache-age 1d . --accept 200,429"
fail: true
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zepter"
version = "1.78.1"
version = "1.78.2"
edition = "2021"
authors = [ "Oliver Tale-Yazdi" ]
description = "Analyze, Fix and Format features in your Rust workspace."
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@ zepter
- lint
- propagate-features: Check that features are passed down.
- never-enables: A feature should never enable another other.
- never-implies *(⚠️ unstable)*: A feature should never transitively imply another one.
- only-enables *(⚠️ unstable)*: A features should exclusively enable another one.
- why-enables *(⚠️ unstable)*: Find out why a specific feature is enables.
- debug: *(⚠️ unstable)* just for quick debugging some stuff.
- transpose *(⚠️ unstable)*
- never-implies *(unstable)*: A feature should never transitively imply another one.
- only-enables *(unstable)*: A features should exclusively enable another one.
- why-enables *(unstable)*: Find out why a specific feature is enables.
- debug: *(unstable)* just for quick debugging some stuff.
- transpose *(unstable)*
- dependency
- lift-to-workspace: Lifts crate dependencies to the workspace.

## Used By

(Usage does not imply endorsement)
(Usage does not mean endorsement)

- [alloy-rs/alloy](https://github.com/alloy-rs/alloy/blob/main/.config/zepter.yaml)
- [paradigmxyz/reth](https://github.com/paradigmxyz/reth/blob/main/.config/zepter.yaml)
- [paritytech/polkadot-sdk](https://github.com/paritytech/polkadot-sdk/blob/master/.config/zepter.yaml)
- [chainflip-io/chainflip-backend](https://github.com/chainflip-io/chainflip-backend/blob/main/.zepter.yaml)
- [alloy-rs/alloy](https://github.com/alloy-rs/alloy/blob/833f9a22ca7c30079d64554d435561877c15267a/.config/zepter.yaml)
- [paradigmxyz/reth](https://github.com/paradigmxyz/reth/blob/8e7684d49db571891a265239faf8d462e92b23f0/.config/zepter.yaml)
- [flashbots/rbuilder](https://github.com/flashbots/rbuilder/blob/d22c29b894702d0774e64af70d277ae7bde1da22/zepter.yaml)
- [paritytech/polkadot-sdk](https://github.com/paritytech/polkadot-sdk/blob/4b83d24f4bc96a7b17964be94b178dd7b8f873b5/.config/zepter.yaml)
- [chainflip-io/chainflip-backend](https://github.com/chainflip-io/chainflip-backend/blob/a9d15356dc2e41ea953baa4a0ba4c28e4f2c8b40/.zepter.yaml)

## Example - Using Workspace dependencies

Expand Down
7 changes: 5 additions & 2 deletions src/cmd/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ pub struct PropagateFeatureCmd {
#[clap(flatten)]
cargo_args: super::CargoArgs,

/// The feature to check.
/// Comma separated list of features to check.
///
/// Listing the same feature multiple times has the same effect as listing it once.
#[clap(long, alias = "feature", value_delimiter = ',', required = true)]
features: Vec<String>,

Expand Down Expand Up @@ -419,8 +421,9 @@ impl PropagateFeatureCmd {
pub fn run(&self, global: &GlobalArgs) -> Result<(), String> {
let meta = self.cargo_args.load_metadata()?;
let dag = build_feature_dag(&meta, &meta.packages);
let features = self.features.iter().collect::<BTreeSet<_>>();

for feature in self.features.iter() {
for feature in features.into_iter() {
self.run_feature(&meta, &dag, feature.clone(), global);
}

Expand Down
10 changes: 5 additions & 5 deletions tests/ui/config/v1/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ crates:
cases:
- cmd: run default
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
- cmd: run
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
- cmd: ''
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
- cmd: run my_version
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'my_version'
[INFO] 1/1 --version
Expand All @@ -36,7 +36,7 @@ cases:
[INFO] 1/1 debug --no-benchmark
- cmd: run both
stdout: |
zepter 1.78.1
zepter 1.78.2
Num workspace members: 1
Num dependencies: 1
DAG nodes: 0, links: 0
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/config/v1/finds_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ crates:
cases:
- cmd: ''
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -19,7 +19,7 @@ cases:
- [ '--version' ]
- cmd: ''
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -35,7 +35,7 @@ cases:
- [ '--version' ]
- cmd: ''
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -51,7 +51,7 @@ cases:
- [ '--version' ]
- cmd: run default
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -67,7 +67,7 @@ cases:
- [ '--version' ]
- cmd: run default
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -83,7 +83,7 @@ cases:
- [ '--version' ]
- cmd: run default
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -99,7 +99,7 @@ cases:
- [ '--version' ]
- cmd: run default --config .cargo/polkadot.yaml
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand All @@ -115,7 +115,7 @@ cases:
- [ '--version' ]
- cmd: run default -c .cargo/polkadot.yaml
stdout: |
zepter 1.78.1
zepter 1.78.2
stderr: |
[INFO] Running workflow 'default'
[INFO] 1/1 --version
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/config/v1/version_bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cases:
stderr: |2

thread 'main' panicked at src/cmd/run.rs:27:46:
Invalid config file: "Config file version is too new. The file requires at least version 2.0.0, but the current version is 1.78.1. Please update Zepter or ignore this check with `--check-cfg-compatibility=off`."
Invalid config file: "Config file version is too new. The file requires at least version 2.0.0, but the current version is 1.78.2. Please update Zepter or ignore this check with `--check-cfg-compatibility=off`."
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
code: 101
- cmd: run default --check-cfg-compatibility=off
Expand All @@ -15,7 +15,7 @@ cases:
[INFO] Running workflow 'default'

thread 'main' panicked at src/cmd/run.rs:27:46:
Invalid config file: "Config file version is too new. The file requires at least version 2.0.0, but the current version is 1.78.1. Please update Zepter or ignore this check with `--check-cfg-compatibility=off`."
Invalid config file: "Config file version is too new. The file requires at least version 2.0.0, but the current version is 1.78.2. Please update Zepter or ignore this check with `--check-cfg-compatibility=off`."
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
code: 1
configs:
Expand Down
39 changes: 39 additions & 0 deletions tests/ui/lint/propagate-feature/fix_from_no_feat_duplicate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Fix feature issue, but the same feature is listed multiple times.
crates:
- name: A
deps:
- B
- name: B
features:
F0: null
cases:
- cmd: lint propagate-feature --feature F0,F0 --fix
stdout: |
crate 'A'
feature 'F0'
is required by 1 dependency:
B
Found 1 issue and fixed 1 (all fixed).
code: 0
diff: |
diff --git A/Cargo.toml A/Cargo.toml
index 7f2ba2ef51..197e942470 100644
--- A/Cargo.toml
+++ A/Cargo.toml
@@ -14,0 +15 @@ B = { version = "*", path = "../B"}
+F0 = []
- cmd: lint propagate-feature --feature F0,F0,F0 --workspace --fix
stdout: |
crate 'A'
feature 'F0'
is required by 1 dependency:
B
Found 1 issue and fixed 1 (all fixed).
code: 0
diff: |
diff --git A/Cargo.toml A/Cargo.toml
index 7f2ba2ef51..197e942470 100644
--- A/Cargo.toml
+++ A/Cargo.toml
@@ -14,0 +15 @@ B = { version = "*", path = "../B"}
+F0 = []
2 changes: 1 addition & 1 deletion tests/ui/root-args/help.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cases:
- cmd: lint --help
stdout: "Lint your feature usage by analyzing crate metadata\n\nUsage: zepter lint [OPTIONS] <COMMAND>\n\nCommands:\n propagate-feature Check whether features are properly propagated\n never-enables A specific feature never enables a specific other feature\n never-implies A specific feature never implies a specific other feature\n only-enables A specific feature is only implied by a specific set of other features\n why-enabled Arguments for how to load cargo metadata from a workspace\n no-std Check the crates for sane no-std feature configuration\n help Print this message or the help of the given subcommand(s)\n\nOptions:\n -q, --quiet\n Only print errors. Supersedes `--log`\n\n --log <LEVEL>\n Log level to use\n \n [default: info]\n\n --color\n Use ANSI terminal colors\n\n --exit-code-zero\n Try to exit with code zero if the intended check failed.\n \n Will still return 1 in case of an actual error (eg. failed to find some file) or a panic\n (aka software bug).\n\n --fix-hint <FIX_HINT>\n Dont print any hints on how to fix the error.\n \n This is mostly used internally when dispatching, workflows since they come with their\n hints.\n \n [default: on]\n\n Possible values:\n - on: Prints some hint that is (hopefully) helpful\n - off: Prints no hint at all\n\n -h, --help\n Print help (see a summary with '-h')\n"
- cmd: lint propagate-feature --help
stdout: "Check whether features are properly propagated\n\nUsage: zepter lint propagate-feature [OPTIONS] --features <FEATURES>\n\nOptions:\n --manifest-path <MANIFEST_PATH>\n Cargo manifest path or directory.\n \n For directories it appends a `Cargo.toml`.\n\n --workspace\n Whether to only consider workspace crates\n\n --offline\n Whether to use offline mode\n\n --locked\n Whether to use all the locked dependencies from the `Cargo.lock`.\n \n Otherwise it may update some dependencies. For CI usage its a good idea to use it.\n\n --all-features\n \n\n --features <FEATURES>\n The feature to check\n\n -p, --packages [<PACKAGES>...]\n The packages to check. If empty, all packages are checked\n\n -q, --quiet\n Only print errors. Supersedes `--log`\n\n --feature-enables-dep <FEATURE:CRATE>\n The auto-fixer will enables the feature of the dependencies as non-optional.\n \n This can be used in case that a dependency should not be enabled like `dep?/feature` but\n like `dep/feature` instead. In this case you would pass `--feature-enables-dep\n feature:dep`. The option can be passed multiple times, or multiple key-value pairs can be\n passed at once by separating them with a comma like: `--feature-enables-dep\n feature:dep,feature2:dep2`. (TODO: Duplicate entries are undefined).\n\n --log <LEVEL>\n Log level to use\n \n [default: info]\n\n --color\n Use ANSI terminal colors\n\n --left-side-feature-missing <MUTE_SETTING>\n Overwrite the behaviour when the left side dependency is missing the feature.\n \n This can be used to ignore missing features, treat them as warning or error. A \"missing\n feature\" here means that if `A` has a dependency `B` which has a feature `F`, and the\n propagation is checked then normally it would error if `A` is not forwarding `F` to `B`.\n Now this option modifies the behaviour if `A` does not have the feature in the first place.\n The default behaviour is to require `A` to also have `F`.\n \n [default: fix]\n\n Possible values:\n - ignore: Ignore this behaviour\n - report: Only report but do not fix\n - fix: Fix if `--fix` is passed\n\n --exit-code-zero\n Try to exit with code zero if the intended check failed.\n \n Will still return 1 in case of an actual error (eg. failed to find some file) or a panic\n (aka software bug).\n\n --ignore-missing-propagate <CRATE/FEATURE:DEP/DEP_FEATURE>\n Ignore single missing links in the feature propagation chain.\n\n --fix-hint <FIX_HINT>\n Dont print any hints on how to fix the error.\n \n This is mostly used internally when dispatching, workflows since they come with their\n hints.\n \n [default: on]\n\n Possible values:\n - on: Prints some hint that is (hopefully) helpful\n - off: Prints no hint at all\n\n --left-side-outside-workspace <MUTE_SETTING>\n How to handle the case that the LHS is outside the workspace.\n \n [default: fix]\n\n Possible values:\n - ignore: Ignore this behaviour\n - report: Only report but do not fix\n - fix: Fix if `--fix` is passed\n\n --dep-kinds <KIND/MUTE_SETTING>\n How to handle dev-dependencies.\n \n [default: normal:check,dev:check,build:check]\n\n --show-version\n Show crate versions in the output\n\n --show-path\n Show crate manifest paths in the output\n\n --fix\n Try to automatically fix the problems\n\n --modify-paths <MODIFY_PATHS>\n \n\n --fix-dependency <FIX_DEPENDENCY>\n Fix only issues with this package as dependency\n\n --fix-package <FIX_PACKAGE>\n Fix only issues with this package as feature source\n\n -h, --help\n Print help (see a summary with '-h')\n"
stdout: "Check whether features are properly propagated\n\nUsage: zepter lint propagate-feature [OPTIONS] --features <FEATURES>\n\nOptions:\n --manifest-path <MANIFEST_PATH>\n Cargo manifest path or directory.\n \n For directories it appends a `Cargo.toml`.\n\n --workspace\n Whether to only consider workspace crates\n\n --offline\n Whether to use offline mode\n\n --locked\n Whether to use all the locked dependencies from the `Cargo.lock`.\n \n Otherwise it may update some dependencies. For CI usage its a good idea to use it.\n\n --all-features\n \n\n --features <FEATURES>\n Comma separated list of features to check.\n \n Listing the same feature multiple times has the same effect as listing it once.\n\n -p, --packages [<PACKAGES>...]\n The packages to check. If empty, all packages are checked\n\n -q, --quiet\n Only print errors. Supersedes `--log`\n\n --feature-enables-dep <FEATURE:CRATE>\n The auto-fixer will enables the feature of the dependencies as non-optional.\n \n This can be used in case that a dependency should not be enabled like `dep?/feature` but\n like `dep/feature` instead. In this case you would pass `--feature-enables-dep\n feature:dep`. The option can be passed multiple times, or multiple key-value pairs can be\n passed at once by separating them with a comma like: `--feature-enables-dep\n feature:dep,feature2:dep2`. (TODO: Duplicate entries are undefined).\n\n --log <LEVEL>\n Log level to use\n \n [default: info]\n\n --color\n Use ANSI terminal colors\n\n --left-side-feature-missing <MUTE_SETTING>\n Overwrite the behaviour when the left side dependency is missing the feature.\n \n This can be used to ignore missing features, treat them as warning or error. A \"missing\n feature\" here means that if `A` has a dependency `B` which has a feature `F`, and the\n propagation is checked then normally it would error if `A` is not forwarding `F` to `B`.\n Now this option modifies the behaviour if `A` does not have the feature in the first place.\n The default behaviour is to require `A` to also have `F`.\n \n [default: fix]\n\n Possible values:\n - ignore: Ignore this behaviour\n - report: Only report but do not fix\n - fix: Fix if `--fix` is passed\n\n --exit-code-zero\n Try to exit with code zero if the intended check failed.\n \n Will still return 1 in case of an actual error (eg. failed to find some file) or a panic\n (aka software bug).\n\n --ignore-missing-propagate <CRATE/FEATURE:DEP/DEP_FEATURE>\n Ignore single missing links in the feature propagation chain.\n\n --fix-hint <FIX_HINT>\n Dont print any hints on how to fix the error.\n \n This is mostly used internally when dispatching, workflows since they come with their\n hints.\n \n [default: on]\n\n Possible values:\n - on: Prints some hint that is (hopefully) helpful\n - off: Prints no hint at all\n\n --left-side-outside-workspace <MUTE_SETTING>\n How to handle the case that the LHS is outside the workspace.\n \n [default: fix]\n\n Possible values:\n - ignore: Ignore this behaviour\n - report: Only report but do not fix\n - fix: Fix if `--fix` is passed\n\n --dep-kinds <KIND/MUTE_SETTING>\n How to handle dev-dependencies.\n \n [default: normal:check,dev:check,build:check]\n\n --show-version\n Show crate versions in the output\n\n --show-path\n Show crate manifest paths in the output\n\n --fix\n Try to automatically fix the problems\n\n --modify-paths <MODIFY_PATHS>\n \n\n --fix-dependency <FIX_DEPENDENCY>\n Fix only issues with this package as dependency\n\n --fix-package <FIX_PACKAGE>\n Fix only issues with this package as feature source\n\n -h, --help\n Print help (see a summary with '-h')\n"
4 changes: 2 additions & 2 deletions tests/ui/root-args/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ crates: []
cases:
- cmd: --version
stdout: |
zepter 1.78.1
zepter 1.78.2
- cmd: -V
stdout: |
zepter 1.78.1
zepter 1.78.2
Loading