diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:01 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:08 +0900 |
| commit | 5e31fa33c3b5cf726a57a063b8e7a070869250fe (patch) | |
| tree | 98522466966fa7df483cad174ab5fc03db39bc09 /crates/shirabe/src/util/config_validator.rs | |
| parent | c839244d8d09f3036ebfee8eef7eb6b147e593ab (diff) | |
| download | php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.gz php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.zst php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.zip | |
fix(compile): fix more random compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/config_validator.rs')
| -rw-r--r-- | crates/shirabe/src/util/config_validator.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/shirabe/src/util/config_validator.rs b/crates/shirabe/src/util/config_validator.rs index 972191a..66fcadb 100644 --- a/crates/shirabe/src/util/config_validator.rs +++ b/crates/shirabe/src/util/config_validator.rs @@ -127,13 +127,17 @@ impl ConfigValidator { let spdx_license = license_validator.get_license_by_identifier(license); if let Some(spdx_license) = spdx_license { if spdx_license[3] { - if Preg::is_match(r"{^[AL]?GPL-[123](\.[01])?\+$}i", license) { + if Preg::is_match(r"{^[AL]?GPL-[123](\.[01])?\+$}i", license) + .unwrap_or(false) + { warnings.push(format!( "License \"{}\" is a deprecated SPDX license identifier, use \"{}-or-later\" instead", license, license.replace('+', "") )); - } else if Preg::is_match(r"{^[AL]?GPL-[123](\.[01])?$}i", license) { + } else if Preg::is_match(r"{^[AL]?GPL-[123](\.[01])?$}i", license) + .unwrap_or(false) + { warnings.push(format!( "License \"{}\" is a deprecated SPDX license identifier, use \"{}-only\" or \"{}-or-later\" instead", license, license, license @@ -154,7 +158,7 @@ impl ConfigValidator { } if let Some(PhpMixed::String(name)) = manifest.get("name") { - if !name.is_empty() && Preg::is_match(r"{[A-Z]}", name) { + if !name.is_empty() && Preg::is_match(r"{[A-Z]}", name).unwrap_or(false) { let suggest_name = Preg::replace( r"{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}", r"\1\3-\2\4", @@ -230,7 +234,7 @@ impl ConfigValidator { packages.extend(require_dev); for (package, version) in &packages { if let PhpMixed::String(version_str) = version.as_ref() { - if Preg::is_match(r"{#}", version_str) { + if Preg::is_match(r"{#}", version_str).unwrap_or(false) { warnings.push(format!( "The package \"{}\" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.", package |
