From 69bf2cc820489b79785ca5789717fb9a9aac536d Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Thu, 17 Oct 2024 19:31:21 -0600 Subject: [PATCH] config: cfgpatches checks are now case insensitive (#792) * config: cfgpatches checks are now case insensitive * fix requiredVersion --- libs/config/src/model/config.rs | 4 ++-- libs/sqf/src/analyze/lints/s01_command_required_version.rs | 4 ++-- libs/sqf/src/analyze/lints/s02_event_handlers.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/config/src/model/config.rs b/libs/config/src/model/config.rs index f96c3819..6f76cf26 100644 --- a/libs/config/src/model/config.rs +++ b/libs/config/src/model/config.rs @@ -25,7 +25,7 @@ impl Config { name, properties, .. }) = property { - if name.as_str() == "CfgPatches" { + if name.as_str().to_lowercase() == "cfgpatches" { for patch in properties { if let Property::Class(Class::Local { name, properties, .. @@ -34,7 +34,7 @@ impl Config { let mut required_version = Version::new(0, 0, 0, None); for property in properties { if let Property::Entry { name, value, .. } = property { - if name.as_str() == "requiredVersion" { + if name.as_str().to_lowercase() == "requiredversion" { if let Value::Number(Number::Float32 { value, .. }) = value { required_version = Version::from(*value); diff --git a/libs/sqf/src/analyze/lints/s01_command_required_version.rs b/libs/sqf/src/analyze/lints/s01_command_required_version.rs index c6a9619b..9dca5d89 100644 --- a/libs/sqf/src/analyze/lints/s01_command_required_version.rs +++ b/libs/sqf/src/analyze/lints/s01_command_required_version.rs @@ -177,8 +177,8 @@ impl CodeS01CommandRequiredVersion { self.diagnostic = Some(diag.with_label( Label::secondary(self.required.1.clone(), self.required.2.clone()).with_message( self.required.0.map_or_else( - || "CfgPatch doesn't specify `requiredVersion`".to_string(), - |required| format!("CfgPatch requires version {required}"), + || "CfgPatches entry doesn't specify `requiredVersion`".to_string(), + |required| format!("CfgPatches entry requires version {required}"), ), ), )); diff --git a/libs/sqf/src/analyze/lints/s02_event_handlers.rs b/libs/sqf/src/analyze/lints/s02_event_handlers.rs index f6a05787..2048a538 100644 --- a/libs/sqf/src/analyze/lints/s02_event_handlers.rs +++ b/libs/sqf/src/analyze/lints/s02_event_handlers.rs @@ -642,8 +642,8 @@ impl CodeS02InsufficientVersion { self.diagnostic = Some(diag.with_label( Label::secondary(self.required.1.clone(), self.required.2.clone()).with_message( self.required.0.map_or_else( - || "CfgPatch doesn't specify `requiredVersion`".to_string(), - |required| format!("CfgPatch requires version {required}"), + || "CfgPatches entry doesn't specify `requiredVersion`".to_string(), + |required| format!("CfgPatches entry requires version {required}"), ), ), ));