NeverBounce/NeverBounceApi-Ruby

View on GitHub

Showing 6 of 16 total issues

Method scalar_oattr has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def scalar_oattr(name, options = {})
        o, options = {}, options.dup
        o[k = :allow_nil] = options.include?(k) ? options.delete(k) : false
        o[k = :key] = options.delete(k) || name
        o[k = :type] = options.delete(k) || :any
Severity: Minor
Found in lib/never_bounce/api/response/container.rb - About 1 hr to fix

    Method scalar_oattr has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def scalar_oattr(name, options = {})
            o, options = {}, options.dup
            o[k = :allow_nil] = options.include?(k) ? options.delete(k) : false
            o[k = :key] = options.delete(k) || name
            o[k = :type] = options.delete(k) || :any
    Severity: Minor
    Found in lib/never_bounce/api/response/container.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 to_h has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_h
          input = require_attr(:input)
          input_location = require_attr(:input_location)
    
          # Validate `input_location` and `input`.
    Severity: Minor
    Found in lib/never_bounce/api/request/jobs_create.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 touch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def touch
            self.class.oattrs.each do |name|
              v = public_send(name)
    
              # Touch recursively. Support simple collections.
    Severity: Minor
    Found in lib/never_bounce/api/feature/oattrs.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 credits_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def credits_info
          igetset(:credits_info) do
            if (body_hash.has_key?(k = "credits_info"))
              h = body_hash.fetch(k)
              klass = if h.has_key? "monthly_api_usage"
    Severity: Minor
    Found in lib/never_bounce/api/response/single_check.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 jobs_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def jobs_create(auto_parse: false, auto_start: false, filename: nil, remote_input: nil, run_sample: false, supplied_input: nil, historical: nil)
          raise ArgumentError, "`remote_input` and `supplied_input` can't both be given" if remote_input && supplied_input
    
          input_location = if (v = remote_input)
            # NOTE: Logical order: type, then value.
    Severity: Minor
    Found in lib/never_bounce/api/client.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