Skip to content

Commit

Permalink
config: cfgpatches checks are now case insensitive (#792)
Browse files Browse the repository at this point in the history
* config: cfgpatches checks are now case insensitive

* fix requiredVersion
  • Loading branch information
BrettMayson authored Oct 18, 2024
1 parent 015cbf5 commit 69bf2cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libs/config/src/model/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ..
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions libs/sqf/src/analyze/lints/s01_command_required_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"),
),
),
));
Expand Down
4 changes: 2 additions & 2 deletions libs/sqf/src/analyze/lints/s02_event_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"),
),
),
));
Expand Down

0 comments on commit 69bf2cc

Please sign in to comment.