reset/ridley

View on GitHub

Showing 40 of 44 total issues

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

      def _pv_kind_of(opts, key, to_be)
        value = _pv_opts_lookup(opts, key)
        unless value.nil?
          passes = false
          Array(to_be).each do |tb|
Severity: Minor
Found in lib/ridley/mixin/params_validate.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 add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add(severity, message = nil, progname = nil, &block)
        severity ||= Logger::UNKNOWN
        if @logdev.nil? or severity < @level
          return true
        end
Severity: Minor
Found in lib/ridley/logger.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 partial has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def partial(index, query_string, attributes, resources_registry, options = {})
Severity: Minor
Found in lib/ridley/resources/search_resource.rb - About 35 mins to fix

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

          def chefignore(path)
            Pathname.new(path).ascend do |dir|
              next unless dir.directory?
    
              [
    Severity: Minor
    Found in lib/ridley/chef/chefignore.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 upload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def upload(path, options = {})
          options  = options.reverse_merge(validate: true, force: false, freeze: false)
          cookbook = Ridley::Chef::Cookbook.from_path(path)
    
          unless (existing = find(cookbook.cookbook_name, cookbook.version)).nil?
    Severity: Minor
    Found in lib/ridley/resources/cookbook_resource.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 _pv_required has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def _pv_required(opts, key, is_required=true)
            if is_required
              if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||
                  (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)
                true
    Severity: Minor
    Found in lib/ridley/mixin/params_validate.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate
          raise IOError, "No Cookbook found at: #{path}" unless path.exist?
    
          unless syntax_checker.validate_ruby_files
            raise Ridley::Errors::CookbookSyntaxError, "Invalid ruby files in cookbook: #{cookbook_name} (#{version})."
    Severity: Minor
    Found in lib/ridley/chef/cookbook.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(data_bag, object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          new(data_bag).from_hash(request(:get, "#{DataBagResource.resource_path}/#{data_bag.name}/#{chef_id}"))
        rescue AbortError => ex
          return nil if ex.cause.is_a?(Errors::HTTPNotFound)
    Severity: Minor
    Found in lib/ridley/resources/data_bag_item_resource.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete(data_bag, object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          new(data_bag).from_hash(request(:delete, "#{DataBagResource.resource_path}/#{data_bag.name}/#{chef_id}"))
        rescue AbortError => ex
          return nil if ex.cause.is_a?(Errors::HTTPNotFound)
    Severity: Minor
    Found in lib/ridley/resources/data_bag_item_resource.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 _pv_callbacks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def _pv_callbacks(opts, key, callbacks)
            raise ArgumentError, "Callback list must be a hash!" unless callbacks.kind_of?(Hash)
            value = _pv_opts_lookup(opts, key)
            if value != nil
              callbacks.each do |message, zeproc|
    Severity: Minor
    Found in lib/ridley/mixin/params_validate.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          request(:get, "#{self.class.resource_path}/#{chef_id}")
          new(name: chef_id)
        rescue AbortError => ex
    Severity: Minor
    Found in lib/ridley/resources/data_bag_resource.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          new(request(:get, "#{self.class.resource_path}/#{chef_id}"))
        rescue AbortError => ex
          return nil if ex.cause.is_a?(Errors::HTTPNotFound)
    Severity: Minor
    Found in lib/ridley/resource.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(object, version)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          new(request(:get, "#{self.class.resource_path}/#{chef_id}/#{version}"))
        rescue AbortError => ex
          return nil if ex.cause.is_a?(Errors::HTTPNotFound)
    Severity: Minor
    Found in lib/ridley/resources/cookbook_resource.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 cookbook_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def cookbook_versions(environment, run_list = [])
          run_list = Array(run_list).flatten
          chef_id  = environment.respond_to?(:chef_id) ? environment.chef_id : environment
          request(:post, "#{self.class.resource_path}/#{chef_id}/cookbook_versions", JSON.fast_generate(run_list: run_list))
        rescue AbortError => ex
    Severity: Minor
    Found in lib/ridley/resources/environment_resource.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 _pv_respond_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def _pv_respond_to(opts, key, method_name_list)
            value = _pv_opts_lookup(opts, key)
            unless value.nil?
              Array(method_name_list).each do |method_name|
                unless value.respond_to?(method_name)
    Severity: Minor
    Found in lib/ridley/mixin/params_validate.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(cookbook = nil, maintainer = 'YOUR_COMPANY_NAME', maintainer_email = 'YOUR_EMAIL', license = 'none')
            @cookbook = cookbook
            @name = cookbook ? cookbook.name : ""
            @long_description = ""
            self.maintainer(maintainer)
    Severity: Minor
    Found in lib/ridley/chef/cookbook/metadata.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 handle_partial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def handle_partial(index, registry, response)
            chef_id = chef_id_for_index(index)
    
            case index.to_sym
            when :node
    Severity: Minor
    Found in lib/ridley/resources/search_resource.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 perform_with_redirection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def perform_with_redirection(env, follows)
              request_body = env[:body]
              response = @app.call(env)
    
              response.on_complete do |env|
    Severity: Minor
    Found in lib/ridley/middleware/follow_redirects.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 commit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def commit(object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          request(:put, "#{self.class.resource_path}/#{chef_id}", JSON.fast_generate(is_completed: true))
        rescue AbortError => ex
          case ex.cause
    Severity: Minor
    Found in lib/ridley/resources/sandbox_resource.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete(object)
          chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
          new(request(:delete, "#{self.class.resource_path}/#{chef_id}"))
        rescue AbortError => ex
          return nil if ex.cause.is_a?(Errors::HTTPNotFound)
    Severity: Minor
    Found in lib/ridley/resource.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