diff --git a/editorconfig/line_checkers.go b/editorconfig/line_checkers.go index b14848c..3f5143e 100644 --- a/editorconfig/line_checkers.go +++ b/editorconfig/line_checkers.go @@ -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"} diff --git a/editorconfig/line_checkers_test.go b/editorconfig/line_checkers_test.go index e08c607..1194365 100644 --- a/editorconfig/line_checkers_test.go +++ b/editorconfig/line_checkers_test.go @@ -46,7 +46,9 @@ func TestCheckIndentStyleRule(t *testing.T) { ExpectFail("\t ", "tab", f, t, "indented with mix of tabs and spaces instead of just tabs") // Allow comments like /**\n\t *\n\t */ - ExpectPass("\t *line", "tab", f, t) + ExpectPass("\t * comment 1", "tab", f, t) + ExpectPass("\t\t * comment 2", "tab", f, t) + ExpectPass(" * comment 3", "tab", f, t) ExpectFail(" line", "dinosaurs", f, t, "invalid value for indent_style: dinosaurs") }