octolab/testit

View on GitHub

Showing 7 of 11 total issues

Function GoTestStackTrace has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
Open

func GoTestStackTrace(opts *stack.Opts, colored bool) Valve {
    const resetFG = ansi.DefaultFG + "\033[m"

    var pallete Palette
    if colored {
Severity: Minor
Found in internal/stream/panicparse.go - About 2 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

Function Golang has 70 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Golang() *cobra.Command {
    var (
        abspath bool
        colored bool
        stacked bool
Severity: Minor
Found in internal/cmd/go.go - About 1 hr to fix

    Function GoTestStackTrace has 63 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func GoTestStackTrace(opts *stack.Opts, colored bool) Valve {
        const resetFG = ansi.DefaultFG + "\033[m"
    
        var pallete Palette
        if colored {
    Severity: Minor
    Found in internal/stream/panicparse.go - About 1 hr to fix

      Method Palette.funcColor has 11 return statements (exceeds 4 allowed).
      Open

      func (p *Palette) funcColor(l stack.Location, main, exported bool) string {
          if main {
              return p.FuncMain
          }
          switch l {
      Severity: Major
      Found in internal/stream/panicparse.go - About 1 hr to fix

        Function processInner has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            out io.Writer,
            p *Palette,
            s stack.Similarity,
            pf pathFormat,
            c *stack.Snapshot,
        Severity: Minor
        Found in internal/stream/panicparse.go - About 45 mins to fix

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

          func compile() *cobra.Command {
              command := cobra.Command{
                  Use:   "compile",
                  Short: "make sure that all code is compiled",
                  Long:  "Make sure that all code is compiled.",
          Severity: Major
          Found in internal/cmd/go.go - About 35 mins to fix

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

            func Golang() *cobra.Command {
                var (
                    abspath bool
                    colored bool
                    stacked bool
            Severity: Major
            Found in internal/cmd/go.go - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language