cyberark/conjur-api-ruby

View on GitHub

Showing 9 of 126 total issues

Class API has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

  class API
    # Router translates method arguments to rest-ful API request parameters.
    # because of this, most of the methods suffer from :reek:LongParameterList:
    # and :reek:UtilityFunction:
    module Router
Severity: Minor
Found in lib/conjur/api/router.rb - About 4 hrs to fix

    Method add_option has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_option name, options = {}, &def_proc
            accepted_options << name
            allow_env = options[:env].nil? || options[:env]
            env_var = options[:env] || "CONJUR_#{name.to_s.upcase}"
            def_val = options[:default]
    Severity: Minor
    Found in lib/conjur/configuration.rb - About 2 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 memberships has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def memberships options = {}
          request = if options.delete(:recursive) == false
            options["memberships"] = true
          else
            options["all"] = true
    Severity: Minor
    Found in lib/conjur/acts_as_role.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 add_option has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def add_option name, options = {}, &def_proc
            accepted_options << name
            allow_env = options[:env].nil? || options[:env]
            env_var = options[:env] || "CONJUR_#{name.to_s.upcase}"
            def_val = options[:default]
    Severity: Minor
    Found in lib/conjur/configuration.rb - About 1 hr to fix

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

          def prefixlen
            unless @prefixlen
              return @prefixlen = 0 if (mask = mask_addr) == 0
      
              @prefixlen = ipv4? ? 32 : 128
      Severity: Minor
      Found in lib/conjur/cidr.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 create_log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.create_log param
          if param
            if param.is_a? String
              if param == 'stdout'
                Logger.new $stdout
      Severity: Minor
      Found in lib/conjur/log.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 authn_authenticate_local has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def authn_authenticate_local username, account, expiration, cidr, &block
      Severity: Minor
      Found in lib/conjur/api/router.rb - About 35 mins to fix

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

              def add_chained_cert store, chained_cert
                parse_certs(chained_cert).each do |cert|
                  begin
                    store.add_cert cert
                  rescue OpenSSL::X509::StoreError => ex
        Severity: Minor
        Found in lib/conjur/cert_utils.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 resources has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def resources options = {}
              options = { host: Conjur.configuration.core_url, credentials: credentials }.merge options
              options[:account] ||= Conjur.configuration.account
        
              host, credentials, account, kind = options.values_at(*[:host, :credentials, :account, :kind])
        Severity: Minor
        Found in lib/conjur/api/resources.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