mirror of
https://github.com/mgechev/revive.git
synced 2025-07-13 01:00:17 +02:00
Add new rule
This commit is contained in:
@ -56,7 +56,7 @@ var rules = []lint.Rule{
|
||||
&rule.ContextArgumentsRule{},
|
||||
}
|
||||
|
||||
func TestVarDeclaration(t *testing.T) {
|
||||
func TestCyclomatic(t *testing.T) {
|
||||
testRule(t, "cyclomatic", &rule.CyclomaticRule{}, &lint.RuleConfig{
|
||||
Arguments: []interface{}{int64(1)},
|
||||
})
|
||||
@ -65,6 +65,12 @@ func TestVarDeclaration(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestMaxPublicStructs(t *testing.T) {
|
||||
testRule(t, "max-public-structs", &rule.MaxPublicStructsRule{}, &lint.RuleConfig{
|
||||
Arguments: []interface{}{int64(1)},
|
||||
})
|
||||
}
|
||||
|
||||
func testRule(t *testing.T, filename string, rule lint.Rule, config ...*lint.RuleConfig) {
|
||||
baseDir := "../fixtures/"
|
||||
filename = filename + ".go"
|
||||
@ -94,8 +100,9 @@ func TestAll(t *testing.T) {
|
||||
baseDir := "../fixtures/"
|
||||
|
||||
ignoreFiles := map[string]bool{
|
||||
"cyclomatic.go": true,
|
||||
"cyclomatic-2.go": true,
|
||||
"cyclomatic.go": true,
|
||||
"cyclomatic-2.go": true,
|
||||
"max-public-structs.go": true,
|
||||
}
|
||||
|
||||
rx, err := regexp.Compile(*lintMatch)
|
||||
|
Reference in New Issue
Block a user