fix: match the narrowest distinctive fragment, and stop padding STALE
Integrating into Bari 206 turned up a pattern that cannot match correctly
formatted source. Its CLAP_DESCRIPTION is long enough that rustfmt wraps
the assignment:
const CLAP_DESCRIPTION: Option<&'static str> =
Some("Multiband compressor/limiter (...)");
A site pattern spanning `const ... = Some("...")` never matches that, and
the fix is general rather than specific to this field: a site pattern
should be the narrowest fragment that is still distinctive, so formatting
decisions above it cannot break the check. Some("...") is unique enough
and lives on one line whatever rustfmt does with the rest.
Also stops appending a bare newline to STALE when nothing was retired,
which a no-op regeneration does on every run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHt4DykxXaQnyaJfyS8KCn
This commit is contained in:
+10
-1
@@ -208,7 +208,10 @@ T="$(printf '\t')"
|
|||||||
printf 'req%shomepage.cargo%sCargo.toml%shomepage = "%s"\n' "$T" "$T" "$T" "$new_homepage"
|
printf 'req%shomepage.cargo%sCargo.toml%shomepage = "%s"\n' "$T" "$T" "$T" "$new_homepage"
|
||||||
printf 'req%surl.plugin%s%s%sconst URL: &'"'"'static str = env!("CARGO_PKG_HOMEPAGE")\n' "$T" "$T" "$LIB_FILE" "$T"
|
printf 'req%surl.plugin%s%s%sconst URL: &'"'"'static str = env!("CARGO_PKG_HOMEPAGE")\n' "$T" "$T" "$LIB_FILE" "$T"
|
||||||
printf 'req%sdescription.cargo%sCargo.toml%sdescription = "%s"\n' "$T" "$T" "$T" "$new_description"
|
printf 'req%sdescription.cargo%sCargo.toml%sdescription = "%s"\n' "$T" "$T" "$T" "$new_description"
|
||||||
printf 'req%sdescription.clap%s%s%sconst CLAP_DESCRIPTION: Option<&'"'"'static str> = Some("%s")\n' "$T" "$T" "$LIB_FILE" "$T" "$new_clap_description"
|
# Narrowest distinctive fragment, not the whole statement: rustfmt wraps a long
|
||||||
|
# CLAP_DESCRIPTION onto its own line, and a pattern spanning the assignment
|
||||||
|
# would then never match a correctly formatted file.
|
||||||
|
printf 'req%sdescription.clap%s%s%sSome("%s")\n' "$T" "$T" "$LIB_FILE" "$T" "$new_clap_description"
|
||||||
printf 'req%sclapid.plugin%s%s%sconst CLAP_ID: &'"'"'static str = "%s"\n' "$T" "$T" "$LIB_FILE" "$T" "$new_clap_id"
|
printf 'req%sclapid.plugin%s%s%sconst CLAP_ID: &'"'"'static str = "%s"\n' "$T" "$T" "$LIB_FILE" "$T" "$new_clap_id"
|
||||||
printf 'req%svst3id.plugin%s%s%sconst VST3_CLASS_ID: [u8; 16] = *b"%s"\n' "$T" "$T" "$LIB_FILE" "$T" "$new_vst3"
|
printf 'req%svst3id.plugin%s%s%sconst VST3_CLASS_ID: [u8; 16] = *b"%s"\n' "$T" "$T" "$LIB_FILE" "$T" "$new_vst3"
|
||||||
printf 'req%sstruct.def%s%s%sstruct %s {\n' "$T" "$T" "$LIB_FILE" "$T" "$new_struct"
|
printf 'req%sstruct.def%s%s%sstruct %s {\n' "$T" "$T" "$LIB_FILE" "$T" "$new_struct"
|
||||||
@@ -312,7 +315,13 @@ sed -e "s|^PKG=.*|PKG=\"$new_pkg\"|" \
|
|||||||
-e "s|^STRUCT=.*|STRUCT=\"$new_struct\"|" \
|
-e "s|^STRUCT=.*|STRUCT=\"$new_struct\"|" \
|
||||||
-e "s|^PARAMS_STRUCT=.*|PARAMS_STRUCT=\"$new_params_struct\"|" \
|
-e "s|^PARAMS_STRUCT=.*|PARAMS_STRUCT=\"$new_params_struct\"|" \
|
||||||
tools/branding.conf > tools/branding.conf.new
|
tools/branding.conf > tools/branding.conf.new
|
||||||
|
if [ -n "$retired" ]; then
|
||||||
{ sed '$ s/"$//' tools/branding.conf.new; printf '%s"\n' "$retired"; } > tools/branding.conf
|
{ sed '$ s/"$//' tools/branding.conf.new; printf '%s"\n' "$retired"; } > tools/branding.conf
|
||||||
|
else
|
||||||
|
# Nothing retired (a no-op rename, or a regeneration): leave STALE untouched
|
||||||
|
# rather than appending a blank line to it on every run.
|
||||||
|
cat tools/branding.conf.new > tools/branding.conf
|
||||||
|
fi
|
||||||
rm -f tools/branding.conf.new
|
rm -f tools/branding.conf.new
|
||||||
if [ "$new_author" = "$new_vendor" ]; then
|
if [ "$new_author" = "$new_vendor" ]; then
|
||||||
# Identical to VENDOR, so re-comment it: the conf should keep showing that this
|
# Identical to VENDOR, so re-comment it: the conf should keep showing that this
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ req authors.cargo Cargo.toml authors = ["Your Name <your@email.com>"]
|
|||||||
req homepage.cargo Cargo.toml homepage = "https://github.com/YOUR-USERNAME/YOUR-PLUGIN-NAME"
|
req homepage.cargo Cargo.toml homepage = "https://github.com/YOUR-USERNAME/YOUR-PLUGIN-NAME"
|
||||||
req url.plugin src/lib.rs const URL: &'static str = env!("CARGO_PKG_HOMEPAGE")
|
req url.plugin src/lib.rs const URL: &'static str = env!("CARGO_PKG_HOMEPAGE")
|
||||||
req description.cargo Cargo.toml description = "A minimal NIH-plug audio plugin"
|
req description.cargo Cargo.toml description = "A minimal NIH-plug audio plugin"
|
||||||
req description.clap src/lib.rs const CLAP_DESCRIPTION: Option<&'static str> = Some("Your plugin description")
|
req description.clap src/lib.rs Some("Your plugin description")
|
||||||
req clapid.plugin src/lib.rs const CLAP_ID: &'static str = "com.your-domain.plugin-name"
|
req clapid.plugin src/lib.rs const CLAP_ID: &'static str = "com.your-domain.plugin-name"
|
||||||
req vst3id.plugin src/lib.rs const VST3_CLASS_ID: [u8; 16] = *b"Unique16CharId!!"
|
req vst3id.plugin src/lib.rs const VST3_CLASS_ID: [u8; 16] = *b"Unique16CharId!!"
|
||||||
req struct.def src/lib.rs struct MyPlugin {
|
req struct.def src/lib.rs struct MyPlugin {
|
||||||
|
|||||||
|
Can't render this file because it contains an unexpected character in line 7 and column 64.
|
Reference in New Issue
Block a user