aeolus-incubator/tim

View on GitHub

Showing 10 of 17 total issues

Method handle_factory_callback has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_factory_callback(pi)
      case pi.status.upcase
        when "COMPLETE"
          pi.fsm_create_start    if pi.fsm_create_state == "queued"
          pi.fsm_create_complete unless pi.fsm_create_state == "complete"
Severity: Minor
Found in app/models/tim/provider_image_observer.rb - About 3 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 handle_factory_callback has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_factory_callback(ti)
      case ti.status.upcase
        when "COMPLETE"
          ti.fsm_create_start    if ti.fsm_create_state == "queued"
          ti.fsm_create_complete unless ti.fsm_create_state == "complete"
Severity: Minor
Found in app/models/tim/target_image_observer.rb - About 3 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 request_with_oauth has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def request_with_oauth(method, path, *arguments)
      @oauth_config = Tim::ImageFactory::Base.config || {}
      # Take care to fall back to the standard request method if we don't have full OAuth credentials
      unless use_oauth_for_url?("#{site.scheme}://#{site.host}:#{site.port}#{path}")
        return request_without_oauth(method, path, *arguments)
Severity: Minor
Found in lib/image_factory/oauth/active_resource_oauth_client.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 included has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.included base
        base.state_machine :fsm_create_state, :initial => :new do
          event :fsm_create_request do
            transition :new => :pending
          end
Severity: Minor
Found in app/state_machine/tim/state_machine/fsm.rb - About 1 hr to fix

    Method replace_user_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.replace_user_keys(map, user_keys)
          modified_map = map.clone
          map.each_pair do |key, value|
            # Sets the full template XML in the template.xml attribute
            if key == "template" || key == :template
    Severity: Minor
    Found in app/filters/tim/user_keys_filter.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_with_oauth has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def request_with_oauth(method, path, *arguments)
          @oauth_config = Tim::ImageFactory::Base.config || {}
          # Take care to fall back to the standard request method if we don't have full OAuth credentials
          unless use_oauth_for_url?("#{site.scheme}://#{site.host}:#{site.port}#{path}")
            return request_without_oauth(method, path, *arguments)
    Severity: Minor
    Found in lib/image_factory/oauth/active_resource_oauth_client.rb - About 1 hr to fix

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

              def after_fsm_create_request(pi, transition)
                if pi.imported?
                  if pi.send(:create_import)
                    pi.fsm_create_accept
                    pi.fsm_create_start
      Severity: Minor
      Found in app/state_machine/tim/state_machine/provider_image/fsm_create.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 transform_resource_links_recursively has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def transform_resource_links_recursively(subparams, sublinks)
          return if subparams == nil
      
          case sublinks
          when Symbol # then transform the link (last level of recursion)
      Severity: Minor
      Found in app/filters/tim/resource_link_filter.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 api_behavior has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def api_behavior(error)
            raise error unless resourceful?
      
            status = :ok
            begin
      Severity: Minor
      Found in app/responders/tim/custom_responder.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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def request(method, path, *arguments)
            result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload|
              payload[:method]      = method
              payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
              if method == :delete && arguments.size > 1
      Severity: Minor
      Found in app/patches/rails/active_resource/delete_with_content_body.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