-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
S1008: don't flag if both branches are commented
Only skip if both branches are documented; in cases where just one is commented it can just be: // Comment it. return [..] Closes: gh-704 Closes: gh-1488 Closes: gh-1556 [via git-merge-pr]
- Loading branch information
Showing
2 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package pkg | ||
|
||
func cmt1(x string) bool { | ||
// A | ||
if len(x) > 0 { | ||
return false | ||
} | ||
// B | ||
return true | ||
} | ||
|
||
func cmt2(x string) bool { | ||
if len(x) > 0 { // A | ||
return false | ||
} | ||
return true // B | ||
} | ||
|
||
func cmt3(x string) bool { | ||
if len(x) > 0 { | ||
return false // A | ||
} | ||
return true // B | ||
} | ||
|
||
func cmt4(x string) bool { | ||
if len(x) > 0 { | ||
return false // A | ||
} | ||
return true | ||
// B | ||
} | ||
|
||
// Hard to test, as the diag line adds a comment. | ||
//func cmt5(x string) bool { | ||
// if len(x) > 0 { // diag(`should use 'return len(x) == 0'`) | ||
// return false | ||
// } | ||
// return true // A | ||
//} | ||
|
||
func cmt6(x string) bool { | ||
if len(x) > 0 { //@ diag(`should use 'return len(x) == 0'`) | ||
return false // A | ||
} | ||
return true | ||
} |