codeclimate/test-reporter

View on GitHub

Showing 144 of 144 total issues

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

                    Method Formatter.Format has 5 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/lcovjson/lcovjson.go - About 35 mins to fix

                      Method CoverageFormatter.Save has 5 return statements (exceeds 4 allowed).
                      Open

                      func (f CoverageFormatter) Save() error {
                          rep, err := f.In.Format()
                          if err != nil {
                              return errors.WithStack(err)
                          }
                      Severity: Major
                      Found in cmd/format-coverage.go - About 35 mins to fix

                        Method Formatter.Format has 5 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/xccov/xccov.go - About 35 mins to fix

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

                          func legacyFormat(r Formatter, rep formatters.Report) (formatters.Report, error) {
                                  logrus.Debugf("Analyzing simplecov json output from legacy 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/legacy_formatter.go - About 35 mins to fix

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

                            func (r Formatter) Format() (formatters.Report, error) {
                                sourcePaths := getSourcePaths()
                            
                                rep, err := formatters.NewReport()
                                if err != nil {
                            Severity: Major
                            Found in formatters/jacoco/jacoco.go - About 35 mins to fix

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                              func (coberturaFile xmlFile) getFullFilePath(filename string) string {
                                  fullFilePath := filename
                              
                                  for _, source := range coberturaFile.Sources {
                                      filepath := fmt.Sprintf("%s/%s", source.Path, filename)
                              Severity: Minor
                              Found in formatters/cobertura/xml.go and 1 other location - About 30 mins to fix
                              formatters/coveragepy/xml.go on lines 28..39

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 102.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                              func (covpyFile xmlFile) getFullFilePath(filename string) string {
                                  fullFilePath := filename
                              
                                  for _, source := range covpyFile.Sources {
                                      filepath := fmt.Sprintf("%s/%s", source.Path, filename)
                              Severity: Minor
                              Found in formatters/coveragepy/xml.go and 1 other location - About 30 mins to fix
                              formatters/cobertura/xml.go on lines 40..51

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 102.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Method Formatter.Format has a Cognitive Complexity of 21 (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/gocov/gocov.go - About 25 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

                              Your code does not pass gofmt in 3 places. Go fmt your code!
                              Open

                              package lcovjson
                              Severity: Minor
                              Found in formatters/lcovjson/json_input.go by gofmt

                              Your code does not pass gofmt in 2 places. Go fmt your code!
                              Open

                              package gcov
                              Severity: Minor
                              Found in formatters/gcov/gcov.go by gofmt

                              exported type CoverageFormatter should have comment or be unexported
                              Open

                              type CoverageFormatter struct {
                              Severity: Minor
                              Found in cmd/format-coverage.go by golint
                              Severity
                              Category
                              Status
                              Source
                              Language