mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
@@ -2,5 +2,5 @@ package fixtures
|
||||
|
||||
func compliantFunc(a int, b int, c string) (x, y int, z string) // Must not match - compliant with rule
|
||||
|
||||
func nonCompliantFunc1(a int, b int, c string) (x int, y int, z string) { panic("implement me") } // MATCH /repeated return type can be omitted/
|
||||
func nonCompliantFunc1(a int, b int, c string) (x int, y int, z string) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/
|
||||
func nonCompliantFunc2(a, b int, c string) (x, y int, z string) { panic("implement me") } // MATCH /argument types should not be omitted/
|
||||
|
||||
@@ -3,4 +3,4 @@ package fixtures
|
||||
func compliantFunc(a, b int, c string) (x int, y int, z string) // Must not match - compliant with rule
|
||||
|
||||
func nonCompliantFunc1(a, b int, c string) (x, y int, z string) { panic("implement me") } // MATCH /return types should not be omitted/
|
||||
func nonCompliantFunc2(a int, b int, c string) (x int, y int, z string) { panic("implement me") } // MATCH /repeated argument type can be omitted/
|
||||
func nonCompliantFunc2(a int, b int, c string) (x int, y int, z string) { panic("implement me") } // MATCH /repeated argument type "int" can be omitted/
|
||||
|
||||
@@ -2,15 +2,15 @@ package fixtures
|
||||
|
||||
func compliantFunc(a, b int, c string) {} // Must not match - compliant with rule
|
||||
|
||||
func nonCompliantFunc1(a int, b int, c string) {} // MATCH /repeated argument type can be omitted/
|
||||
func nonCompliantFunc2(a int, b, c int) {} // MATCH /repeated argument type can be omitted/
|
||||
func nonCompliantFunc1(a int, b int, c string) {} // MATCH /repeated argument type "int" can be omitted/
|
||||
func nonCompliantFunc2(a int, b, c int) {} // MATCH /repeated argument type "int" can be omitted/
|
||||
|
||||
type myStruct struct{}
|
||||
|
||||
func (m myStruct) compliantMethod(a, b int, c string) {} // Must not match - compliant with rule
|
||||
|
||||
func (m myStruct) nonCompliantMethod1(a int, b int, c string) {} // MATCH /repeated argument type can be omitted/
|
||||
func (m myStruct) nonCompliantMethod2(a int, b, c int) {} // MATCH /repeated argument type can be omitted/
|
||||
func (m myStruct) nonCompliantMethod1(a int, b int, c string) {} // MATCH /repeated argument type "int" can be omitted/
|
||||
func (m myStruct) nonCompliantMethod2(a int, b, c int) {} // MATCH /repeated argument type "int" can be omitted/
|
||||
|
||||
func variadicFunction(a int, b ...int) {} // Must not match - variadic parameters are a special case
|
||||
|
||||
@@ -18,4 +18,4 @@ func singleArgFunction(a int) {} // Must not match - only one argument
|
||||
|
||||
func multiTypeArgs(a int, b string, c float64) {} // Must not match - different types for each argument
|
||||
|
||||
func mixedCompliance(a, b int, c int, d string) {} // MATCH /repeated argument type can be omitted/ - 'c int' could be combined with 'a, b int'
|
||||
func mixedCompliance(a, b int, c int, d string) {} // MATCH /repeated argument type "int" can be omitted/ - 'c int' could be combined with 'a, b int'
|
||||
|
||||
@@ -3,18 +3,18 @@ package fixtures
|
||||
func compliantFunc() (a, b int, c string) { panic("implement me") } // Must not match - compliant with rule
|
||||
func compliantFunc2() (int, int, string) // Must not match - compliant with rule
|
||||
|
||||
func nonCompliantFunc1() (a int, b int, c string) { panic("implement me") } // MATCH /repeated return type can be omitted/
|
||||
func nonCompliantFunc2() (a int, b, c int) { panic("implement me") } // MATCH /repeated return type can be omitted/
|
||||
func nonCompliantFunc1() (a int, b int, c string) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/
|
||||
func nonCompliantFunc2() (a int, b, c int) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/
|
||||
|
||||
type myStruct struct{}
|
||||
|
||||
func (m myStruct) compliantMethod() (a, b int, c string) { panic("implement me") } // Must not match - compliant with rule
|
||||
|
||||
func (m myStruct) nonCompliantMethod1() (a int, b int, c string) { panic("implement me") } // MATCH /repeated return type can be omitted/
|
||||
func (m myStruct) nonCompliantMethod2() (a int, b, c int) { panic("implement me") } // MATCH /repeated return type can be omitted/
|
||||
func (m myStruct) nonCompliantMethod1() (a int, b int, c string) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/
|
||||
func (m myStruct) nonCompliantMethod2() (a int, b, c int) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/
|
||||
|
||||
func singleArgFunction() (a int) { panic("implement me") } // Must not match - only one return
|
||||
|
||||
func multiTypeArgs() (a int, b string, c float64) { panic("implement me") } // Must not match - different types for each return
|
||||
|
||||
func mixedCompliance() (a, b int, c int, d string) { panic("implement me") } // MATCH /repeated return type can be omitted/ - 'c int' could be combined with 'a, b int'
|
||||
func mixedCompliance() (a, b int, c int, d string) { panic("implement me") } // MATCH /repeated return type "int" can be omitted/ - 'c int' could be combined with 'a, b int'
|
||||
|
||||
Reference in New Issue
Block a user