resource/validate.go
Function ValidateContains
has 125 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
typ := reflect.TypeOf(res)
Function ValidateValue
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
typ := reflect.TypeOf(res)
Function ValidateContains
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
typ := reflect.TypeOf(res)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function skipResult
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func skipResult(typeS string, testType int, id string, title string, meta meta, property string, startTime time.Time) TestResult {
Function ValidateContains
has 6 return statements (exceeds 4 allowed). Open
Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
typ := reflect.TypeOf(res)
Function ValidateValue
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
Function ValidateContains
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
exported function ValidateContains should have comment or be unexported Open
Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
- Exclude checks
struct field ResourceId should be ResourceID Open
Open
ResourceId string `json:"resource-id" yaml:"resource-id"`
- Exclude checks
exported function ValidateValue should have comment or be unexported Open
Open
func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
- Exclude checks
exported type TestResult should have comment or be unexported Open
Open
type TestResult struct {
- Exclude checks
exported const SUCCESS should have comment (or a comment on this block) or be unexported Open
Open
SUCCESS = iota
- Exclude checks
exported const Value should have comment (or a comment on this block) or be unexported Open
Open
Value = iota
- Exclude checks