diff --git a/src/linter/block_linter.go b/src/linter/block_linter.go index f3602814..e58df8cc 100644 --- a/src/linter/block_linter.go +++ b/src/linter/block_linter.go @@ -782,11 +782,11 @@ func checkNode(node ir.Node, b *blockLinter) { switch n := node.(type) { case *ir.ConstFetchExpr: if strings.EqualFold(n.Constant.Value, "true") || strings.EqualFold(n.Constant.Value, "false") { - b.report(node, LevelWarning, "DangerousCondition", "Potential dangerous bool value: you have constant bool value in condition") + b.report(node, LevelWarning, "dangerousCondition", "Potential dangerous bool value: you have constant bool value in condition") } case *ir.Lnumber: if n.Value == "0" || n.Value == "1" { - b.report(node, LevelWarning, "DangerousCondition", "Potential dangerous value: you have constant int value that interpreted as bool") + b.report(node, LevelWarning, "dangerousCondition", "Potential dangerous value: you have constant int value that interpreted as bool") } case *ir.BooleanOrExpr: checkNode(n.Left, b) diff --git a/src/linter/report.go b/src/linter/report.go index 04a51170..3dd0b8eb 100644 --- a/src/linter/report.go +++ b/src/linter/report.go @@ -1013,7 +1013,7 @@ function main(): void { }, { - Name: "DangerousCondition", + Name: "dangerousCondition", Default: true, Quickfix: false, Comment: "Report a dangerous condition", diff --git a/src/tests/golden/golden_test.go b/src/tests/golden/golden_test.go index 91fe4de9..106d7326 100644 --- a/src/tests/golden/golden_test.go +++ b/src/tests/golden/golden_test.go @@ -91,8 +91,33 @@ func TestGolden(t *testing.T) { Deps: []string{ `stubs/phpstorm-stubs/mbstring/mbstring.php`, }, - Disable: []string{ - "DangerousCondition", + }, + + { + Name: "parsedown", + Disable: []string{"missingPhpdoc", "arraySyntax"}, + Deps: []string{ + `stubs/phpstorm-stubs/pcre/pcre.php`, + `stubs/phpstorm-stubs/mbstring/mbstring.php`, + }, + }, + + { + Name: "underscore", + Disable: []string{"missingPhpdoc"}, + Deps: []string{ + `stubs/phpstorm-stubs/pcre/pcre.php`, + }, + }, + + { + Name: "phprocksyd", + Disable: []string{"missingPhpdoc", "dangerousCondition"}, + Deps: []string{ + `stubs/phpstorm-stubs/standard/basic.php`, + `stubs/phpstorm-stubs/pcntl/pcntl.php`, + `stubs/phpstorm-stubs/json/json.php`, + `stubs/phpstorm-stubs/posix/posix.php`, }, },