projectcypress/health-data-standards

View on GitHub
lib/hqmf-model/types.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File types.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module HQMF

  # Used to represent 'any value' in criteria that require a value be present but
  # don't specify any restrictions on that value
  class AnyValue
Severity: Minor
Found in lib/hqmf-model/types.rb - About 3 hrs to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(type,system,code,code_list_id=nil,title=nil,null_flavor=nil,original_text=nil)
    Severity: Major
    Found in lib/hqmf-model/types.rb - About 50 mins to fix

      Method stringify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def stringify
            if (@high && @low)
              if (@high.value == @low.value and @high.inclusive? and low.inclusive?)
                "#{@low.stringify}"
              else
      Severity: Minor
      Found in lib/hqmf-model/types.rb - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(type,unit,value,inclusive,derived,expression)
      Severity: Minor
      Found in lib/hqmf-model/types.rb - About 45 mins to fix

        Method from_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.from_json(json)
              type = json["type"] if json["type"]
              unit = json["unit"] if json["unit"]
              value = json["value"] if json["value"]
              inclusive = json["inclusive?"] unless json["inclusive?"].nil?
        Severity: Minor
        Found in lib/hqmf-model/types.rb - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method from_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.from_json(json)
              json = json.with_indifferent_access
              type = json["type"] if json["type"]
              system = json["system"] if json["system"]
              code = json["code"] if json["code"]
        Severity: Minor
        Found in lib/hqmf-model/types.rb - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        There are no issues that match your filters.

        Category
        Status