vorteil/direktiv

View on GitHub
pkg/jqer/jqer.go

Summary

Maintainability
D
1 day
Test Coverage

Function recurseIntoString has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
Open

func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
    out := make([]interface{}, 0)

    if TrimWhitespaceOnQueryStrings {
        s = strings.TrimSpace(s)
Severity: Minor
Found in pkg/jqer/jqer.go - About 4 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 recurseIntoString has 95 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
    out := make([]interface{}, 0)

    if TrimWhitespaceOnQueryStrings {
        s = strings.TrimSpace(s)
Severity: Major
Found in pkg/jqer/jqer.go - About 2 hrs to fix

    Function JqState has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func JqState(l *lexer.L) lexer.StateFunc {
        src := make([]string, 3)
        var jdxJ int
    
        mover := func(rewind int, forward bool) {
    Severity: Minor
    Found in pkg/jqer/jqer.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 JqState has 65 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func JqState(l *lexer.L) lexer.StateFunc {
        src := make([]string, 3)
        var jdxJ int
    
        mover := func(rewind int, forward bool) {
    Severity: Minor
    Found in pkg/jqer/jqer.go - About 1 hr to fix

      Function recurseIntoString has 14 return statements (exceeds 4 allowed).
      Open

      func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
          out := make([]interface{}, 0)
      
          if TrimWhitespaceOnQueryStrings {
              s = strings.TrimSpace(s)
      Severity: Major
      Found in pkg/jqer/jqer.go - About 1 hr to fix

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

        func jq(input interface{}, command string) ([]interface{}, error) {
            data, err := json.Marshal(input)
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in pkg/jqer/jqer.go - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status