mirror of
https://github.com/mgechev/revive.git
synced 2025-11-25 22:12:38 +02:00
@@ -5,3 +5,13 @@ import "fmt"
|
|||||||
func foo(a, b int) {
|
func foo(a, b int) {
|
||||||
fmt.Printf("single line characters out of limit") // MATCH /line is 105 characters, out of limit 100/
|
fmt.Printf("single line characters out of limit") // MATCH /line is 105 characters, out of limit 100/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// revive:disable-next-line:line-length-limit
|
||||||
|
// The length of this comment line is over 80 characters, this is bad for readability.
|
||||||
|
|
||||||
|
// Warn: the testing framework does not allow to check for failures in comments
|
||||||
|
|
||||||
|
func toto() {
|
||||||
|
// revive:disable-next-line:line-length-limit
|
||||||
|
fmt.Println("This line is way too long. In my opinion, it should be shortened.")
|
||||||
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ type enableDisableConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) disabledIntervals(rules []Rule) disabledIntervalsMap {
|
func (f *File) disabledIntervals(rules []Rule) disabledIntervalsMap {
|
||||||
re := regexp.MustCompile(`^\s*revive:(enable|disable)(?:-(line|next-line))?(:|\s|$)`)
|
re := regexp.MustCompile(`^\s*revive:(enable|disable)(?:-(line|next-line))?(:)?([^\s]*)?(\s|$)`)
|
||||||
|
|
||||||
enabledDisabledRulesMap := make(map[string][]enableDisableConfig)
|
enabledDisabledRulesMap := make(map[string][]enableDisableConfig)
|
||||||
|
|
||||||
@@ -199,11 +199,10 @@ func (f *File) disabledIntervals(rules []Rule) disabledIntervalsMap {
|
|||||||
if len(parts) == 0 {
|
if len(parts) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
str := re.FindString(text)
|
|
||||||
ruleNamesString := strings.Split(text, str)
|
|
||||||
ruleNames := []string{}
|
ruleNames := []string{}
|
||||||
if len(ruleNamesString) == 2 {
|
if len(parts) > 4 {
|
||||||
tempNames := strings.Split(ruleNamesString[1], ",")
|
tempNames := strings.Split(parts[4], ",")
|
||||||
for _, name := range tempNames {
|
for _, name := range tempNames {
|
||||||
name = strings.Trim(name, "\n")
|
name = strings.Trim(name, "\n")
|
||||||
if len(name) > 0 {
|
if len(name) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user