Konstantin8105/f4go

View on GitHub
fortran/scan.go

Summary

Maintainability
F
1 wk
Test Coverage

Method scanner.postprocessor has a Cognitive Complexity of 145 (exceeds 20 allowed). Consider refactoring.
Open

func (s *scanner) postprocessor() {
    // from:
    // DIMENSION M(100), A(2)
    // to:
    // DIMENSION M(100)
Severity: Minor
Found in fortran/scan.go - About 2 days 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 scanner.scanNumbers has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring.
Open

func (s *scanner) scanNumbers() {
numb:
    var again bool
    for e := s.nodes.Front(); e != nil; e = e.Next() {
        if e.Value.(*node).tok != ftUndefine {
Severity: Minor
Found in fortran/scan.go - About 1 day 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 scanner.scanTokens has a Cognitive Complexity of 54 (exceeds 20 allowed). Consider refactoring.
Open

func (s *scanner) scanTokens() {
    entities := []struct {
        tok     token.Token
        pattern []string
    }{
Severity: Minor
Found in fortran/scan.go - About 5 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

File scan.go has 1045 lines of code (exceeds 1000 allowed). Consider refactoring.
Confirmed

package fortran

import (
    "bytes"
    "container/list"
Severity: Major
Found in fortran/scan.go - About 3 hrs to fix

    Method scanner.mergeLines has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) mergeLines() {
        if s.nodes.Len() < 2 {
            return
        }
    merge:
    Severity: Minor
    Found in fortran/scan.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

    Method scanner.scanStrings has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanStrings() {
    again:
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
                continue
    Severity: Minor
    Found in fortran/scan.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

    Method scanner.scanDoubleColon has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanDoubleColon() {
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if !(e.Value.(*node).tok == ftDoubleColon) {
                continue
            }
    Severity: Minor
    Found in fortran/scan.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

    Method scanner.scanNextComments has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanNextComments() {
    Op:
        var again bool
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
    Severity: Minor
    Found in fortran/scan.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

    Method scanner.scanEmpty has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
    Open

    func (s *scanner) scanEmpty() {
    empty:
        var again bool
        for e := s.nodes.Front(); e != nil; e = e.Next() {
            if e.Value.(*node).tok != ftUndefine {
    Severity: Minor
    Found in fortran/scan.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

    Method scanner.postprocessor has 256 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    func (s *scanner) postprocessor() {
        // from:
        // DIMENSION M(100), A(2)
        // to:
        // DIMENSION M(100)
    Severity: Major
    Found in fortran/scan.go - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if !isDigit(e.Value.(*node).b[en]) {
                              break
                          }
      Severity: Major
      Found in fortran/scan.go - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if e.Value.(*node).b[en] == '.' {
                                for en = en + 1; en < len(e.Value.(*node).b); en++ {
                                    if !isDigit(e.Value.(*node).b[en]) {
                                        break
                                    }
        Severity: Major
        Found in fortran/scan.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if en < len(e.Value.(*node).b) &&
                                  (isFloatLetter(e.Value.(*node).b[en])) {
                                  if en+1 < len(e.Value.(*node).b) &&
                                      (e.Value.(*node).b[en+1] == '+' || e.Value.(*node).b[en+1] == '-') {
                                      en++
          Severity: Major
          Found in fortran/scan.go - About 45 mins to fix

            Method scanner.scanTokensAfter has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
            Open

            func (s *scanner) scanTokensAfter() {
                entities := []struct {
                    tok     token.Token
                    pattern []string
                }{
            Severity: Minor
            Found in fortran/scan.go - About 45 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

            There are no issues that match your filters.

            Category
            Status