kputnam/stupidedi

View on GitHub

Showing 171 of 292 total issues

Method next has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def next(count = 1)
        unless count > 0
          raise ArgumentError,
            "count must be positive"
        end
Severity: Minor
Found in lib/stupidedi/parser/navigation.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 lsequence has a Cognitive Complexity of 15 (exceeds 5 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

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 tsequence has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def tsequence(table_defs, offset = 0)
        instructions = []
        buffer       = []
        last         = nil

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 mksegment_tok has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def mksegment_tok(segment_dict, id, elements, position)
        id = id.to_sym
        element_toks = []

        unless segment_dict.defined_at?(id)
Severity: Minor
Found in lib/stupidedi/parser/tokenization.rb - About 1 hr to fix

    Method hipaa has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def hipaa(base = default)
          base.customize do |c|
            c.transaction_set.customize do |x|
              x.register("004010",       "HP", "835") { Stupidedi::TransactionSets::FortyTen::Standards::HP835 }
              x.register("004010X091A1", "HP", "835") { Stupidedi::TransactionSets::FortyTen::Implementations::X091A1::HP835 }
    Severity: Minor
    Found in lib/stupidedi/config.rb - About 1 hr to fix

      Method mod_element has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def mod_element(element_use, descriptor, requirement, name, arguments)
              unless requirement.is_a?(Schema::ElementReq)
                raise Exceptions::InvalidSchemaError,
                  "first argument to Element must be a Schema::ElementReq but got #{requirement.inspect} for #{descriptor}"
              end
      Severity: Minor
      Found in lib/stupidedi/transaction_sets/builder.rb - About 1 hr to fix

        Method build_distinct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_distinct(total, n, m, instructions)
                  if total.finite?
                    # The sum of all allowed value sets is finite, so we know that each
                    # individual allowed value set is finite (we can iterate over it).
                    map = Hash.new{|h,k| h[k] = [] }
        Severity: Minor
        Found in lib/stupidedi/parser/constraint_table.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_segment has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def read_segment
                consume_control_chars.flatmap do |start|
                  # We might start reading a segment at "\nNM1...", where the "\n" is on
                  # line 5, but "NM1" is on line 6. So to ensure the segment position is
                  # line 6, we start with consume_control_characters.
        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 build_disjoint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_disjoint(total, n, m, instructions)
                  if total.finite?
                    # The sum of all allowed value sets is finite, so we know that each
                    # individual allowed value set is finite (we can iterate over it).
                    map = Hash.new
        Severity: Minor
        Found in lib/stupidedi/parser/constraint_table.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 count has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def count(*args)
                if block_given?
                  inject(0){|n, e| yield(e) ? n + 1 : n }
                elsif args.empty?
                  size
        Severity: Minor
        Found in lib/ruby/array.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 consume_prefix has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def consume_prefix(s)
                return success(self) if s.empty?
        
                position = 0
                buffer   = ""
        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 between has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def between(other)
                # Collect ancestors of self, sorted oldest first (deepest last). This
                # forms a boundary of nodes, which is called a "spine" below
                zipper = self
                lspine = [self]
        Severity: Minor
        Found in lib/stupidedi/zipper/abstract_cursor.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 parent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def parent
                active = []
        
                @active.each do |zipper|
                  state = zipper
        Severity: Minor
        Found in lib/stupidedi/parser/navigation.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 basis has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def basis(instructions, mode)
                  @__basis[mode] ||= begin
                    # When inserting segments, given a choice between two otherwise
                    # equivalent instructions, prefer the one with smallest `pop_count`.
                    # For example, when inserting an HL*20 in X221 835, the new 2000A
        Severity: Minor
        Found in lib/stupidedi/parser/constraint_table.rb - About 1 hr to fix

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

            def process
              name = statement.parameters.first.jump(:symbol, :ident).source.slice(1..-1)
              args = statement.parameters.jump(:assoc)
              params = []
          
          
          Severity: Minor
          Found in build/doc/lib/meta-plugin/lib/yard-meta/handler.rb - About 1 hr to fix

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

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

              Method tsequence has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

                        def optional_elements(disjoint, instructions)
                          designators = []
                
                          disjoint.each do |(m, n), map|
                            required = true
                Severity: Minor
                Found in lib/stupidedi/transaction_sets/validation/ambiguity.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)
                        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

                Severity
                Category
                Status
                Source
                Language