Fix wrongly reported errors when an unindented line is part of a comment.

This commit is contained in:
Amy Boyd
2016-06-24 22:05:39 +01:00
parent 014e48701c
commit 2af7d8d9c7
2 changed files with 4 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ func CheckIndentStyleRule(ruleValue string, line string) *LineCheckResult {
}
if strings.ToLower(ruleValue) == "tab" {
if IsIndentedWithSpaces(line) {
if IsIndentedWithSpaces(line) && !strings.HasPrefix(line, " *") {
return &LineCheckResult{isOk: false, messageIfNotOk: "starts with space instead of tab"}
} else if IsIndentedWithMixedTabsAndSpaces(line) && !IsIndentedWithTabsThenCommentLine(line) {
return &LineCheckResult{isOk: false, messageIfNotOk: "indented with mix of tabs and spaces instead of just tabs"}