irobayna/stupidedi

View on GitHub

Showing 171 of 292 total issues

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 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 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

    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 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

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

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

                    def pretty_print(q)
                      q.text("FunctionalGroupDef")
                      q.group(2, "(", ")") do
                        q.breakable ""
                        @header_segment_uses.each do |e|
              Severity: Minor
              Found in lib/stupidedi/schema/functional_group_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 inspect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                          def inspect
                            id = definition.bind do |d|
                              "[#{"% 5s" % d.id}: #{d.name}]".bind do |s|
                                if usage.forbidden?
                                  ansi.forbidden(s)
              Severity: Minor
              Found in lib/stupidedi/versions/common/element_types/id.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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def read(reader, options = {})
                      limit    = options.fetch(:nondeterminism, 1)
                      machine  = self
                      reader_e = reader.read_segment
              
              
              Severity: Minor
              Found in lib/stupidedi/parser/generation.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 element has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def element(e, separators, out)
                      if e.simple?
                        out << e.to_x12
              
                      elsif e.composite?
              Severity: Minor
              Found in lib/stupidedi/writer/default.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 mkrepeated_tok has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def mkrepeated_tok(elements, element_use, designator, position)
                      element_toks = []
              
                      if element_use.composite?
                        elements.each do |e_tag, e_val, e_position|
              Severity: Minor
              Found in lib/stupidedi/parser/tokenization.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 binary_operators has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          def binary_operators(*ops)
                            file, line, = Stupidedi.caller
              
                            if ops.last.is_a?(Hash)
                              options = ops.pop
              Severity: Minor
              Found in lib/stupidedi/versions/common/element_types/operators.rb - About 1 hr to fix

                Method relational_operators has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            def relational_operators(*ops)
                              file, line, = Stupidedi.caller
                
                              if ops.last.is_a?(Hash)
                                options = ops.pop
                Severity: Minor
                Found in lib/stupidedi/versions/common/element_types/operators.rb - About 1 hr to fix

                  Method read_segment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def read_segment
                          consume_isa.flatmap do |rest|
                            # The character after "ISA" is defined to be the element separator
                            rest.read_character.flatmap do |char, aR|
                              separators = Separators.new(nil, nil, char, nil)
                  Severity: Minor
                  Found in lib/stupidedi/reader/stream_reader.rb - About 1 hr to fix

                    Method to_x12 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                def to_x12(truncate = true)
                                  remaining =
                                    if @value.to_i.zero?
                                      definition.max_length
                                    else
                    Severity: Minor
                    Found in lib/stupidedi/versions/common/element_types/r.rb - About 1 hr to fix

                      Method value has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                def value(object, usage, position)
                                  if object.is_a?(DateVal)
                                    object#.copy(:usage => usage, :position => position)
                                  elsif object.blank?
                                    self::Empty.new(usage, position)
                      Severity: Minor
                      Found in lib/stupidedi/versions/common/element_types/dt.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language