codeclimate/test-reporter

View on GitHub

Showing 26 of 144 total issues

Method Formatter.Format has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
Open

func (r Formatter) Format() (formatters.Report, error) {
    report, err := formatters.NewReport()
    if err != nil {
        return report, err
    }
Severity: Minor
Found in formatters/lcovjson/lcovjson.go - About 3 hrs 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

Method Formatter.Format has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
Open

func (r Formatter) Format() (formatters.Report, error) {
    rep, err := formatters.NewReport()
    if err != nil {
        return rep, err
    }
Severity: Minor
Found in formatters/cobertura/cobertura.go - About 3 hrs 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

Method Formatter.Format has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
Open

func (r Formatter) Format() (formatters.Report, error) {
    report, err := formatters.NewReport()
    if err != nil {
        return report, err
    }
Severity: Minor
Found in formatters/xccov/xccov.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

Method Formatter.Format has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (r Formatter) Format() (formatters.Report, error) {
    rep, err := formatters.NewReport()
    if err != nil {
        return rep, err
    }
Severity: Minor
Found in formatters/cobertura/cobertura.go - About 1 hr to fix

    Method Formatter.Format has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
    Open

    func (r Formatter) Format() (formatters.Report, error) {
        sourcePaths := getSourcePaths()
    
        rep, err := formatters.NewReport()
        if err != nil {
    Severity: Minor
    Found in formatters/jacoco/jacoco.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

    Method Formatter.Format has 56 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (r Formatter) Format() (formatters.Report, error) {
        report, err := formatters.NewReport()
        if err != nil {
            return report, err
        }
    Severity: Minor
    Found in formatters/lcovjson/lcovjson.go - About 1 hr to fix

      Method region.UnmarshalJSON has 10 return statements (exceeds 4 allowed).
      Open

      func (region *region) UnmarshalJSON(data []byte) error {
          var array []interface{}
          if err := json.Unmarshal(data, &array); err != nil {
              return err
          }
      Severity: Major
      Found in formatters/lcovjson/json_input.go - About 1 hr to fix

        Method Formatter.Format has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
        Open

        func (r Formatter) Format() (formatters.Report, error) {
            rep, err := formatters.NewReport()
            if err != nil {
                return rep, err
            }
        Severity: Minor
        Found in formatters/lcov/lcov.go - About 55 mins 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

        Method Uploader.doRequest has 7 return statements (exceeds 4 allowed).
        Open

        func (u Uploader) doRequest(in io.Reader, url string) (*http.Response, error) {
            c := http.Client{
                Transport: u.newTransport(),
                Timeout:   30 * time.Second,
            }
        Severity: Major
        Found in upload/uploader.go - About 45 mins to fix

          Method segment.UnmarshalJSON has 7 return statements (exceeds 4 allowed).
          Open

          func (segment *segment) UnmarshalJSON(data []byte) error {
              var array []interface{}
              if err := json.Unmarshal(data, &array); err != nil {
                  return err
              }
          Severity: Major
          Found in formatters/lcovjson/json_input.go - About 45 mins to fix

            Method Uploader.Upload has 7 return statements (exceeds 4 allowed).
            Open

            func (u Uploader) Upload() error {
                if u.ReporterID == "" {
                    return errors.New("you must supply a CC_TEST_REPORTER_ID ENV variable or pass it via the -r flag")
                }
            
            
            Severity: Major
            Found in upload/uploader.go - About 45 mins to fix

              Method Formatter.Format has 7 return statements (exceeds 4 allowed).
              Open

              func (r Formatter) Format() (formatters.Report, error) {
                  rep, err := formatters.NewReport()
                  if err != nil {
                      return rep, err
                  }
              Severity: Major
              Found in formatters/lcov/lcov.go - About 45 mins to fix

                Method Formatter.Format has 6 return statements (exceeds 4 allowed).
                Open

                func (r Formatter) Format() (formatters.Report, error) {
                    rep, err := formatters.NewReport()
                    if err != nil {
                        return rep, err
                    }
                Severity: Major
                Found in formatters/clover/clover.go - About 40 mins to fix

                  Method Formatter.Format has 6 return statements (exceeds 4 allowed).
                  Open

                  func (r *Formatter) Format() (formatters.Report, error) {
                      rep, err := formatters.NewReport()
                      if err != nil {
                          return rep, err
                      }
                  Severity: Major
                  Found in formatters/coveragepy/coveragepy.go - About 40 mins to fix

                    Method Formatter.Format has 6 return statements (exceeds 4 allowed).
                    Open

                    func (r Formatter) Format() (formatters.Report, error) {
                        report, err := formatters.NewReport()
                        if err != nil {
                            return report, err
                        }
                    Severity: Major
                    Found in formatters/excoveralls/excoveralls.go - About 40 mins to fix

                      Function jsonFormat has 6 return statements (exceeds 4 allowed).
                      Open

                      func jsonFormat(r Formatter, rep formatters.Report) (formatters.Report, error) {
                          logrus.Debugf("Analyzing simplecov json output from latest format %s", r.Path)
                          jf, err := os.Open(r.Path)
                          if err != nil {
                              return rep, errors.WithStack(errors.Errorf("could not open coverage file %s", r.Path))
                      Severity: Major
                      Found in formatters/simplecov/json_formatter.go - About 40 mins to fix

                        Method Formatter.Format has 6 return statements (exceeds 4 allowed).
                        Open

                        func (r Formatter) Format() (formatters.Report, error) {
                            rep, err := formatters.NewReport()
                            if err != nil {
                                return rep, err
                            }
                        Severity: Major
                        Found in formatters/cobertura/cobertura.go - About 40 mins to fix

                          Function findGitInfo has 5 return statements (exceeds 4 allowed).
                          Open

                          func findGitInfo() (Git, error) {
                              g := Git{}
                              var err error
                          
                              g.Branch = findVar(gitBranchVars)
                          Severity: Major
                          Found in env/git.go - About 35 mins to fix

                            Function parseSourceFile has 5 return statements (exceeds 4 allowed).
                            Open

                            func parseSourceFile(fileName string, gitHead *object.Commit) (formatters.SourceFile, error) {
                                var sf formatters.SourceFile
                                sourceFileName, err := getSourceFileName(fileName)
                                if err != nil {
                                    return sf, errors.WithStack(err)
                            Severity: Major
                            Found in formatters/gcov/gcov.go - About 35 mins to fix

                              Method Formatter.Format has 5 return statements (exceeds 4 allowed).
                              Open

                              func (r Formatter) Format() (formatters.Report, error) {
                                  rep, err := formatters.NewReport()
                                  if err != nil {
                                      return rep, err
                                  }
                              Severity: Major
                              Found in formatters/gocov/gocov.go - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language