stefan-kolb/nucleus

View on GitHub

Showing 73 of 116 total issues

File marked.js has 901 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */
Severity: Major
Found in public/swagger-ui/lib/marked.js - About 2 days to fix

    Function token has 213 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Lexer.prototype.token = function(src, top, bq) {
      var src = src.replace(/^ +$/gm, '')
        , next
        , loose
        , cap
    Severity: Major
    Found in public/swagger-ui/lib/marked.js - About 1 day to fix

      Function handleLogin has 147 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function handleLogin() {
        var scopes = [];
      
        var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
        if(auths) {
      Severity: Major
      Found in public/swagger-ui/lib/swagger-oauth.js - About 5 hrs to fix

        Class Stub has 37 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Stub < BaseAdapter
                # Error message saying that the adapter feature has not been implemented yet.
                NOT_IMPLEMENTED_ERROR = Errors::AdapterMissingImplementationError.new(
                  'Adapter is missing an implementation to support this feature'
                )
        Severity: Minor
        Found in lib/nucleus/adapters/v1/stub_adapter.rb - About 4 hrs to fix

          Function handleLogin has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleLogin() {
            var scopes = [];
          
            var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
            if(auths) {
          Severity: Minor
          Found in public/swagger-ui/lib/swagger-oauth.js - About 4 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

          Function output has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          InlineLexer.prototype.output = function(src) {
            var out = ''
              , link
              , text
              , href
          Severity: Major
          Found in public/swagger-ui/lib/marked.js - About 4 hrs to fix

            Function tok has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Parser.prototype.tok = function() {
              switch (this.token.type) {
                case 'space': {
                  return '';
                }
            Severity: Major
            Found in public/swagger-ui/lib/marked.js - About 3 hrs to fix

              Method update_fields has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                    def update_fields(entity, entity_documentation, fields)
                      # update all fields, but only with allowed values (according to the doc)
                      unless fields.nil?
                        fields.each do |key, value|
                          # only continue if the value can be assigned to the entity
              Severity: Minor
              Found in lib/nucleus_api/api/helpers/form_processing_helper.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 swagger-oauth.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var appName;
              var popupMask;
              var popupDialog;
              var clientId;
              var realm;
              Severity: Minor
              Found in public/swagger-ui/lib/swagger-oauth.js - About 3 hrs to fix

                Function marked has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function marked(src, opt, callback) {
                  if (callback || typeof opt === 'function') {
                    if (!callback) {
                      callback = opt;
                      opt = null;
                Severity: Major
                Found in public/swagger-ui/lib/marked.js - About 2 hrs to fix

                  Method un_zip has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def un_zip(file, destination_path)
                        extracted = 0
                        Zip::File.open(file) do |zip_file|
                          # Handle entries one by one
                          zip_file.each do |entry|
                  Severity: Minor
                  Found in lib/nucleus/core/common/files/archive_extractor.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

                  Class CloudFoundryV2 has 23 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class CloudFoundryV2 < Stub
                          # Cloud Foundry, operations for the application's addons
                          module Services
                            # @see Stub#services
                            def services
                  Severity: Minor
                  Found in lib/nucleus/adapters/v1/cloud_foundry_v2/services.rb - About 2 hrs to fix

                    Function onOAuthComplete has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
                      if(token) {
                        if(token.error) {
                          var checkbox = $('input[type=checkbox],.secured')
                          checkbox.each(function(pos){
                    Severity: Major
                    Found in public/swagger-ui/lib/swagger-oauth.js - About 2 hrs to fix

                      Method deploy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def deploy(file, file_compression_format)
                              extractor = Nucleus::ArchiveExtractor.new
                              unless extractor.supports? file_compression_format
                                raise Errors::AdapterRequestError,
                                      'Unsupported format of the application archive'
                      Severity: Minor
                      Found in lib/nucleus/core/file_handling/git_deployer.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 un_tar_gz has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def un_tar_gz(file, destination_path)
                            extracted = 0
                            # unzip the archive into the repo, closes resource automatically
                            # Thanks to Draco Ater: http://stackoverflow.com/a/19139114/1009436
                            Gem::Package::TarReader.new(Zlib::GzipReader.open(file)) do |tar|
                      Severity: Minor
                      Found in lib/nucleus/core/common/files/archive_extractor.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 save_file_from_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def self.save_file_from_data(file, io, force = true, expected_file_md5_hex = nil)
                              if File.exist? file
                                unless force
                                  # fail if file exists, but shall not be replaced
                                  raise Nucleus::FileExistenceError, 'File already exists' if expected_file_md5_hex.nil?
                      Severity: Minor
                      Found in lib/nucleus/core/file_handling/file_manager.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 state_created? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def state_created?(app, gear_groups, deployments)
                                  # this state exists, but only within the first seconds before the original deployment is applied
                                  return true if gear_groups[0][:gears].all? { |gear| gear[:state] == 'new' }
                      
                                  if app[:keep_deployments].to_i > 1
                      Severity: Minor
                      Found in lib/nucleus/adapters/v1/openshift_v2/app_states.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

                      Function onOAuthComplete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      window.onOAuthComplete = function onOAuthComplete(token,OAuthSchemeKey) {
                        if(token) {
                          if(token.error) {
                            var checkbox = $('input[type=checkbox],.secured')
                            checkbox.each(function(pos){
                      Severity: Minor
                      Found in public/swagger-ui/lib/swagger-oauth.js - 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 set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def set(entity)
                              update_timestamps(entity)
                      
                              # finally save to the DB
                              if entity.id.nil?
                      Severity: Minor
                      Found in lib/nucleus_api/persistence/store.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 setup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def setup
                            # perform the setup only once
                            return if @adapters
                      
                            # Initialize the application (import adapters, load DAOs, ...)
                      Severity: Minor
                      Found in lib/nucleus/adapter_resolver.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

                      Severity
                      Category
                      Status
                      Source
                      Language