irobayna/stupidedi

View on GitHub

Showing 292 of 292 total issues

Method pretty_print has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_print(q)
        q.text("InterchangeDef[#{id}]")
        q.group(2, "(", ")") do
          q.breakable ""
          @header_segment_uses.each do |e|
Severity: Minor
Found in lib/stupidedi/schema/interchange_def.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 element has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def element(e, separators, out)
        if e.simple?
          out << e.to_x12

        elsif e.composite?
Severity: Minor
Found in lib/stupidedi/writer/default.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 pretty_print has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def pretty_print(q)
        q.text("FunctionalGroupDef")
        q.group(2, "(", ")") do
          q.breakable ""
          @header_segment_uses.each do |e|
Severity: Minor
Found in lib/stupidedi/schema/functional_group_def.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 inspect has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

            def inspect
              id = definition.bind do |d|
                "[#{"% 5s" % d.id}: #{d.name}]".bind do |s|
                  if usage.forbidden?
                    ansi.forbidden(s)
Severity: Minor
Found in lib/stupidedi/versions/common/element_types/id.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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def read(reader, options = {})
        limit    = options.fetch(:nondeterminism, 1)
        machine  = self
        reader_e = reader.read_segment

Severity: Minor
Found in lib/stupidedi/parser/generation.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

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

                 [{:IK3=>
                    [{:E721=>{:name=>"Segment ID Code", :value=>{:raw=>"REF", :description=>"REF"}, :type=>:simple}},
                     {:E719=>{:name=>"Segment Position in Transaction Set", :value=>{:raw=>"57", :description=>nil}, :type=>:simple}},
                     {:E447=>{:name=>"Loop Identifier Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                     {:E620=>{:name=>"Implementation Segment Syntax Error Code", :value=>{:raw=>"3", :description=>"Required Segment Missing"}, :type=>:simple}}]},
Severity: Major
Found in notes/json_writer/sample_output.rb and 1 other location - About 1 hr to fix
notes/json_writer/sample_output.rb on lines 57..61

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

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

  module Versions
    module ThirtyFifty
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/003050/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/002001/element_types.rb on lines 3..25
lib/stupidedi/versions/003010/element_types.rb on lines 3..25
lib/stupidedi/versions/003040/element_types.rb on lines 3..25
lib/stupidedi/versions/004010/element_types.rb on lines 3..25
lib/stupidedi/versions/005010/element_types.rb on lines 3..25

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

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

      def mkrepeated_tok(elements, element_use, designator, position)
        element_toks = []

        if element_use.composite?
          elements.each do |e_tag, e_val, e_position|
Severity: Minor
Found in lib/stupidedi/parser/tokenization.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

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

  module Versions
    module ThirtyForty
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/003040/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/002001/element_types.rb on lines 3..25
lib/stupidedi/versions/003010/element_types.rb on lines 3..25
lib/stupidedi/versions/003050/element_types.rb on lines 3..25
lib/stupidedi/versions/004010/element_types.rb on lines 3..25
lib/stupidedi/versions/005010/element_types.rb on lines 3..25

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

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

  module Versions
    module FiftyTen
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/005010/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/002001/element_types.rb on lines 3..25
lib/stupidedi/versions/003010/element_types.rb on lines 3..25
lib/stupidedi/versions/003040/element_types.rb on lines 3..25
lib/stupidedi/versions/003050/element_types.rb on lines 3..25
lib/stupidedi/versions/004010/element_types.rb on lines 3..25

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

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 ISA
        attr_reader :id

        def initialize(parent, sequence)
          @count, @parent, @sequence, @id = 0, parent, sequence, sequence.value
Severity: Major
Found in lib/stupidedi/parser/identifier_stack.rb and 1 other location - About 1 hr to fix
lib/stupidedi/parser/identifier_stack.rb on lines 137..162

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

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

  module Versions
    module TwoThousandOne
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/002001/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/003010/element_types.rb on lines 3..25
lib/stupidedi/versions/003040/element_types.rb on lines 3..25
lib/stupidedi/versions/003050/element_types.rb on lines 3..25
lib/stupidedi/versions/004010/element_types.rb on lines 3..25
lib/stupidedi/versions/005010/element_types.rb on lines 3..25

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

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

  module Versions
    module FortyTen
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/004010/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/002001/element_types.rb on lines 3..25
lib/stupidedi/versions/003010/element_types.rb on lines 3..25
lib/stupidedi/versions/003040/element_types.rb on lines 3..25
lib/stupidedi/versions/003050/element_types.rb on lines 3..25
lib/stupidedi/versions/005010/element_types.rb on lines 3..25

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

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

  module Versions
    module ThirtyTen
      module ElementTypes
        DT               = Common::ElementTypes::DT
        DateVal          = Common::ElementTypes::DateVal
Severity: Major
Found in lib/stupidedi/versions/003010/element_types.rb and 5 other locations - About 1 hr to fix
lib/stupidedi/versions/002001/element_types.rb on lines 3..25
lib/stupidedi/versions/003040/element_types.rb on lines 3..25
lib/stupidedi/versions/003050/element_types.rb on lines 3..25
lib/stupidedi/versions/004010/element_types.rb on lines 3..25
lib/stupidedi/versions/005010/element_types.rb on lines 3..25

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

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 GS
        attr_reader :id

        def initialize(parent, sequence)
          @count, @parent, @sequence, @id = 0, parent, sequence, sequence.value
Severity: Major
Found in lib/stupidedi/parser/identifier_stack.rb and 1 other location - About 1 hr to fix
lib/stupidedi/parser/identifier_stack.rb on lines 108..133

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

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

                 [{:IK3=>
                    [{:E721=>{:name=>"Segment ID Code", :value=>{:raw=>"CLM", :description=>"CLM"}, :type=>:simple}},
                     {:E719=>{:name=>"Segment Position in Transaction Set", :value=>{:raw=>"22", :description=>nil}, :type=>:simple}},
                     {:E447=>{:name=>"Loop Identifier Code", :value=>{:raw=>"", :description=>nil}, :type=>:simple}},
                     {:E620=>{:name=>"Implementation Segment Syntax Error Code", :value=>{:raw=>"8", :description=>"Segment Has Data Element Errors"}, :type=>:simple}}]},
Severity: Major
Found in notes/json_writer/sample_output.rb and 1 other location - About 1 hr to fix
notes/json_writer/sample_output.rb on lines 88..92

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

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

            def binary_operators(*ops)
              file, line, = Stupidedi.caller

              if ops.last.is_a?(Hash)
                options = ops.pop
Severity: Minor
Found in lib/stupidedi/versions/common/element_types/operators.rb - About 1 hr to fix

    Method read_segment has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def read_segment
            consume_isa.flatmap do |rest|
              # The character after "ISA" is defined to be the element separator
              rest.read_character.flatmap do |char, aR|
                separators = Separators.new(nil, nil, char, nil)
    Severity: Minor
    Found in lib/stupidedi/reader/stream_reader.rb - About 1 hr to fix

      Method relational_operators has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  def relational_operators(*ops)
                    file, line, = Stupidedi.caller
      
                    if ops.last.is_a?(Hash)
                      options = ops.pop
      Severity: Minor
      Found in lib/stupidedi/versions/common/element_types/operators.rb - About 1 hr to fix

        Method to_x12 has 31 lines of code (exceeds 25 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 1 hr to fix
          Severity
          Category
          Status
          Source
          Language