Skip to content

Commit baf3514

Browse files
ashragrawalclaude
andcommitted
Fix snake_case detection to accept single-word lowercase identifiers
DetectCasing's snake_case regex required at least one underscore, so single-word lowercase names like `currency` fell into a separate "lowercase" bucket. When a tool had params like `origin_country, hs_code, currency`, the deterministic pn_consistent_casing check produced the false positive "Parameter 'currency' uses lowercase but other params use snake_case." Use `*` (zero-or-more underscores) so single-word lowercase names classify as snake_case. The "lowercase" branch becomes unreachable and is removed. The tool-name casing regex at line 172 already used this form; this brings DetectCasing into agreement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f5d5d1e commit baf3514

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/Microsoft.Agents.A365.DevTools.Cli/Services/Evaluate/ChecklistGenerator.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,9 @@ private static string DetectCasing(string name)
10481048
return "empty";
10491049
}
10501050

1051-
if (Regex.IsMatch(name, @"^[a-z][a-z0-9]*(_[a-z0-9]+)+$"))
1051+
// Single-word lowercase identifiers (e.g. "currency") are valid snake_case
1052+
// by formal definition; `*` (zero-or-more underscores) is correct, not `+`.
1053+
if (Regex.IsMatch(name, @"^[a-z][a-z0-9]*(_[a-z0-9]+)*$"))
10521054
{
10531055
return "snake_case";
10541056
}
@@ -1068,11 +1070,6 @@ private static string DetectCasing(string name)
10681070
return "PascalCase";
10691071
}
10701072

1071-
if (Regex.IsMatch(name, @"^[a-z][a-z0-9]*$"))
1072-
{
1073-
return "lowercase";
1074-
}
1075-
10761073
return "mixed";
10771074
}
10781075

0 commit comments

Comments
 (0)