irobayna/stupidedi

View on GitHub

Showing 292 of 292 total issues

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

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

                   {:IK5=>
                     [{:E717=>{:name=>"Transaction Set Acknowledgement Code", :value=>{:raw=>"R", :description=>"Rejected"}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"5", :description=>"One or More Segments in Error"}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
    Severity: Major
    Found in notes/json_writer/sample_output.rb and 1 other location - About 2 hrs to fix
    notes/json_writer/sample_output.rb on lines 107..113

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

    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

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

                   {:IK5=>
                     [{:E717=>{:name=>"Transaction Set Acknowledgement Code", :value=>{:raw=>"R", :description=>"Rejected"}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"5", :description=>"One or More Segments in Error"}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                      {:E618=>{:name=>"Implementation Transaction Set Syntax Error Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
    Severity: Major
    Found in notes/json_writer/sample_output.rb and 1 other location - About 2 hrs to fix
    notes/json_writer/sample_output.rb on lines 75..81

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

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

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

      class Config
        #
        # The functional group segments (GS/GE) and the segments contained by that
        # functional group are versioned separately from the interchange control
        # segments (ISA/ISE). The functional group version is informally referred to
    Severity: Major
    Found in lib/stupidedi/config/functional_group_config.rb and 1 other location - About 2 hrs to fix
    lib/stupidedi/config/interchange_config.rb on lines 5..79

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

    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

      class Config
        #
        # The interchange control segments (ISA/ISE) are versioned independently
        # from the functional group segments (GS/GE). Because different interchange
        # versions can have unique grammars, this table serves as an indirection.
    Severity: Major
    Found in lib/stupidedi/config/interchange_config.rb and 1 other location - About 2 hrs to fix
    lib/stupidedi/config/functional_group_config.rb on lines 5..62

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

    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

                      {:CTX=>
                        [{:C998=>{:name=>"CONTEXT IDENTIFICATION", :value=>[[{:raw=>"CLM01", :description=>nil}, {:raw=>"987654321", :description=>nil}]], :type=>:repeated}},
                         {:E721=>{:name=>"Segment ID Code", :value=>{:raw=>"", :description=>""}, :type=>:simple}},
                         {:E719=>{:name=>"Segment Position in Transaction Set", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                         {:E447=>{:name=>"Loop Identifier Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
    Severity: Major
    Found in notes/json_writer/sample_output.rb and 1 other location - About 2 hrs to fix
    notes/json_writer/sample_output.rb on lines 62..68

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

    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

                      {:CTX=>
                        [{:C998=>{:name=>"CONTEXT IDENTIFICATION", :value=>[[{:raw=>"CLM01", :description=>nil}, {:raw=>"123456789", :description=>nil}]], :type=>:repeated}},
                         {:E721=>{:name=>"Segment ID Code", :value=>{:raw=>"", :description=>""}, :type=>:simple}},
                         {:E719=>{:name=>"Segment Position in Transaction Set", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                         {:E447=>{:name=>"Loop Identifier Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
    Severity: Major
    Found in notes/json_writer/sample_output.rb and 1 other location - About 2 hrs to fix
    notes/json_writer/sample_output.rb on lines 100..106

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

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

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

          Severity
          Category
          Status
          Source
          Language