kputnam/stupidedi

View on GitHub

Showing 292 of 292 total issues

Method pretty_print has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_print(q)
        id = definition.bind do |d|
          "[#{d.id}: #{d.name}]".bind do |s|
            if usage.forbidden?
              ansi.forbidden(s)
Severity: Minor
Found in lib/stupidedi/values/composite_element_val.rb - 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 mksimple has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def mksimple(designator, element_use, element_tok)
        # We don't validate that element_tok is simple because the TokenReader
        # will always produce a SimpleElementTok given a SimpleElementUse from
        # the SegmentDef. On the other hand, the BuilderDsl API will throw an
        # exception if the programmer constructs the wrong kind of element
Severity: Minor
Found in lib/stupidedi/parser/states/abstract_state.rb - 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 pretty_print has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_print(q)
        q.text("LoopDef[#{@id}]")
        q.group(2, "(", ")") do
          q.breakable ""
          @header_segment_uses.each do |e|
Severity: Minor
Found in lib/stupidedi/schema/loop_def.rb - 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 read_simple_element has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def read_simple_element(repeatable = false)
        position = 0
        buffer   = ""

        while @input.defined_at?(position)
Severity: Minor
Found in lib/stupidedi/reader/token_reader.rb - 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 pretty_print has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_print(q)
        q.text("TableDef[#{@id}]")
        q.group(2, "(", ")") do
          q.breakable ""
          @header_segment_uses.each do |e|
Severity: Minor
Found in lib/stupidedi/schema/table_def.rb - 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 only has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def only(machine, depth=1)
  active = machine.active.map do |state|
    value = state.node.zipper

    _value = value; depth.times { _value = _value.up }
Severity: Minor
Found in notes/split.rb - About 1 hr to fix

    Method mksegments has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def mksegments(table)
              disjoint,   = table.basis(table.instructions, :insert)
              remaining   = Set.new(table.instructions)
              segment_id  = table.instructions.head.segment_use.id
              segments    = []
    Severity: Minor
    Found in lib/stupidedi/transaction_sets/validation/ambiguity.rb - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              q.group(2, "(", ")") do
                q.breakable ""
                @header_segment_uses.each do |e|
                  unless q.current_group.first?
                    q.text ","
      Severity: Major
      Found in lib/stupidedi/schema/interchange_def.rb and 1 other location - About 1 hr to fix
      lib/stupidedi/schema/functional_group_def.rb on lines 97..118

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 59.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              q.group(2, "(", ")") do
                q.breakable ""
                @header_segment_uses.each do |e|
                  unless q.current_group.first?
                    q.text ","
      Severity: Major
      Found in lib/stupidedi/schema/functional_group_def.rb and 1 other location - About 1 hr to fix
      lib/stupidedi/schema/interchange_def.rb on lines 76..97

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 59.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                class Empty < Valid
                  def value
                    nil
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/tm.rb and 3 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/dt.rb on lines 152..187
      lib/stupidedi/versions/common/element_types/nn.rb on lines 150..185
      lib/stupidedi/versions/common/element_types/r.rb on lines 147..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                class Empty < Valid
                  def value
                    nil
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/r.rb and 3 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/dt.rb on lines 152..187
      lib/stupidedi/versions/common/element_types/nn.rb on lines 150..185
      lib/stupidedi/versions/common/element_types/tm.rb on lines 133..168

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                class Empty < Valid
                  def value
                    nil
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/dt.rb and 3 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/nn.rb on lines 150..185
      lib/stupidedi/versions/common/element_types/r.rb on lines 147..182
      lib/stupidedi/versions/common/element_types/tm.rb on lines 133..168

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

                class Empty < Valid
                  def value
                    nil
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/nn.rb and 3 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/dt.rb on lines 152..187
      lib/stupidedi/versions/common/element_types/r.rb on lines 147..182
      lib/stupidedi/versions/common/element_types/tm.rb on lines 133..168

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                class Valid < TimeVal
                  def valid?
                    true
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/tm.rb and 2 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/dt.rb on lines 120..145
      lib/stupidedi/versions/common/element_types/nn.rb on lines 118..143

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                class Valid < DateVal
                  def valid?
                    true
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/dt.rb and 2 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/nn.rb on lines 118..143
      lib/stupidedi/versions/common/element_types/tm.rb on lines 105..130

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                class Valid < FixnumVal
                  def valid?
                    true
                  end
      
      
      Severity: Major
      Found in lib/stupidedi/versions/common/element_types/nn.rb and 2 other locations - About 1 hr to fix
      lib/stupidedi/versions/common/element_types/dt.rb on lines 120..145
      lib/stupidedi/versions/common/element_types/tm.rb on lines 105..130

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method process has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def process
          params = []
      
          if m = MATCH_A.match(statement.tokens.to_s)
            name = m.captures.first
      Severity: Minor
      Found in build/doc/lib/meta-plugin/lib/yard-meta/legacy.rb - About 1 hr to fix

        Method sequence has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def sequence(segment_uses, offset = 0)
                instructions = []
                buffer       = []
                last         = nil
        
        
        Severity: Minor
        Found in lib/stupidedi/parser/states/abstract_state.rb - About 1 hr to fix

          Method lsequence has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def lsequence(loop_defs, offset = 0)
                  instructions = []
                  buffer       = []
                  last         = nil
          
          
          Severity: Minor
          Found in lib/stupidedi/parser/states/abstract_state.rb - About 1 hr to fix

            Method segment! has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def segment!(name, position, *elements)
                    segment_tok     = mksegment_tok(@reader.segment_dict, name, elements, position)
                    machine, reader = @machine.insert(segment_tok, @strict, @reader)
            
                    if @strict
            Severity: Minor
            Found in lib/stupidedi/parser/builder_dsl.rb - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language