forked from go-toolset/pepperlint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.go
67 lines (57 loc) · 2.43 KB
/
rules.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package pepperlint
// Rules contain a set of all rule types that will be ran
// during visitation.
type Rules struct {
PackageRules PackageRules
FileRules FileRules
// Specifications
TypeSpecRules TypeSpecRules
ValueSpecRules ValueSpecRules
// Declarations
GenDeclRules GenDeclRules
FuncDeclRules FuncDeclRules
// Expressions
CallExprRules CallExprRules
BinaryExprRules BinaryExprRules
// Statements
AssignStmtRules AssignStmtRules
BlockStmtRules BlockStmtRules
ReturnStmtRules ReturnStmtRules
IncDecStmtRules IncDecStmtRules
RangeStmtRules RangeStmtRules
// Primitive Types
// Complex Types
StructTypeRules StructTypeRules
FieldRules FieldRules
FieldListRules FieldListRules
FuncTypeRules FuncTypeRules
InterfaceTypeRules InterfaceTypeRules
// Container Types
ArrayTypeRules ArrayTypeRules
ChanTypeRules ChanTypeRules
MapTypeRules MapTypeRules
}
// Merge will merge two rule sets together.
func (r *Rules) Merge(otherRules Rules) *Rules {
r.PackageRules = append(r.PackageRules, otherRules.PackageRules...)
r.FuncDeclRules = append(r.FuncDeclRules, otherRules.FuncDeclRules...)
r.GenDeclRules = append(r.GenDeclRules, otherRules.GenDeclRules...)
r.TypeSpecRules = append(r.TypeSpecRules, otherRules.TypeSpecRules...)
r.ValueSpecRules = append(r.ValueSpecRules, otherRules.ValueSpecRules...)
r.AssignStmtRules = append(r.AssignStmtRules, otherRules.AssignStmtRules...)
r.BlockStmtRules = append(r.BlockStmtRules, otherRules.BlockStmtRules...)
r.IncDecStmtRules = append(r.IncDecStmtRules, otherRules.IncDecStmtRules...)
r.RangeStmtRules = append(r.RangeStmtRules, otherRules.RangeStmtRules...)
r.StructTypeRules = append(r.StructTypeRules, otherRules.StructTypeRules...)
r.FieldRules = append(r.FieldRules, otherRules.FieldRules...)
r.FuncTypeRules = append(r.FuncTypeRules, otherRules.FuncTypeRules...)
r.InterfaceTypeRules = append(r.InterfaceTypeRules, otherRules.InterfaceTypeRules...)
r.ArrayTypeRules = append(r.ArrayTypeRules, otherRules.ArrayTypeRules...)
r.ChanTypeRules = append(r.ChanTypeRules, otherRules.ChanTypeRules...)
r.MapTypeRules = append(r.MapTypeRules, otherRules.MapTypeRules...)
r.CallExprRules = append(r.CallExprRules, otherRules.CallExprRules...)
r.BinaryExprRules = append(r.BinaryExprRules, otherRules.BinaryExprRules...)
r.ReturnStmtRules = append(r.ReturnStmtRules, otherRules.ReturnStmtRules...)
r.FileRules = append(r.FileRules, otherRules.FileRules...)
return r
}