irobayna/stupidedi

View on GitHub

Showing 292 of 292 total issues

Method __find has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

      def __find(invalid, id, elements, assert_repeatable = false)
        reachable   = false
        repeatable  = false
        matches     = []
        filter_tok  = nil
Severity: Minor
Found in lib/stupidedi/parser/navigation.rb - About 1 day 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 element has a Cognitive Complexity of 58 (exceeds 5 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: Minor
Found in lib/stupidedi/parser/navigation.rb - About 1 day 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 has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

      def critique(zipper, recursive = false, position = false)
        if zipper.node.simple? or zipper.node.component?
          if zipper.node.invalid?
            raise Exceptions::ParseError,
              "invalid #{zipper.node.descriptor} at #{zipper.node.position.inspect}"
Severity: Minor
Found in lib/stupidedi/parser/builder_dsl.rb - About 1 day 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

  module Versions
    module ThirtyForty
      module SegmentDefs
        autoload :AK1, "stupidedi/versions/003040/segment_defs/AK1"
        autoload :AK2, "stupidedi/versions/003040/segment_defs/AK2"
Severity: Major
Found in lib/stupidedi/versions/003040/segment_defs.rb and 1 other location - About 1 day to fix
lib/stupidedi/versions/003050/segment_defs.rb on lines 3..91

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

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 Versions
    module ThirtyFifty
      module SegmentDefs
        autoload :AK1, "stupidedi/versions/003050/segment_defs/AK1"
        autoload :AK2, "stupidedi/versions/003050/segment_defs/AK2"
Severity: Major
Found in lib/stupidedi/versions/003050/segment_defs.rb and 1 other location - About 1 day to fix
lib/stupidedi/versions/003040/segment_defs.rb on lines 3..91

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

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 navigation.rb has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Stupidedi
  using Refinements

  module Parser
    module Navigation
Severity: Minor
Found in lib/stupidedi/parser/navigation.rb - About 6 hrs to fix

    Method matches has a Cognitive Complexity of 40 (exceeds 5 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 6 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 value has a Cognitive Complexity of 36 (exceeds 5 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 5 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 dt.rb has 382 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/dt.rb - About 5 hrs to fix

      Method mksegment_tok has a Cognitive Complexity of 30 (exceeds 5 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 4 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 27 (exceeds 5 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: Minor
      Found in lib/stupidedi/transaction_sets/builder.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

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

        module Interchanges
          module ThreeHundred
            s = Schema
            r = Versions::ThirtyTen::ElementReqs
      
      
      Severity: Major
      Found in lib/stupidedi/interchanges/00300/interchange_def.rb and 3 other locations - About 3 hrs to fix
      lib/stupidedi/interchanges/00200/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00400/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00401/interchange_def.rb on lines 3..55

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

      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

        module Interchanges
          module FourOhOne
            s = Schema
            r = Versions::FortyTen::ElementReqs
      
      
      Severity: Major
      Found in lib/stupidedi/interchanges/00401/interchange_def.rb and 3 other locations - About 3 hrs to fix
      lib/stupidedi/interchanges/00200/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00300/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00400/interchange_def.rb on lines 3..55

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

      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

        module Interchanges
          module FourHundred
            s = Schema
            r = Versions::FortyTen::ElementReqs
      
      
      Severity: Major
      Found in lib/stupidedi/interchanges/00400/interchange_def.rb and 3 other locations - About 3 hrs to fix
      lib/stupidedi/interchanges/00200/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00300/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00401/interchange_def.rb on lines 3..55

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

      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

        module Interchanges
          module TwoHundred
            s = Schema
            r = Versions::TwoThousandOne::ElementReqs
      
      
      Severity: Major
      Found in lib/stupidedi/interchanges/00200/interchange_def.rb and 3 other locations - About 3 hrs to fix
      lib/stupidedi/interchanges/00300/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00400/interchange_def.rb on lines 3..55
      lib/stupidedi/interchanges/00401/interchange_def.rb on lines 3..55

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

      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 token_reader.rb has 327 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Stupidedi
        using Refinements
      
        module Reader
          class TokenReader
      Severity: Minor
      Found in lib/stupidedi/reader/token_reader.rb - About 3 hrs to fix

        Method step has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

                def step(machine)
                  machine.successors.head.constraints.each do |segment_id, table|
                    case table
                    when Stupidedi::Parser::ConstraintTable::Shallowest,
                         Stupidedi::Parser::ConstraintTable::Deepest
        Severity: Minor
        Found in lib/stupidedi/transaction_sets/validation/ambiguity.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 build has a Cognitive Complexity of 25 (exceeds 5 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: Minor
        Found in lib/stupidedi/writer/claredi.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 step has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def step(machine)
                  machine.successors.head.constraints.each do |segment_id, table|
                    case table
                    when Stupidedi::Parser::ConstraintTable::Shallowest,
                         Stupidedi::Parser::ConstraintTable::Deepest
        Severity: Major
        Found in lib/stupidedi/transaction_sets/validation/ambiguity.rb - About 3 hrs to fix

          Method critique has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def critique(zipper, recursive = false, position = false)
                  if zipper.node.simple? or zipper.node.component?
                    if zipper.node.invalid?
                      raise Exceptions::ParseError,
                        "invalid #{zipper.node.descriptor} at #{zipper.node.position.inspect}"
          Severity: Major
          Found in lib/stupidedi/parser/builder_dsl.rb - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language