pedroMMM/goss

View on GitHub
resource/validate.go

Summary

Maintainability
C
1 day
Test Coverage

Function ValidateContains has 125 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 {
    id := res.ID()
    title := res.GetTitle()
    meta := res.GetMeta()
    typ := reflect.TypeOf(res)
Severity: Major
Found in resource/validate.go - About 4 hrs to fix

    Function ValidateValue has 79 lines of code (exceeds 50 allowed). Consider refactoring.
    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)
    Severity: Major
    Found in resource/validate.go - About 2 hrs to fix

      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 {
          id := res.ID()
          title := res.GetTitle()
          meta := res.GetMeta()
          typ := reflect.TypeOf(res)
      Severity: Minor
      Found in resource/validate.go - About 1 hr to fix

      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 {
      Severity: Major
      Found in resource/validate.go - About 50 mins to fix

        Function ValidateContains has 6 return statements (exceeds 4 allowed).
        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)
        Severity: Major
        Found in resource/validate.go - About 40 mins to fix

          Function ValidateValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
          Severity: Minor
          Found in resource/validate.go - About 35 mins to fix

            Function ValidateContains has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
            Severity: Minor
            Found in resource/validate.go - About 35 mins to fix

              exported function ValidateContains should have comment or be unexported
              Open

              func ValidateContains(res ResourceRead, property string, expectedValues []string, method func() (io.Reader, error), skip bool) TestResult {
              Severity: Minor
              Found in resource/validate.go by golint

              struct field ResourceId should be ResourceID
              Open

                  ResourceId   string        `json:"resource-id" yaml:"resource-id"`
              Severity: Minor
              Found in resource/validate.go by golint

              exported function ValidateValue should have comment or be unexported
              Open

              func ValidateValue(res ResourceRead, property string, expectedValue interface{}, actual interface{}, skip bool) TestResult {
              Severity: Minor
              Found in resource/validate.go by golint

              exported type TestResult should have comment or be unexported
              Open

              type TestResult struct {
              Severity: Minor
              Found in resource/validate.go by golint

              exported const SUCCESS should have comment (or a comment on this block) or be unexported
              Open

                  SUCCESS = iota
              Severity: Minor
              Found in resource/validate.go by golint

              exported const Value should have comment (or a comment on this block) or be unexported
              Open

                  Value = iota
              Severity: Minor
              Found in resource/validate.go by golint

              There are no issues that match your filters.

              Category
              Status