1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00

fixes issue #98 (#99)

This commit is contained in:
SalvadorC
2019-01-18 16:33:40 +01:00
committed by Minko Gechev
parent b4cc152955
commit c878d3090d
2 changed files with 14 additions and 5 deletions

View File

@@ -127,7 +127,7 @@ type enableDisableConfig struct {
}
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)
@@ -199,11 +199,10 @@ func (f *File) disabledIntervals(rules []Rule) disabledIntervalsMap {
if len(parts) == 0 {
return
}
str := re.FindString(text)
ruleNamesString := strings.Split(text, str)
ruleNames := []string{}
if len(ruleNamesString) == 2 {
tempNames := strings.Split(ruleNamesString[1], ",")
if len(parts) > 4 {
tempNames := strings.Split(parts[4], ",")
for _, name := range tempNames {
name = strings.Trim(name, "\n")
if len(name) > 0 {