codeclimate/test-reporter

View on GitHub
formatters/lcovjson/lcovjson.go

Summary

Maintainability
B
5 hrs
Test Coverage

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 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 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

      exported method Formatter.Search should have comment or be unexported
      Open

      func (f *Formatter) Search(paths ...string) (string, error) {
      Severity: Minor
      Found in formatters/lcovjson/lcovjson.go by golint

      exported type Formatter should have comment or be unexported
      Open

      type Formatter struct {
      Severity: Minor
      Found in formatters/lcovjson/lcovjson.go by golint

      receiver name r should be consistent with previous receiver name f for Formatter
      Open

      func (r Formatter) Format() (formatters.Report, error) {
      Severity: Minor
      Found in formatters/lcovjson/lcovjson.go by golint

      var inputLcovJsonFile should be inputLcovJSONFile
      Open

          inputLcovJsonFile, err := os.Open(r.Path)
      Severity: Minor
      Found in formatters/lcovjson/lcovjson.go by golint

      exported method Formatter.Format should have comment or be unexported
      Open

      func (r Formatter) Format() (formatters.Report, error) {
      Severity: Minor
      Found in formatters/lcovjson/lcovjson.go by golint

      There are no issues that match your filters.

      Category
      Status