kputnam/stupidedi

View on GitHub

Showing 291 of 291 total issues

Class TokenReader has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

    class TokenReader
      # @private
      SEGMENT_ID = /\A[A-Z][A-Z0-9]{1,2}\Z/

      include Inspect
Severity: Minor
Found in lib/stupidedi/reader/token_reader.rb - About 3 hrs to fix

    Method __find has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def __find(invalid, id, elements, assert_repeatable = false)
            reachable   = false
            repeatable  = false
            matches     = []
            filter_tok  = nil
    Severity: Major
    Found in lib/stupidedi/parser/navigation.rb - About 3 hrs to fix

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

        module Values
          class TableVal < AbstractVal
            include SegmentValGroup
      
            # @return [TableDef]
      Severity: Major
      Found in lib/stupidedi/values/table_val.rb and 1 other location - About 3 hrs to fix
      lib/stupidedi/values/loop_val.rb on lines 5..70

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

      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

        module Values
          #
          # @see X222.pdf B.1.1.3.12.2 Data Segment Groups
          # @see X222.pdf B.1.1.3.12.4 Loops of Data Segments
          #
      Severity: Major
      Found in lib/stupidedi/values/loop_val.rb and 1 other location - About 3 hrs to fix
      lib/stupidedi/values/table_val.rb on lines 5..66

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

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

            def element(m, n = nil, o = nil)
              if m <= 0 or (n || 1) <= 0 or (o || 1) <= 0
                raise ArgumentError,
                  "all arguments must be positive"
              end
      Severity: Major
      Found in lib/stupidedi/parser/navigation.rb - About 3 hrs to fix

        Method value has a Cognitive Complexity of 23 (exceeds 5 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 3 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 21 (exceeds 5 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 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 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 mksegments has a Cognitive Complexity of 20 (exceeds 5 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 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

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

                      class Invalid < FloatVal
                        # @return [Object]
                        attr_reader :value
            
                        def initialize(value, usage, position)
            Severity: Major
            Found in lib/stupidedi/versions/common/element_types/r.rb and 3 other locations - About 2 hrs to fix
            lib/stupidedi/versions/common/element_types/an.rb on lines 146..204
            lib/stupidedi/versions/common/element_types/nn.rb on lines 56..114
            lib/stupidedi/versions/common/element_types/tm.rb on lines 44..101

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

            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 4 locations. Consider refactoring.
            Open

                      class Invalid < FixnumVal
                        # @return [Object]
                        attr_reader :value
            
                        def initialize(value, usage, position)
            Severity: Major
            Found in lib/stupidedi/versions/common/element_types/nn.rb and 3 other locations - About 2 hrs to fix
            lib/stupidedi/versions/common/element_types/an.rb on lines 146..204
            lib/stupidedi/versions/common/element_types/r.rb on lines 56..114
            lib/stupidedi/versions/common/element_types/tm.rb on lines 44..101

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

            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 4 locations. Consider refactoring.
            Open

                      class Invalid < TimeVal
                        # @return [Object]
                        attr_reader :value
            
                        def initialize(value, usage, position)
            Severity: Major
            Found in lib/stupidedi/versions/common/element_types/tm.rb and 3 other locations - About 2 hrs to fix
            lib/stupidedi/versions/common/element_types/an.rb on lines 146..204
            lib/stupidedi/versions/common/element_types/nn.rb on lines 56..114
            lib/stupidedi/versions/common/element_types/r.rb on lines 56..114

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

            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 4 locations. Consider refactoring.
            Open

                      class Invalid < StringVal
                        # @return [Object]
                        attr_reader :value
            
                        def initialize(value, usage, position)
            Severity: Major
            Found in lib/stupidedi/versions/common/element_types/an.rb and 3 other locations - About 2 hrs to fix
            lib/stupidedi/versions/common/element_types/nn.rb on lines 56..114
            lib/stupidedi/versions/common/element_types/r.rb on lines 56..114
            lib/stupidedi/versions/common/element_types/tm.rb on lines 44..101

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

            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

            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
                Severity
                Category
                Status
                Source
                Language