mirror of
https://github.com/mgechev/revive.git
synced 2025-03-17 20:57:58 +02:00
parent
a4add4a769
commit
553604eace
@ -51,7 +51,7 @@ func (w lintEmptyLines) checkStart(block *ast.BlockStmt) {
|
||||
firstNode := block.List[0]
|
||||
firstStmt := w.position(firstNode.Pos())
|
||||
|
||||
firstBlockLineIsStmt := firstStmt.Line-(blockStart.Line+1) == 0
|
||||
firstBlockLineIsStmt := firstStmt.Line-(blockStart.Line+1) <= 0
|
||||
_, firstBlockLineIsComment := w.cmap[blockStart.Line+1]
|
||||
if firstBlockLineIsStmt || firstBlockLineIsComment {
|
||||
return
|
||||
@ -70,7 +70,7 @@ func (w lintEmptyLines) checkEnd(block *ast.BlockStmt) {
|
||||
lastNode := block.List[len(block.List)-1]
|
||||
lastStmt := w.position(lastNode.End())
|
||||
|
||||
lastBlockLineIsStmt := (blockEnd.Line-1)-lastStmt.Line == 0
|
||||
lastBlockLineIsStmt := (blockEnd.Line-1)-lastStmt.Line <= 0
|
||||
_, lastBlockLineIsComment := w.cmap[blockEnd.Line-1]
|
||||
if lastBlockLineIsStmt || lastBlockLineIsComment {
|
||||
return
|
||||
|
3
testdata/empty-lines.go
vendored
3
testdata/empty-lines.go
vendored
@ -168,3 +168,6 @@ func ShouldNotWarn() {
|
||||
|
||||
// comment
|
||||
}
|
||||
|
||||
// NR test for issue #739
|
||||
func NotWarnInSingleLineFunction() { println("foo") }
|
||||
|
Loading…
x
Reference in New Issue
Block a user