kputnam/stupidedi

View on GitHub

Showing 171 of 292 total issues

Method recurse has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

      def recurse(value, separators, out)
        return if value.invalid?

        if value.segment?
          segment(value, separators, out)
Severity: Minor
Found in lib/stupidedi/writer/default.rb - 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 to_x12 has a Cognitive Complexity of 19 (exceeds 5 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 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

File ambiguity.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Stupidedi
  using Refinements

  module TransactionSets
    module Validation
Severity: Minor
Found in lib/stupidedi/transaction_sets/validation/ambiguity.rb - About 2 hrs to fix

    Method read_segment_id has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

          def read_segment_id
            position = 0
            buffer   = ""
    
            while true
    Severity: Minor
    Found in lib/stupidedi/reader/token_reader.rb - 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 process has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def process
        return unless owner.is_a?(Hash)
        return unless owner[:describes]
    
        node = YARD::Registry.resolve(nil, owner[:describes], true)
    Severity: Minor
    Found in build/doc/lib/rspec-plugin/lib/yard-rspec/handler.rb - 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 segment! has a Cognitive Complexity of 18 (exceeds 5 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 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 build has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def build(node, out)
            if node.element?
              if node.composite?
                tmp = StringIO.new
                node.children.each{|e| build(e, tmp) }
    Severity: Major
    Found in lib/stupidedi/writer/claredi.rb - About 2 hrs to fix

      File an.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Stupidedi
        using Refinements
      
        module Versions
          module Common
      Severity: Minor
      Found in lib/stupidedi/versions/common/element_types/an.rb - About 2 hrs to fix

        Method Segment has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def Segment(position, segment_def, name, requirement, repeat_count, *elements)
                unless elements.length == segment_def.element_uses.length
                  raise Exceptions::InvalidSchemaError,
                    "segment #{segment_def.id} has #{segment_def.element_uses.length}" +
                    " elements but #{elements.length} arguments were given"
        Severity: Major
        Found in lib/stupidedi/transaction_sets/builder.rb - About 2 hrs to fix

          Method __filter? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                def __filter?(filter_tok, invalid_val)
                  return true unless filter_tok.id == invalid_val.id
          
                  children = invalid_val.segment_tok.element_toks
                  filter_tok.element_toks.zip(children) do |f_tok, e_tok|
          Severity: Minor
          Found in lib/stupidedi/parser/navigation.rb - 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 mod_element has a Cognitive Complexity of 16 (exceeds 5 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 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 filter? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                def filter?(filter_tok, segment_val)
                  return true unless filter_tok.id == segment_val.id
          
                  filter_tok.element_toks.zip(segment_val.children) do |f_tok, e_val|
                    if f_tok.simple?
          Severity: Minor
          Found in lib/stupidedi/parser/navigation.rb - 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 between has 52 lines of code (exceeds 25 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: Major
          Found in lib/stupidedi/zipper/abstract_cursor.rb - About 2 hrs to fix

            File tm.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Stupidedi
              using Refinements
            
              module Versions
                module Common
            Severity: Minor
            Found in lib/stupidedi/versions/common/element_types/tm.rb - About 2 hrs to fix

              Method matches has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def matches(segment_tok, strict, mode)
                        invalid = true  # Were all present possibly distinguishing elements invalid?
                        present = false # Were any possibly distinguishing elements present?
              
                        disjoint, distinct = basis(@instructions, mode)
              Severity: Minor
              Found in lib/stupidedi/parser/constraint_table.rb - About 1 hr to fix

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

                      def read_elements(segment_id, element_uses)
                        if element_uses.empty?
                          read_simple_element
                        else
                          element_use = element_uses.head
                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 process has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  def process
                    return unless owner.is_a?(Hash)
                    return unless owner[:source] and owner[:describes]
                
                    node = YARD::Registry.resolve(nil, owner[:describes], true)
                Severity: Minor
                Found in build/doc/lib/rspec-plugin/lib/yard-rspec/handler.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 process has a Cognitive Complexity of 15 (exceeds 5 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

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

                      def prev(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 sequence has a Cognitive Complexity of 15 (exceeds 5 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

                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