stefan-kolb/nucleus

View on GitHub

Showing 73 of 116 total issues

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

          def application_state(app, gear_groups = nil, deployments = nil)
            deployments ||= load_deployments(app[:id])
            gear_groups ||= load_gears(app[:id])

            return :created if state_created?(app, gear_groups, deployments)
Severity: Minor
Found in lib/nucleus/adapters/v1/openshift_v2/app_states.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 execute_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def execute_request(method, default_expect, path, params, native_call = false)
        params[:expects] = default_expect unless params.key? :expects
        params[:method] = method

        url = Regexp::PERFECT_URL_PATTERN =~ path ? path : to_url(path)
Severity: Minor
Found in lib/nucleus/core/adapter_extensions/http_client.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 state_deployed? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def state_deployed?(app, gear_groups, deployments)
            # Gears must all be stopped
            return false unless gear_groups[0][:gears].all? { |gear| gear[:state] == 'stopped' }

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

      def initialize(hash = nil)
        return if hash.nil?
        @version = hash['version']
        v = hash['methods']
        @methods = if v
Severity: Minor
Found in lib/nucleus_api/persistence/models/requirements.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 matching_cartridges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def matching_cartridges(cartridges, runtime)
            partial_matches = []
            matches = cartridges.find_all do |cartridge|
              if cartridge[:type] != 'standalone'
                false
Severity: Minor
Found in lib/nucleus/adapters/v1/openshift_v2/application.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 download_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def download_file(app_guid, file_path, headers_to_use = nil)
            expected_statuses = [200, 302, 400, 404]
            # Hack, do not create fresh headers (which would fail) when in a deferred action
            headers_to_use ||= headers

Severity: Minor
Found in lib/nucleus/adapters/v1/cloud_foundry_v2/logs.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 function.
Open

      return this.renderer.listitem(body);
Severity: Major
Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return this.renderer.blockquote(body);
    Severity: Major
    Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return Parser.parse(Lexer.lex(src, opt), opt);
      Severity: Major
      Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return '<p>An error occured:</p><pre>'
                + escape(e.message + '', true)
                + '</pre>';
        Severity: Major
        Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return this.renderer.html(html);
          Severity: Major
          Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.renderer.paragraph(this.parseText());
            Severity: Major
            Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return :idle if gear_groups[0][:gears].all? { |gear| gear[:state] == 'idle' }
              Severity: Major
              Found in lib/nucleus/adapters/v1/openshift_v2/app_states.rb - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return this.renderer.table(header, body);
                Severity: Major
                Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return this.renderer.listitem(body);
                  Severity: Major
                  Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return this.renderer.list(body, ordered);
                    Severity: Major
                    Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return this.renderer.paragraph(this.inline.output(this.token.text));
                      Severity: Major
                      Found in public/swagger-ui/lib/marked.js - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return Enums::ApplicationStates::IDLE if dynos_idle?(dynos)
                        Severity: Major
                        Found in lib/nucleus/adapters/v1/heroku/app_states.rb - About 30 mins to fix

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

                                  def link_resource(namespaces = nil, instance_or_id = nil)
                                    namespaces = [] if namespaces.nil?
                                    id = ''
                                    if instance_or_id.respond_to?('id')
                                      id = instance_or_id.id unless instance_or_id.id.nil?
                          Severity: Minor
                          Found in lib/nucleus_api/api/entities/abstract_entity.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 open_db has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def open_db
                                  db_backend = chosen_db_backend
                          
                                  unless allowed_backends.key?(db_backend)
                                    raise StandardError,
                          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

                          Severity
                          Category
                          Status
                          Source
                          Language