Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidanio committed Mar 4, 2024
1 parent 018f3fc commit 4fa5cf4
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/linter/block_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1538,22 +1538,24 @@ func (b *blockLinter) metaInfo() *meta.Info {

func (b *blockLinter) checkDeclareStrictTypes(statement *ir.DeclareStmt) {
for _, i := range statement.Consts {
switch node := i.(type) {
case *ir.ConstantStmt:
if node.ConstantName.Value != "strict_types" {
return
}
value, ok := node.Expr.(*ir.Lnumber)
if !ok {
return
}
node, ok := i.(*ir.ConstantStmt)
if !ok {
return
}

if value.Value == "1" {
return
}
if node.ConstantName.Value != "strict_types" {
return
}
value, isNumber := node.Expr.(*ir.Lnumber)
if !isNumber {
return
}

b.report(statement, LevelError, "notStrictTypes", "strict_types value is not 1")
b.walker.r.addQuickFix("notStrictTypes", b.quickfix.StrictTypes(value))
if value.Value == "1" {
return
}

b.report(statement, LevelError, "notStrictTypes", "strict_types value is not 1")
b.walker.r.addQuickFix("notStrictTypes", b.quickfix.StrictTypes(value))
}
}

0 comments on commit 4fa5cf4

Please sign in to comment.