merimond/saper

View on GitHub

Showing 13 of 13 total issues

Class Action has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Action
    
    # 
    # Tracks subclasses of Saper::Action.
    # 
Severity: Minor
Found in lib/saper/core/action.rb - About 3 hrs to fix

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

          def value(stack = nil)
            if @value.is_a?(Saper::Recipe)
              return @value
            end
            if @value.is_a?(Symbol)
    Severity: Minor
    Found in lib/saper/arguments/recipe.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 unserialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.unserialize(data, &block)
          if data.is_a?(Array)
            return data.map { |item| unserialize(item, &block) }
          end
          unless data.is_a?(Hash)
    Severity: Minor
    Found in lib/saper/core/recipe.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 validate_output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_output(output, type)
          if output.is_a?(Array) && output.empty?
            raise Errors::InvalidOutput
          end
          if output.is_a?(Array)
    Severity: Minor
    Found in lib/saper/core/action.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 to_native has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_native(object = 'generic')
            if object == 'generic'
              return to_native(to_hash)
            end
            if object.nil?
    Severity: Minor
    Found in lib/saper/items/atom.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 parse has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.parse(thing, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML, &block)
    Severity: Minor
    Found in lib/saper/patches/nokogiri.rb - About 35 mins to fix

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

          def validate_input(input, stack = nil)
            if accepts?(:text, stack) && input.is_a?(String)
              input = Item.new(:text, input)
            end
            unless input.is_a?(Item)
      Severity: Minor
      Found in lib/saper/core/action.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(opts = {})
            @value = opts.delete(:value)
            @opts  = opts
            if @value.is_a?(Argument)
              @value = @value.value
      Severity: Minor
      Found in lib/saper/core/argument.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

      Avoid too many return statements within this method.
      Open

                return object.to_native
      Severity: Major
      Found in lib/saper/items/atom.rb - About 30 mins to fix

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

              def valid?(value)
                unless value.is_a?(String)
                  return false
                end
                if value =~ Nokogiri::XML::Searchable::LOOKS_LIKE_XPATH
        Severity: Minor
        Found in lib/saper/arguments/xpath.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 unserialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.unserialize(data, &block)
              unless data.is_a?(Hash)
                raise(Errors::InvalidNamespace, data)
              end
              unless data[:recipes].is_a?(Array)
        Severity: Minor
        Found in lib/saper/core/namespace.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 each_stack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_stack(stack = nil, index = 0, &block)
              if stack.nil?
                stack = Stack.new(runtime, {}, input)
              end
              if stack.filtered?
        Severity: Minor
        Found in lib/saper/core/result.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 each_action_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_action_result(stack, action)
              begin
                results = action.run(stack.last, stack)
              rescue Saper::Error => error
                results = error
        Severity: Minor
        Found in lib/saper/core/result.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