blambeau/qrb

View on GitHub

Showing 29 of 29 total issues

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

        def check_and_warn(logger = nil)
          logger ||= begin
            require 'logger'
            Logger.new(STDERR)
          end
    Severity: Minor
    Found in lib/finitio/system.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 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 dress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def dress(value, handler = DressHelper.new)
          # Up should be idempotent with respect to the ADT
          return value if ruby_type and value.is_a?(ruby_type)
    
          # Dressed value and first exception
    Severity: Minor
    Found in lib/finitio/type/ad_type.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 infer_type has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def infer_type(value)
          case value
          when Hash
            attrs = value.map{|k,v|
              Attribute.new(k.to_sym, infer_type(v))
    Severity: Minor
    Found in lib/finitio/inference.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 dress has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def dress(value, handler = DressHelper.new)
          handler.failed!(self, value) unless looks_a_tuple?(value)
    
          # Check for missing attributes
          unless (missing = missing_attrs(value, true)).empty?
    Severity: Minor
    Found in lib/finitio/type/hash_based_type.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 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 dress has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def dress(value, handler = DressHelper.new)
            handler.failed!(self, value) unless looks_a_tuple?(value)
      
            # Check for missing attributes
            unless (missing = missing_attrs(value, true)).empty?
      Severity: Minor
      Found in lib/finitio/type/hash_based_type.rb - About 1 hr to fix

        Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(infotype, dresser, undresser, name = nil, metadata = nil)
              unless infotype.is_a?(Type)
                raise ArgumentError, "Type expected, got `#{infotype}`"
              end
              unless dresser.respond_to?(:call)
        Severity: Minor
        Found in lib/finitio/support/contract.rb - About 55 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 suppremum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def suppremum(other, simple_class, multi_class)
              return self if self == other
              return super(other) unless other.is_a?(simple_class) or other.is_a?(multi_class)
              return super(other) unless heading.looks_similar?(other.heading)
              result_heading = heading.suppremum(other.heading)
        Severity: Minor
        Found in lib/finitio/type/heading_based_type.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

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

          module Syntax
            module Expr
              module Comparison
                include Expr
        
        
        Severity: Minor
        Found in lib/finitio/syntax/expr/comparison.rb and 1 other location - About 45 mins to fix
        lib/finitio/syntax/expr/arith_op.rb on lines 2..16

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

        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 Syntax
            module Expr
              module ArithOp
                include Expr
        
        
        Severity: Minor
        Found in lib/finitio/syntax/expr/arith_op.rb and 1 other location - About 45 mins to fix
        lib/finitio/syntax/expr/comparison.rb on lines 2..16

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

        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 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(infotype, dresser, undresser, name = nil, metadata = nil)
          Severity: Minor
          Found in lib/finitio/support/contract.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 to_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def to_name
                    name = map(&:to_name).join(', ')
                    if allow_extra?
                      name << ", " unless empty?
                      name << "..."
              Severity: Minor
              Found in lib/finitio/support/heading.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

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

                  def normalize_attributes(attrs)
                    unless attrs.respond_to?(:each)
                      raise ArgumentError, "Enumerable[Attribute] expected"
                    end
              
              
              Severity: Minor
              Found in lib/finitio/support/heading.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

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

                class TupleType < Type
                  include HeadingBasedType
                  include HashBasedType
              
                  def initialize(heading, name = nil, metadata = nil)
              Severity: Minor
              Found in lib/finitio/type/tuple_type.rb and 1 other location - About 30 mins to fix
              lib/finitio/type/relation_type.rb on lines 24..40

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

              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 RelationType < Type
                  include HeadingBasedType
                  include RelBasedType
              
                  def initialize(heading, name = nil, metadata = nil)
              Severity: Minor
              Found in lib/finitio/type/relation_type.rb and 1 other location - About 30 mins to fix
              lib/finitio/type/tuple_type.rb on lines 32..48

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

              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

              Severity
              Category
              Status
              Source
              Language