corthmann/bigcommerce-oauth-api

View on GitHub

Showing 8 of 8 total issues

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

    def request(method, path, options)
      response = connection.send(method) do |request|
        case method
          when :get, :delete
            request.url(path, options)
Severity: Minor
Found in lib/bigcommerce-oauth-api/request.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 connection has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def connection
      options = {
        :headers => {
          'Accept' => "application/#{format}; charset=utf-8"
        }
Severity: Minor
Found in lib/bigcommerce-oauth-api/connection.rb - About 1 hr to fix

    Method with_api_methods has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.with_api_methods(map)
          map.each do |_, method_description|
            api_module = method_description[:api_module]
            api_scope = method_description[:scope]
            is_legacy = (method_description[:legacy].nil? ? true : method_description[:legacy])
    Severity: Minor
    Found in lib/bigcommerce-oauth-api/base.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 with_action has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.with_action(method, api_module, api_scope, path_prefix = nil, method_prefix = nil, is_legacy = true)
    Severity: Minor
    Found in lib/bigcommerce-oauth-api/base.rb - About 45 mins to fix

      Method get_method_name_and_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.get_method_name_and_params(method, api_module, api_scope, is_nested = false, method_prefix = nil)
      Severity: Minor
      Found in lib/bigcommerce-oauth-api/base.rb - About 35 mins to fix

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

            def connection
              options = {
                :headers => {
                  'Accept' => "application/#{format}; charset=utf-8"
                }
        Severity: Minor
        Found in lib/bigcommerce-oauth-api/connection.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

        Avoid too many return statements within this method.
        Open

                  return "#{method}_#{base}", "#{params_base}id, options = {})", has_options
        Severity: Major
        Found in lib/bigcommerce-oauth-api/base.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return "#{method}_#{base}", "#{params_base}id)", has_options
          Severity: Major
          Found in lib/bigcommerce-oauth-api/base.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language