Showing 3 of 3 total issues

Function parseToDoTitle has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
Open

func parseToDoTitle(line []rune) (ctype, title, author []rune) {
    if len(line) == 0 {
        return nil, nil, nil
    }

Severity: Minor
Found in pkg/tdglib/todogenerator.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 ToDoGenerator.Generate has 8 return statements (exceeds 4 allowed).
Open

func (td *ToDoGenerator) Generate() ([]*ToDoComment, error) {
    matchesCount := 0
    totalFiles := 0
    err := filepath.Walk(td.root, func(path string, info os.FileInfo, err error) error {
        if err != nil {
Severity: Major
Found in pkg/tdglib/todogenerator.go - About 50 mins to fix

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

    func parseEstimate(estimate string) (float64, error) {
        if len(estimate) == 0 {
            return 0, errCannotParseEstimate
        }
        var s string
    Severity: Major
    Found in pkg/tdglib/todogenerator.go - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language