EGI-FCTF/rOCCI-api

View on GitHub

Showing 15 of 26 total issues

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

        def set_auth_token(tenant = nil, keystone_version = nil)
          response = @env_ref.class.get @keystone_url
          Occi::Api::Log.debug response.inspect

          raise ::Occi::Api::Client::Errors::AuthnError,
Severity: Minor
Found in lib/occi/api/client/http/authn_plugins/keystone.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

File keystone.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Occi::Api::Client
  module Http
    module AuthnPlugins

      class Keystone < Base
Severity: Minor
Found in lib/occi/api/client/http/authn_plugins/keystone.rb - About 2 hrs to fix

    Method set_auth_token has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def set_auth_token(tenant = nil, keystone_version = nil)
              response = @env_ref.class.get @keystone_url
              Occi::Api::Log.debug response.inspect
    
              raise ::Occi::Api::Client::Errors::AuthnError,
    Severity: Minor
    Found in lib/occi/api/client/http/authn_plugins/keystone.rb - About 1 hr to fix

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

              def setup(options = {})
                # set up pem and optionally pem_password and ssl_ca_path
                raise ArgumentError, "Missing required option 'user_cert' for x509 auth!" unless @options[:user_cert]
                raise ArgumentError, "The file specified in 'user_cert' does not exist!" unless File.exists? @options[:user_cert]
      
      
      Severity: Minor
      Found in lib/occi/api/client/http/authn_plugins/x509.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 get_mixins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_mixins(type = nil, include_self = false)
              unless type.blank?
                type_id = get_mixin_type_identifier(type)
                unless type_id
                  raise ArgumentError,
      Severity: Minor
      Found in lib/occi/api/client/base/mixin_methods.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 post_create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def post_create(response)
              if response.code == 200
                collection = Occi::Parser.parse(
                  response.content_type,
                  response.body
      Severity: Minor
      Found in lib/occi/api/client/http/party_wrappers.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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def get(path='/', filter=nil)
              raise ArgumentError, "Path is a required argument!" if path.blank?
      
              # apply filters if present
              headers = self.class.headers.clone
      Severity: Minor
      Found in lib/occi/api/client/http/party_wrappers.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 describe has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def describe(resource_type_identifier=nil)
            if resource_type_identifier
              resource_type_identifier = get_resource_type_identifier(resource_type_identifier)
            end
      
      
      Severity: Minor
      Found in lib/occi/api/client/client_http.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 connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def connect(protocol = :http, options = {})
          raise ArgumentError, 'Protocol is a required argument!' unless protocol
      
          if block_given?
            options = options.marshal_dump if options.is_a?(OpenStruct)
      Severity: Minor
      Found in lib/occi/api/dsl.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

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

              def set_auth_token(tenant = nil)
                if @options[:original_type] == "x509"
                  set_voms_unscoped_token
                elsif @options[:type] == "oauth2"
                  set_oauth2_unscoped_token
      Severity: Minor
      Found in lib/occi/api/client/http/authn_plugins/keystone.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def list(resource_type_identifier=nil)
            if resource_type_identifier
              resource_type_identifier = get_resource_type_identifier(resource_type_identifier)
              path = path_for_kind_type_identifier(resource_type_identifier)
            end
      Severity: Minor
      Found in lib/occi/api/client/client_http.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

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

            def get_process_response(path, response)
              Occi::Api::Log.debug "Response from location: #{path.inspect}"
              kind = @model.get_by_location(path) if @model
      
              Occi::Api::Log.debug "Response should contain kind: #{kind ? kind.type_identifier.inspect : 'none'}"
      Severity: Minor
      Found in lib/occi/api/client/http/party_wrappers.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

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

          def create(entity)
            raise "#{entity.class.name.inspect} not an entity!" unless entity.kind_of? Occi::Core::Entity
      
            Occi::Api::Log.debug "Entity kind: #{entity.kind.type_identifier.inspect}"
            raise "No kind found for #{entity.inspect}" unless entity.kind
      Severity: Minor
      Found in lib/occi/api/client/client_http.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

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

              def get_keystone_req(tenant = nil)
                if @options[:original_type] == "x509"
                  body = { "auth" => { "voms" => true } }
                elsif @options[:username] && @options[:password]
                  body = {
      Severity: Minor
      Found in lib/occi/api/client/http/authn_plugins/keystone.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

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

            def get_action_type_identifier(type, for_kind_w_term = nil)
              return type if (type =~ URI::ABS_URI) || (type && type.start_with?('/'))
      
              acts = @model.actions.to_a.select { |k| k.term == type }
              tis = acts.collect { |c| c.type_identifier }
      Severity: Minor
      Found in lib/occi/api/client/base/action_methods.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