chartmogul/chartmogul-ruby

View on GitHub

Showing 2 of 15 total issues

Class Customer has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Customer < APIResource
    set_resource_name 'Customer'
    set_resource_path '/v1/customers'
    set_immutable_keys(%i[attributes custom])

Severity: Minor
Found in lib/chartmogul/customer.rb - About 3 hrs to fix

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

        def config_accessor(attribute, default_value = nil)
          define_method(attribute) do
            attr = config.send(attribute) || global_config.send(attribute) || default_value
            if attr.nil?
              raise ConfigurationError, "Configuration for #{attribute} not set"
    Severity: Minor
    Found in lib/chartmogul/config_attributes.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