orgsync/active_interaction

View on GitHub

Showing 12 of 12 total issues

Method given? has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def given?(input, *rest)
      filter_level = self.class
      input_level = @_interaction_raw_inputs

      [input, *rest].each do |key_or_index|
Severity: Minor
Found in lib/active_interaction/base.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 convert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def convert(value)
      if value.is_a?(Numeric)
        safe_converter(value)
      elsif value.respond_to?(:to_int)
        safe_converter(value.to_int)
Severity: Minor
Found in lib/active_interaction/filters/abstract_numeric_filter.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 convert has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def convert(value)
      if value.respond_to?(:to_str)
        value = value.to_str
        value.blank? ? send(__method__, nil) : convert_string(value)
      elsif value.is_a?(GroupedInput)
Severity: Minor
Found in lib/active_interaction/filters/abstract_date_time_filter.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 matches? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def matches?(object)
      return false if object.nil?
      return matches_methods?(object) if options.key?(:methods)

      const = from
Severity: Minor
Found in lib/active_interaction/filters/interface_filter.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 convert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def convert(value)
      if value.respond_to?(:to_str)
        value = value.to_str
        value = nil if value.blank?
      end
Severity: Minor
Found in lib/active_interaction/filters/boolean_filter.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 cast has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def cast(value, context, convert: true, reconstantize: true)
      if matches?(value)
        adjust_output(value, context)
      # we can't use `nil?` because BasicObject doesn't have it
      elsif value == nil # rubocop:disable Style/NilComparison
Severity: Minor
Found in lib/active_interaction/filter.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 clean_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def clean_value(hash, name, filter, value, context)
Severity: Minor
Found in lib/active_interaction/filters/hash_filter.rb - About 35 mins to fix

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

          def process(inputs)
            normalize_inputs!(inputs)
              .stringify_keys
              .sort
              .each_with_object({}) do |(k, v), h|
    Severity: Minor
    Found in lib/active_interaction/inputs.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

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

        def default(context = nil)
          raise NoDefaultError, name unless default?
    
          value = raw_default(context)
          raise InvalidValueError if value.is_a?(GroupedInput)
    Severity: Minor
    Found in lib/active_interaction/filter.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

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

        def merge_detail!(attribute, detail, message)
          if attribute?(attribute) || attribute == :base
            options = detail.dup
            error = options.delete(:error)
    
    
    Severity: Minor
    Found in lib/active_interaction/errors.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

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

        def convert(value)
          converter(value).tap do |result|
            raise InvalidValueError if result.nil?
          end
        rescue StandardError => e
    Severity: Minor
    Found in lib/active_interaction/filters/object_filter.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

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

        def convert(value)
          value = value.to_int if value.respond_to?(:to_int)
    
          if value.is_a?(Numeric)
            klass.at(value)
    Severity: Minor
    Found in lib/active_interaction/filters/time_filter.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

    Severity
    Category
    Status
    Source
    Language