Skip to content

Commit e65b392

Browse files
committed
S1008: allow either branch to be documented
Updates: gh-704 Updates: gh-1488
1 parent de48f96 commit e65b392

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: simple/s1008/s1008.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ func run(pass *analysis.Pass) (any, error) {
107107
return false
108108
}
109109

110-
// Don't flag if both are commented.
111-
if hasComments(n1) && hasComments(n2) {
110+
// Don't flag if either branch is commented
111+
if hasComments(n1) || hasComments(n2) {
112112
return
113113
}
114114

Diff for: simple/s1008/testdata/go1.0/CheckIfReturn/comment.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ func cmt4(x string) bool {
3232
}
3333

3434
func cmt5(x string) bool {
35-
if len(x) > 0 { //@ diag(`should use 'return len(x) == 0'`)
35+
if len(x) > 0 {
3636
return false
3737
}
3838
return true // A
3939
}
4040

4141
func cmt6(x string) bool {
42-
if len(x) > 0 { //@ diag(`should use 'return len(x) == 0'`)
42+
if len(x) > 0 {
4343
return false // A
4444
}
4545
return true

0 commit comments

Comments
 (0)