checkr/checkr-ruby

View on GitHub

Showing 30 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

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

        class VerificationList < APIList
      
          attribute :next_href
          attribute :previous_href
          attribute :count
      Severity: Minor
      Found in lib/checkr/verification_list.rb and 1 other location - About 45 mins to fix
      lib/checkr/adverse_item_list.rb on lines 2..20

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

      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 AdverseItemList < APIList
      
          attribute :next_href
          attribute :previous_href
          attribute :count
      Severity: Minor
      Found in lib/checkr/adverse_item_list.rb and 1 other location - About 45 mins to fix
      lib/checkr/verification_list.rb on lines 2..20

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

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

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

          class SexOffenderSearch < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/sex_offender_search.rb and 3 other locations - About 35 mins to fix
        lib/checkr/education_verification.rb on lines 2..19
        lib/checkr/employment_verification.rb on lines 2..19
        lib/checkr/ssn_trace.rb on lines 2..19

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

        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 4 locations. Consider refactoring.
        Open

          class EmploymentVerification < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/employment_verification.rb and 3 other locations - About 35 mins to fix
        lib/checkr/education_verification.rb on lines 2..19
        lib/checkr/sex_offender_search.rb on lines 2..19
        lib/checkr/ssn_trace.rb on lines 2..19

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

        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 4 locations. Consider refactoring.
        Open

          class SSNTrace < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/ssn_trace.rb and 3 other locations - About 35 mins to fix
        lib/checkr/education_verification.rb on lines 2..19
        lib/checkr/employment_verification.rb on lines 2..19
        lib/checkr/sex_offender_search.rb on lines 2..19

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

        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 4 locations. Consider refactoring.
        Open

          class EducationVerification < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/education_verification.rb and 3 other locations - About 35 mins to fix
        lib/checkr/employment_verification.rb on lines 2..19
        lib/checkr/sex_offender_search.rb on lines 2..19
        lib/checkr/ssn_trace.rb on lines 2..19

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

        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 5 locations. Consider refactoring.
        Open

          class GlobalWatchlistSearch < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/global_watchlist_search.rb and 4 other locations - About 30 mins to fix
        lib/checkr/eviction_search.rb on lines 2..18
        lib/checkr/federal_civil_search.rb on lines 2..18
        lib/checkr/federal_criminal_search.rb on lines 2..18
        lib/checkr/national_criminal_search.rb on lines 2..18

        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 5 locations. Consider refactoring.
        Open

          class FederalCivilSearch < APIResource
        
            attribute :status
            attribute :result
            attribute :cancellation_reason
        Severity: Major
        Found in lib/checkr/federal_civil_search.rb and 4 other locations - About 30 mins to fix
        lib/checkr/eviction_search.rb on lines 2..18
        lib/checkr/federal_criminal_search.rb on lines 2..18
        lib/checkr/global_watchlist_search.rb on lines 2..18
        lib/checkr/national_criminal_search.rb on lines 2..18

        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