stefan-kolb/nucleus

View on GitHub

Showing 116 of 116 total issues

Avoid deeply nested control flow statements.
Open

              if(inner)
                requiredScopes.push(inner);
Severity: Major
Found in public/swagger-ui/lib/swagger-oauth.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              for(i = 0; i < auth.scopes.length; i++) {
                scopes.push(auth.scopes[i]);
              }
    Severity: Major
    Found in public/swagger-ui/lib/swagger-oauth.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (!loose) loose = next;
      Severity: Major
      Found in public/swagger-ui/lib/marked.js - About 45 mins to fix

        Method write_zip_entries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_zip_entries(path, sub_path, io)
              search_path = File.join(path, sub_path)
              Find.find(path) do |file|
                zip_file_path = file.sub(%r{^#{Regexp.escape search_path}\/?}, '')
                next if @exclude_git && zip_file_path.start_with?('.git')
        Severity: Minor
        Found in lib/nucleus/core/common/files/archiver.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

        Avoid deeply nested control flow statements.
        Open

                  for(scope in auth.scopes) {
                    scopes.push({scope: scope, description: auth.scopes[scope], OAuthSchemeKey: key});
                  }
        Severity: Major
        Found in public/swagger-ui/lib/swagger-oauth.js - About 45 mins to fix

          Method log? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def log?(application_name_or_id, log_id)
                      app_guid = app_guid(application_name_or_id)
                      # test file existence
                      log_id = 'staging_task.log' if log_id.to_sym == Enums::ApplicationLogfileType::BUILD
                      # checks also if application is even valid
          Severity: Minor
          Found in lib/nucleus/adapters/v1/cloud_foundry_v2/logs.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

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            module API
              module DB
                module VendorDao
                  def self.instance(api_version)
                    key = "@@__instance__#{api_version}".to_sym
          Severity: Major
          Found in lib/nucleus_api/persistence/daos/vendor_dao.rb and 2 other locations - About 45 mins to fix
          lib/nucleus_api/persistence/daos/endpoint_dao.rb on lines 2..17
          lib/nucleus_api/persistence/daos/provider_dao.rb on lines 2..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 39.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            module API
              module DB
                module ProviderDao
                  def self.instance(api_version)
                    key = "@@__instance__#{api_version}".to_sym
          Severity: Major
          Found in lib/nucleus_api/persistence/daos/provider_dao.rb and 2 other locations - About 45 mins to fix
          lib/nucleus_api/persistence/daos/endpoint_dao.rb on lines 2..17
          lib/nucleus_api/persistence/daos/vendor_dao.rb on lines 2..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 39.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

            module API
              module DB
                module EndpointDao
                  def self.instance(api_version)
                    key = "@@__instance__#{api_version}".to_sym
          Severity: Major
          Found in lib/nucleus_api/persistence/daos/endpoint_dao.rb and 2 other locations - About 45 mins to fix
          lib/nucleus_api/persistence/daos/provider_dao.rb on lines 2..17
          lib/nucleus_api/persistence/daos/vendor_dao.rb on lines 2..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 39.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method push_file_tail has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                    def push_file_tail(app_guid, log_id, stream, pushed_line_idx, headers_to_use)
          Severity: Minor
          Found in lib/nucleus/adapters/v1/cloud_foundry_v2/logs.rb - About 35 mins to fix

            Method execute_request has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def execute_request(method, default_expect, path, params, native_call = false)
            Severity: Minor
            Found in lib/nucleus/core/adapter_extensions/http_client.rb - About 35 mins to fix

              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 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 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 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 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

              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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              InlineLexer.output = function(src, links, options) {
                var inline = new InlineLexer(links, options);
                return inline.output(src);
              };
              Severity: Minor
              Found in public/swagger-ui/lib/marked.js and 1 other location - About 35 mins to fix
              public/swagger-ui/lib/marked.js on lines 909..912

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def initialize(hash = nil)
                    super(hash)
                    @endpoints = []
                    return if hash.nil?
              
              
              Severity: Minor
              Found in lib/nucleus/core/models/provider.rb and 1 other location - About 35 mins to fix
              lib/nucleus/core/models/vendor.rb on lines 13..19

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 34.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              Parser.parse = function(src, options, renderer) {
                var parser = new Parser(options, renderer);
                return parser.parse(src);
              };
              Severity: Minor
              Found in public/swagger-ui/lib/marked.js and 1 other location - About 35 mins to fix
              public/swagger-ui/lib/marked.js on lines 551..554

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language