irobayna/stupidedi

View on GitHub

Showing 171 of 292 total issues

Method read_segment_id has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def read_segment_id
        position = 0
        buffer   = ""

        while true
Severity: Minor
Found in lib/stupidedi/reader/token_reader.rb - About 1 hr to fix

    Method contrib has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def contrib(base = default)
          base.customize do |c|
            c.transaction_set.customize do |x|
              x.register("002001", "SH", "856") { Stupidedi::TransactionSets::TwoThousandOne::Standards::SH856 }
              x.register("002001", "PO", "830") { Stupidedi::TransactionSets::TwoThousandOne::Standards::PO830 }
    Severity: Minor
    Found in lib/stupidedi/config.rb - About 1 hr to fix

      Method prev has 28 lines of code (exceeds 25 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

        Method next has 28 lines of code (exceeds 25 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

          Method only has a Cognitive Complexity of 10 (exceeds 5 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

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

                    def strftime(format, value)
                      if AN::DATE_FORMAT_RANGE.defined_at?(format)
                        unless value.kind_of?(Range)              and
                               value.end.respond_to?(:strftime)   and
                               value.begin.respond_to?(:strftime)
          Severity: Minor
          Found in lib/stupidedi/versions/common/element_types/an.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 critique_occurences has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def critique_occurences(zipper, recursive)
                  occurences = Hash.new{|h,k| h[k] = 0 }
          
                  zipper.children.each do |child|
                    if child.node.respond_to?(:usage)
          Severity: Minor
          Found in lib/stupidedi/parser/builder_dsl.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_elements has 27 lines of code (exceeds 25 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

            Method build_distinct has 27 lines of code (exceeds 25 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

              Method parent has 27 lines of code (exceeds 25 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

                Method pretty_print has 26 lines of code (exceeds 25 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

                  Method build_disjoint has 26 lines of code (exceeds 25 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

                    Method process has 26 lines of code (exceeds 25 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 1 hr to fix

                      Method push has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def push(zipper, parent, segment_tok, segment_use, config)
                              case segment_use.parent
                              when Schema::TableDef
                                table_def   = segment_use.parent
                                table_val   = table_def.empty
                      Severity: Minor
                      Found in lib/stupidedi/parser/states/table_state.rb - About 1 hr to fix

                        Method process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def process
                            methods = statement.parameters.slice(0..-3).map{|x| x.source }
                            target  = statement.parameters.jump(:assoc)
                        
                            unless target.eql?(statement.parameters)
                        Severity: Minor
                        Found in build/doc/lib/meta-plugin/lib/yard-meta/handler.rb - About 55 mins 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_component_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def read_component_element(repeatable = false)
                                position = 0
                                buffer   = ""
                        
                                while @input.defined_at?(position)
                        Severity: Minor
                        Found in lib/stupidedi/reader/token_reader.rb - About 55 mins 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 first has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def first
                                active = roots.map do |zipper|
                                  state = zipper
                                  value = zipper.node.zipper
                        
                        
                        Severity: Minor
                        Found in lib/stupidedi/parser/navigation.rb - About 55 mins 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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def mksegment(segment_tok, segment_use)
                                segment_def  = segment_use.definition
                                element_uses = segment_def.element_uses
                                element_toks = segment_tok.element_toks
                        
                        
                        Severity: Minor
                        Found in lib/stupidedi/parser/states/abstract_state.rb - About 55 mins 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_time has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                                    def to_time(hour = nil, minute = nil, second = nil)
                                      if minute.nil? and second.nil? and hour.respond_to?(:hour)
                                        if hour.respond_to?(:minute) and hour.respond_to?(:second)
                                          hour, minute, second = hour.hour, hour.minute, hour.second
                                        elsif hour.respond_to?(:min) and hour.respond_to?(:sec)
                        Severity: Minor
                        Found in lib/stupidedi/versions/common/element_types/dt.rb - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def process
                            return unless statement.last.last
                        
                            describes = statement.parameters.first.jump(:string_content).source
                        
                        
                        Severity: Minor
                        Found in build/doc/lib/rspec-plugin/lib/yard-rspec/handler.rb - About 55 mins 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