Fantom-foundation/go-lachesis

View on GitHub
inter/ascii_scheme.go

Summary

Maintainability
F
5 days
Test Coverage

Function ASCIIschemeForEach has a Cognitive Complexity of 93 (exceeds 20 allowed). Consider refactoring.
Open

func ASCIIschemeForEach(
    scheme string,
    callback ForEachEvent,
) (
    nodes []idx.StakerID,
Severity: Minor
Found in inter/ascii_scheme.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 rows.Optimize has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring.
Open

func (rr *rows) Optimize() {

    for curr, row := range rr.rows {
    REFS:
        for iRef, ref := range row.Refs {
Severity: Minor
Found in inter/ascii_scheme.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 rows.String has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
Open

func (rr *rows) String() string {
    var (
        res strings.Builder
        out = func(s string) {
            _, err := res.WriteString(s)
Severity: Minor
Found in inter/ascii_scheme.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

Function DAGtoASCIIscheme has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
Open

func DAGtoASCIIscheme(events Events) (string, error) {
    events = events.ByParents()

    var (
        scheme rows
Severity: Minor
Found in inter/ascii_scheme.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

Function ASCIIschemeForEach has 152 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func ASCIIschemeForEach(
    scheme string,
    callback ForEachEvent,
) (
    nodes []idx.StakerID,
Severity: Major
Found in inter/ascii_scheme.go - About 5 hrs to fix

    Method rows.String has 87 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (rr *rows) String() string {
        var (
            res strings.Builder
            out = func(s string) {
                _, err := res.WriteString(s)
    Severity: Major
    Found in inter/ascii_scheme.go - About 2 hrs to fix

      Function DAGtoASCIIscheme has 84 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func DAGtoASCIIscheme(events Events) (string, error) {
          events = events.ByParents()
      
          var (
              scheme rows
      Severity: Major
      Found in inter/ascii_scheme.go - About 2 hrs to fix

        Method rows.Optimize has 62 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (rr *rows) Optimize() {
        
            for curr, row := range rr.rows {
            REFS:
                for iRef, ref := range row.Refs {
        Severity: Minor
        Found in inter/ascii_scheme.go - About 1 hr to fix

          Method row.Position has 8 return statements (exceeds 4 allowed).
          Open

          func (r *row) Position(i int) position {
              // if left
              if i < r.Self {
                  if i < r.First {
                      return none
          Severity: Major
          Found in inter/ascii_scheme.go - About 50 mins to fix

            There are no issues that match your filters.

            Category
            Status