Add support for non-standard rule 'ignore'.
This commit is contained in:
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
* Add a fixer for the 'indent_style' rule.
|
* Add a fixer for the 'indent_style' rule.
|
||||||
|
|
||||||
* Add a non-standard rule to ignore directories.
|
|
||||||
|
|
||||||
* Optimize speed and memory usage.
|
* Optimize speed and memory usage.
|
||||||
|
|
||||||
* Document how to install.
|
* Document how to install.
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ func GetRulesToApplyToSourcePath(sourcePath string, cfs []ConfigFile) map[string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isIgnored, _ := rules["ignore"]; isIgnored == "true" {
|
||||||
|
return make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
delete(rules, "root")
|
delete(rules, "root")
|
||||||
|
|
||||||
if indentStyleValue, _ := rules["indent_style"]; indentStyleValue == "tab" {
|
if indentStyleValue, _ := rules["indent_style"]; indentStyleValue == "tab" {
|
||||||
|
|||||||
@@ -32,3 +32,16 @@ func TestGetRulesToApplyToSourcePathWhenNoRulesShouldApply(t *testing.T) {
|
|||||||
t.Error("No rules should be applied for the file")
|
t.Error("No rules should be applied for the file")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetRulesToApplyToSourcePathWhenPathShouldBeIgnored(t *testing.T) {
|
||||||
|
result := GetRulesToApplyToSourcePath(
|
||||||
|
"some-file-to-ignore.ignored",
|
||||||
|
[]ConfigFile{
|
||||||
|
CreateConfigFileStruct("tests/.editorconfig"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if len(result) != 0 {
|
||||||
|
t.Error("No rules should be applied for the file")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ trim_trailing_whitespace = false
|
|||||||
|
|
||||||
[**.go]
|
[**.go]
|
||||||
indent_style = tabs
|
indent_style = tabs
|
||||||
|
|
||||||
|
[**.ignored]
|
||||||
|
ignore = true
|
||||||
|
|||||||
Reference in New Issue
Block a user