Skip to content

Commit

Permalink
Review followup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-PH committed Oct 30, 2024
1 parent 7f3e6ce commit 932f6ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/problem/npv_170.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl fmt::Display for ByNamePackegPrefixedWithNumber {
} = self;
write!(
f,
r#"- {relative_package_dir}: Attribute `{package_name}` should not be number-prefixed. It is suggestet to `"`-wrap this name"#
"- {relative_package_dir}: Attribute `{package_name}` should not be number-prefixed. Prefix with `_`, or wrap in quotes"
)
}
}
6 changes: 1 addition & 5 deletions src/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,7 @@ fn check_package(
} else {
let package_name_valid = PACKAGE_NAME_REGEX.is_match(&package_name);
let result = if !package_name_valid {
if package_name
.chars()
.next()
.is_some_and(|c| c.is_ascii_digit())
{
if package_name.starts_with(|c: char| c.is_ascii_digit()) {
npv_170::ByNamePackegPrefixedWithNumber::new(
package_name.clone(),
relative_package_dir.clone(),
Expand Down
5 changes: 1 addition & 4 deletions tests/by-name-numprefix/pkgs/by-name/_1/10foo/package.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
{ someDrv }:
SomeDrv
# If we caused an actual Nix failure
# builtins.trace "This should be on stderr!" throw "This is an error!"
{ someDrv }: SomeDrv

0 comments on commit 932f6ef

Please sign in to comment.