Skip to content

Commit e2468ea

Browse files
authored
Remove legacy update aliases (#2619)
Removes the deprecated `auto_update` config key and `auto-update` command spelling.
1 parent 795c3a4 commit e2468ea

9 files changed

Lines changed: 5 additions & 86 deletions

File tree

‎crates/prek/src/cli/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub(crate) enum Command {
268268
/// Generate a sample prek configuration file.
269269
SampleConfig(SampleConfigArgs),
270270
/// Update configured repositories.
271-
#[command(aliases = ["auto-update", "autoupdate"])]
271+
#[command(alias = "autoupdate")]
272272
Update(UpdateArgs),
273273
/// Manage the prek cache.
274274
Cache(CacheNamespace),

‎crates/prek/src/config/mod.rs‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ use crate::warn_user_once;
4545
)]
4646
pub(crate) struct Config {
4747
/// Default settings for `prek update` in this project.
48-
#[serde(alias = "auto_update")]
4948
pub update: Option<UpdateOptions>,
5049
/// Configuration-local aliases for numeric hook priorities.
5150
#[serde(default)]
@@ -877,21 +876,6 @@ mod tests {
877876
"#);
878877
}
879878

880-
#[test]
881-
fn parse_legacy_update_key_alias() {
882-
let yaml = indoc::indoc! {r"
883-
auto_update:
884-
cooldown_days: 7
885-
repos: []
886-
"};
887-
let result = serde_saphyr::from_str::<Config>(yaml).unwrap();
888-
889-
assert_eq!(
890-
result.update.and_then(|options| options.cooldown_days),
891-
Some(7)
892-
);
893-
}
894-
895879
#[test]
896880
fn test_read_yaml_config() -> Result<()> {
897881
let config = read_config(Path::new("tests/fixtures/uv-pre-commit-config.yaml"))?;

‎crates/prek/src/schema.rs‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,32 +120,6 @@ fn strip_null_acceptance(schema: &mut schemars::Schema) {
120120
}
121121
}
122122

123-
fn add_compatibility_aliases(schema: &mut schemars::Schema) {
124-
use serde_json::Value;
125-
126-
let Some(properties) = schema
127-
.as_object_mut()
128-
.and_then(|schema| schema.get_mut("properties"))
129-
.and_then(Value::as_object_mut)
130-
else {
131-
return;
132-
};
133-
134-
let Some(update_schema) = properties.get("update").cloned() else {
135-
return;
136-
};
137-
let mut auto_update_schema = update_schema;
138-
if let Some(obj) = auto_update_schema.as_object_mut() {
139-
obj.insert(
140-
"description".to_string(),
141-
Value::String(
142-
"Compatibility alias for `update`. Prefer `update` in new configs.".to_string(),
143-
),
144-
);
145-
}
146-
properties.insert("auto_update".to_string(), auto_update_schema);
147-
}
148-
149123
impl schemars::JsonSchema for Stages {
150124
fn inline_schema() -> bool {
151125
true
@@ -471,8 +445,7 @@ mod _gen {
471445
.with_transform(schemars::transform::RestrictFormats::default())
472446
.with_transform(super::RemoveNullTypes);
473447
let generator = schemars::SchemaGenerator::new(settings);
474-
let mut schema = generator.into_root_schema_for::<Config>();
475-
super::add_compatibility_aliases(&mut schema);
448+
let schema = generator.into_root_schema_for::<Config>();
476449
serde_json::to_string_pretty(&schema).unwrap() + "\n"
477450
}
478451

‎crates/prek/src/settings.rs‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ impl Deref for FilesystemOptions {
8282
#[derive(Debug, Clone, Default, Deserialize)]
8383
#[serde(default, rename_all = "snake_case")]
8484
pub(crate) struct Options {
85-
#[serde(alias = "auto_update")]
8685
update: Option<GlobalUpdateOptions>,
8786
}
8887

@@ -260,22 +259,6 @@ mod tests {
260259
"#);
261260
}
262261

263-
#[test]
264-
fn options_deserializes_legacy_update_key_alias() {
265-
let options: Options = toml::from_str(
266-
r"
267-
[auto_update]
268-
cooldown_days = 7
269-
",
270-
)
271-
.unwrap();
272-
273-
assert_eq!(
274-
options.update.and_then(|options| options.cooldown_days),
275-
Some(7)
276-
);
277-
}
278-
279262
#[test]
280263
fn update_settings_uses_global_freeze() {
281264
let filesystem = FilesystemOptions(

‎crates/prek/tests/global_config.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ fn global_config_ignores_unknown_options() {
3636
}
3737

3838
#[test]
39-
fn update_command_accepts_legacy_command_alias() {
39+
fn update_command_accepts_upstream_alias() {
4040
let context = TestEnv::new().with_config("repos: []");
4141

42-
cmd_snapshot!(context, context.command().arg("auto-update"), @"
42+
cmd_snapshot!(context, context.command().arg("autoupdate"), @"
4343
success: true
4444
exit_code: 0
4545
----- stdout -----

‎docs/compatibility.md‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,13 @@
1616
| -- | -- |
1717
| `prek install-hooks` | `prek prepare-hooks` |
1818
| `prek install --install-hooks` | `prek install --prepare-hooks` |
19-
| `prek auto-update` | `prek update` |
2019
| `prek autoupdate` | `prek update` |
2120
| `prek gc` | `prek cache gc` |
2221
| `prek clean` | `prek cache clean` |
2322
| `prek init-templatedir` | `prek util init-template-dir` |
2423
| `prek init-template-dir` | `prek util init-template-dir` |
2524
| `pre-commit migrate-config` | Not provided directly; use `prek util yaml-to-toml` to migrate YAML to `prek.toml` |
2625

27-
## Preferred config key spellings
28-
29-
`prek` still accepts legacy config keys below as aliases.
30-
31-
| Compatibility spelling | Preferred `prek` spelling |
32-
| -- | -- |
33-
| `auto_update` | `update` |
34-
3526
## Why the CLI is reorganized
3627

3728
`pre-commit` keeps many maintenance commands as separate top-level entries. `prek` reorganizes some of them so the command tree is easier to navigate:

‎docs/reference/configuration.md‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ The cooldown age is computed from the tag creation timestamp for annotated tags,
4343

4444
If the current `rev` is newer than the latest cooldown-eligible tag, [`prek update`](cli.md#prek-update) keeps the current `rev` instead of downgrading it.
4545

46-
!!! note "Compatibility alias"
47-
48-
The legacy `auto_update` key is still accepted as an alias for `update`.
49-
5046
## Extension keys (`x-`)
5147

5248
Any key starting with `x-` (a lowercase `x` followed by a hyphen) is silently ignored by `prek` at any level of the configuration. This supports custom metadata without triggering unexpected key warnings.
@@ -411,10 +407,6 @@ CLI filters have the highest precedence. `--include-tag` and `--exclude-tag` rep
411407

412408
In workspace mode, `update` is scoped to the project config file that defines it and is not inherited by nested projects. Sub-projects use their own `update`, then the user-level global config, then built-in defaults. Repositories shared by multiple projects are fetched once but evaluated with each project's cooldown, freeze, and tag-filter settings.
413409

414-
!!! note "Compatibility alias"
415-
416-
The legacy `auto_update` key is still accepted as an alias for `update`.
417-
418410
### `minimum_prek_version`
419411

420412
<a id="prek-only-minimum-prek-version-config"></a>

‎prek.schema.json‎

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎skills/prek/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Common install methods:
154154
- `prek run <hook-id>`: run only one hook
155155
- `prek list`: list discovered hooks and projects
156156
- `prek validate-config`: validate `prek.toml` or `.pre-commit-config.yaml`
157-
- `prek auto-update`: update pinned hook revisions
157+
- `prek update`: update pinned hook revisions
158158
- `prek util yaml-to-toml`: convert an existing YAML config to `prek.toml`
159159
- `prek util identify <path>`: inspect file tags when `types`, `types_or`, or `exclude_types` do not match as expected
160160

0 commit comments

Comments
 (0)