stefan-kolb/nucleus

View on GitHub

Showing 73 of 116 total issues

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

          def create_application(application)
            # updates the application with a valid region identity
            retrieve_region(application)

            # Heroku does not support autoscale
Severity: Minor
Found in lib/nucleus/adapters/v1/heroku/application.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 requirements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.requirements(api_version)
      return @requirements[api_version] unless @requirements.nil? || @requirements[api_version].nil?
      # this is not the schema, but the requirements file (!)
      api_requirements_file = "#{Nucleus::API.src}/api/versions/#{api_version}/requirements.yml"
      schema_file = 'schemas/api.requirements.schema.yml'
Severity: Minor
Found in lib/nucleus_api/import/api_requirements.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 zip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def zip(path)
      string_io = Zip::OutputStream.write_buffer do |zio|
        Find.find(path) do |file|
          # do not process directories && do not include the Git DB files
          next if File.directory?(file) || (@exclude_git && file.start_with?("#{path}/.git"))
Severity: Minor
Found in lib/nucleus/core/common/files/archiver.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          auth = ::Rack::Auth::Basic::Request.new(env)

          return unauthorized('No authentication header provided', env) unless auth.provided?

Severity: Minor
Found in lib/nucleus_api/rack_middleware/basic_auth.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(hash = nil)
      super(hash)
      @endpoints = []
      return if hash.nil?

Severity: Minor
Found in lib/nucleus/core/models/provider.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 push_file_tail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def push_file_tail(app_guid, log_id, stream, pushed_line_idx, headers_to_use)
            log.debug('Fetching file for tail response...')
            entries = download_logfile_entries(app_guid, log_id, headers_to_use)
            # file was shortened, close stream since we do not know where to continue
            if entries.length < pushed_line_idx
Severity: Minor
Found in lib/nucleus/adapters/v1/cloud_foundry_v2/logs.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_collection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_collection(entity_ids)
        response = []
        unless entity_ids.nil? || entity_ids.empty?
          entity_ids.each do |entity_id|
            raise StandardError, "Cant load restricted key '#{entity_id}'" if entity_id.to_s == @restricted_index_key
Severity: Minor
Found in lib/nucleus_api/persistence/store.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 tail_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def tail_file(app_guid, log_id, stream)
            log.debug 'Tailing CF log file'
            log_id = 'staging_task.log' if log_id.to_sym == Enums::ApplicationLogfileType::BUILD

            # cache headers as they are bound to a request and could be lost with the next tick
Severity: Minor
Found in lib/nucleus/adapters/v1/cloud_foundry_v2/logs.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 build_error_entity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_error_entity(error, dev_message = nil, headers = {})
        {
          status: error[:status],
          message: error[:message],
          dev_message: dev_message.nil? ? nil : dev_message,
Severity: Minor
Found in lib/nucleus_api/api/common/error_builder.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 delete_domain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def delete_domain(application_name_or_id, route_id)
            app_guid = app_guid(application_name_or_id)
            # remove route from the app
            delete_response = delete("/v2/apps/#{app_guid}/routes/#{route_id}", expects: [201, 400])
            if delete_response.status == 400
Severity: Minor
Found in lib/nucleus/adapters/v1/cloud_foundry_v2/domains.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 cartridge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def cartridge(runtime)
            cartridges = get('/cartridges').body[:data]
            matched_cartridges, partial_matches = matching_cartridges(cartridges, runtime)

            fail_with(:ambiguous_runtime, [runtime, matched_cartridges]) if matched_cartridges.length > 1
Severity: Minor
Found in lib/nucleus/adapters/v1/openshift_v2/application.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 to_nucleus_app has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def to_nucleus_app(app_resource)
            metadata = app_resource[:metadata]
            app = app_resource[:entity]

            app[:id] = metadata[:guid]
Severity: Minor
Found in lib/nucleus/adapters/v1/cloud_foundry_v2/application.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(hash = nil)
      super(hash)
      @providers = []
      return if hash.nil?

Severity: Minor
Found in lib/nucleus/core/models/vendor.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