blambeau/qrb

View on GitHub
lib/finitio/support/type_factory.rb

Summary

Maintainability
C
1 day
Test Coverage

Class TypeFactory has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class TypeFactory

    DSL_METHODS = [
      :attribute,
      :heading,
Severity: Minor
Found in lib/finitio/support/type_factory.rb - About 3 hrs to fix

    Method type has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def type(type, name = nil, metadata = nil, &bl)
          return subtype(type(type, name, metadata), bl) if bl
          case type
          when Type
            alias_type(type, name, metadata)
    Severity: Minor
    Found in lib/finitio/support/type_factory.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 type has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def type(type, name = nil, metadata = nil, &bl)
          return subtype(type(type, name, metadata), bl) if bl
          case type
          when Type
            alias_type(type, name, metadata)
    Severity: Minor
    Found in lib/finitio/support/type_factory.rb - About 1 hr to fix

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

          def alias_type(type, name, metadata)
            raise "Type expected `#{type}`" unless type.is_a?(Type)
            if (name && type.named?) or (metadata && type.metadata?)
              AliasType.new(type, name, metadata)
            else
      Severity: Minor
      Found in lib/finitio/support/type_factory.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 contract has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def contract(infotype, dresser, undresser, name = nil, metadata = nil)
      Severity: Minor
      Found in lib/finitio/support/type_factory.rb - About 35 mins to fix

        Method subtype has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def subtype(super_type, constraints = nil, name = nil, metadata = nil, &bl)
        Severity: Minor
        Found in lib/finitio/support/type_factory.rb - About 35 mins to fix

          Method name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def name(name)
                unless name.nil? or (name.is_a?(String) and name.strip.size > 1)
                  fail!("Wrong type name `#{name}`")
                end
          
          
          Severity: Minor
          Found in lib/finitio/support/type_factory.rb - About 25 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