Skip to content

Commit

Permalink
Fix parsing maxAllowedComplexity (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
arendjr committed Nov 1, 2023
1 parent 8a5f279 commit a3ef0ef
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl VisitNode<JsonLanguage> for ComplexityOptions {
if name_text == "maxAllowedComplexity" {
if let Some(value) = value
.as_json_number_value()
.and_then(|number_value| u8::from_str(&number_value.syntax().to_string()).ok())
.and_then(|number_value| u8::from_str(&number_value.text()).ok())
// Don't allow 0 or no code would pass.
// And don't allow MAX_SCORE or we can't detect exceeding it.
.filter(|&number| number > 0 && number < MAX_SCORE)
Expand Down

0 comments on commit a3ef0ef

Please sign in to comment.