Showing 58 of 157 total issues
File resource_list.go
has 1234 lines of code (exceeds 500 allowed). Consider refactoring. Open
// This file was automatically generated by genny.
// Any changes will be lost if this file is regenerated.
// see https://github.com/cheekybits/genny
package resource
Function createAddCommand
has 134 lines of code (exceeds 50 allowed). Consider refactoring. Open
func createAddCommand(app *cli.App) cli.Command {
return cli.Command{
Name: "add",
Aliases: []string{"a"},
Usage: "add a resource to the test suite",
Function ValidateContains
has 126 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
format.TruncatedDiff = false
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
Method Add.AddResource
has 110 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (a *Add) AddResource(fileName string, gossConfig GossConfig, resourceName, key string, config util.Config) error {
// Need to figure out a good way to refactor this
switch resourceName {
case "addr":
res, err := gossConfig.Addrs.AppendSysResource(key, a.Sys, config)
Function matcherToGomegaMatcher
has 99 lines of code (exceeds 50 allowed). Consider refactoring. Open
func matcherToGomegaMatcher(matcher interface{}) (types.GomegaMatcher, error) {
switch x := matcher.(type) {
case string, int, bool, float64:
return gomega.Equal(x), nil
case []interface{}:
Function matcherToGomegaMatcher
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func matcherToGomegaMatcher(matcher interface{}) (types.GomegaMatcher, error) {
switch x := matcher.(type) {
case string, int, bool, float64:
return gomega.Equal(x), nil
case []interface{}:
- 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 ValidateValue
has 80 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
format.TruncatedDiff = false
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
Method Add.AddResource
has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring. Open
func (a *Add) AddResource(fileName string, gossConfig GossConfig, resourceName, key string, config util.Config) error {
// Need to figure out a good way to refactor this
switch resourceName {
case "addr":
res, err := gossConfig.Addrs.AppendSysResource(key, a.Sys, config)
- 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 createValidateCommand
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func createValidateCommand(app *cli.App) cli.Command {
startTime := time.Now()
return cli.Command{
Name: "validate",
Method Add.AutoAddResource
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func (a *Add) AutoAddResource(fileName string, gossConfig GossConfig, key string) error {
// file
if strings.Contains(key, "/") {
if res, _, ok := gossConfig.Files.AppendSysResourceIfExists(key, a.Sys); ok == true {
a.resourcePrint(fileName, 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 matcherToGomegaMatcher
has 18 return statements (exceeds 4 allowed). Open
func matcherToGomegaMatcher(matcher interface{}) (types.GomegaMatcher, error) {
switch x := matcher.(type) {
case string, int, bool, float64:
return gomega.Equal(x), nil
case []interface{}:
Function createApp
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
func createApp() *cli.App {
app := cli.NewApp()
app.EnableBashCompletion = true
app.Version = version
app.Name = "goss"
Function createServeCommand
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func createServeCommand() cli.Command {
return cli.Command{
Name: "serve",
Aliases: []string{"s"},
Usage: "Serve a health endpoint",
Function validateHeader
has 61 lines of code (exceeds 50 allowed). Consider refactoring. Open
func validateHeader(res ResourceRead, property string, expectedHeaders map[string][]string, actualHeaders system.Header, 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
func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
format.TruncatedDiff = false
id := res.ID()
title := res.GetTitle()
meta := res.GetMeta()
- 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
func skipResult(typeS string, testType int, id string, title string, meta meta, property string, startTime time.Time) TestResult {
Method ServiceMap.UnmarshalJSON
has 7 return statements (exceeds 4 allowed). Open
func (ret *ServiceMap) UnmarshalJSON(data []byte) error {
// Curried json.Unmarshal
unmarshal := func(i interface{}) error {
if err := json.Unmarshal(data, i); err != nil {
return err
Method ResourceTypeMap.UnmarshalJSON
has 7 return statements (exceeds 4 allowed). Open
func (ret *ResourceTypeMap) UnmarshalJSON(data []byte) error {
// Curried json.Unmarshal
unmarshal := func(i interface{}) error {
if err := json.Unmarshal(data, i); err != nil {
return err
Method MatchingMap.UnmarshalJSON
has 7 return statements (exceeds 4 allowed). Open
func (ret *MatchingMap) UnmarshalJSON(data []byte) error {
// Curried json.Unmarshal
unmarshal := func(i interface{}) error {
if err := json.Unmarshal(data, i); err != nil {
return err
Method CommandMap.UnmarshalJSON
has 7 return statements (exceeds 4 allowed). Open
func (ret *CommandMap) UnmarshalJSON(data []byte) error {
// Curried json.Unmarshal
unmarshal := func(i interface{}) error {
if err := json.Unmarshal(data, i); err != nil {
return err