checkr/checkr-ruby

View on GitHub

Showing 14 of 30 total issues

Class APIClass has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

  class APIClass
    attr_accessor :json

    def self.path
      raise NotImplementedError.new("APIClass is an abstract class. Please refer to its subclasses: #{subclasses}")
Severity: Minor
Found in lib/checkr/api_class.rb - About 6 hrs to fix

    File api_class.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Checkr
      class APIClass
        attr_accessor :json
    
        def self.path
    Severity: Minor
    Found in lib/checkr/api_class.rb - About 3 hrs to fix

      Method compose_api_path has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.compose_api_path(path, arguments, params={}, this=self)
            # Setup the path using the following attribute order:
            #   1. Args passed in
            #   2. Args on this
            #   3. Args on this.class
      Severity: Minor
      Found in lib/checkr/api_class.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 validate_args has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.validate_args(arg_names, *args)
            # Make sure we have valid arguments
            if args.length > arg_names.length
              if args.length > arg_names.length + 2 # more than params and opts were included
                raise ArgumentError.new("Too many arguments")
      Severity: Minor
      Found in lib/checkr/api_class.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 query_array has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.query_array(params, key_prefix=nil)
            ret = []
            params.each do |key, value|
              if params.is_a?(Array)
                value = key
      Severity: Minor
      Found in lib/checkr/util.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 changed_attribute_names has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def changed_attribute_names
            @changed_attribute_names ||= Set.new
            attributes.each do |key, val|
              next if @changed_attribute_names.include?(key)
              if val.is_a?(Array) || val.is_a?(Hash)
      Severity: Minor
      Found in lib/checkr/api_class.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 request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.request(method, path, params={}, headers={})
          api_key = params[:api_key] || self.api_key
          params.delete(:api_key)
      
          verify_api_key(api_key)
      Severity: Minor
      Found in lib/checkr.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 symbolize_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.symbolize_keys(obj)
            if obj.is_a?(Hash)
              ret = {}
              obj.each do |key, value|
                ret[(key.to_sym rescue key) || key] = symbolize_keys(value)
      Severity: Minor
      Found in lib/checkr/util.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 api_lambda_construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.api_lambda_construct(resp, constructor, this)
            case constructor
            when Class
              constructor.construct(resp)
            when Proc
      Severity: Minor
      Found in lib/checkr/api_class.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(message, param, http_status=nil, http_body=nil, json_body=nil)
      Severity: Minor
      Found in lib/checkr/errors/invalid_request_error.rb - About 35 mins to fix

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

            def self.sorta_deep_clone(json)
              if json.is_a?(Hash)
                ret = {}
                json.each do |k, v|
                  ret[k] = sorta_deep_clone(v)
        Severity: Minor
        Found in lib/checkr/util.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 attribute_get_lambda has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.attribute_get_lambda(name, opts={})
              lambda do
                if !instance_variables_include?(name)
                  if opts[:default]
                    self.send("#{name}=", opts[:default])
        Severity: Minor
        Found in lib/checkr/api_class.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 refresh_from_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def refresh_from_hash(json={})
              klass = api_list_klass
        
              json.each do |k, v|
                if self.class.attribute_writer_names.include?(k.to_sym)
        Severity: Minor
        Found in lib/checkr/api_list.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 determine_attr_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.determine_attr_value(klass, val, opts={}, this=self)
              args = (opts && opts[:nested]) ? [val, this] : [val]
              if klass.is_a?(Proc)
                klass.call(*args)
              elsif klass.is_a?(Class)
        Severity: Minor
        Found in lib/checkr/api_class.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