arangamani/jenkins_api_client

View on GitHub

Showing 76 of 76 total issues

Method refresh_crumbs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def refresh_crumbs(force_refresh = false)
      # Quick check to see if someone has changed XSS settings and not
      # restarted us
      if force_refresh || @crumbs_enabled.nil?
        old_crumbs_setting = @crumbs_enabled
Severity: Minor
Found in lib/jenkins_api_client/client.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 make_http_request has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def make_http_request(request, follow_redirect = @follow_redirects)
      request.basic_auth @username, @password if @username
      request['Cookie'] = @cookies if @cookies

      if @proxy_ip
Severity: Minor
Found in lib/jenkins_api_client/client.rb - About 1 hr to fix

    Method skype_notification has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def skype_notification(params, xml)
            params[:skype_strategy] = case params[:skype_strategy]
            when "all"
              "ALL"
            when "failure"
    Severity: Minor
    Found in lib/jenkins_api_client/job.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 scm_git has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def scm_git(params, xml)
            xml.scm(:class => "hudson.plugins.git.GitSCM") {
              xml.configVersion "2"
              xml.userRemoteConfigs {
                xml.send("hudson.plugins.git.UserRemoteConfig") {
    Severity: Minor
    Found in lib/jenkins_api_client/job.rb - About 1 hr to fix

      Method api_post_request has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def api_post_request(url_prefix, form_data = {}, raw_response = false)
            retries = @crumb_max_retries
            begin
              refresh_crumbs
      
      
      Severity: Minor
      Found in lib/jenkins_api_client/client.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_upstream_projects has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_upstream_projects(job_name,
                                      upstream_projects,
                                      threshold, overwrite = false)
              @logger.info "Adding #{upstream_projects.inspect} as upstream" +
                               " projects for '#{job_name}' with the threshold of '#{threshold}'" +
      Severity: Minor
      Found in lib/jenkins_api_client/job.rb - About 1 hr to fix

        Method get_build_id_the_old_way has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def get_build_id_the_old_way(expected_build_id, opts)
                # Try to wait until the build starts so we can mimic queue
                # Wait for the build to start
                build_start_timeout = opts['build_start_timeout']
                poll_interval = opts['poll_interval'] || 2
        Severity: Minor
        Found in lib/jenkins_api_client/job.rb - About 1 hr to fix

          Method add_downstream_projects has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def add_downstream_projects(job_name,
                                            downstream_projects,
                                            threshold, overwrite = false)
                  @logger.info "Adding #{downstream_projects.inspect} as downstream" +
                    " projects for '#{job_name}' with the threshold of '#{threshold}'" +
          Severity: Minor
          Found in lib/jenkins_api_client/job.rb - About 1 hr to fix

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

                  def chain(job_names, threshold, criteria, parallel = 1)
                    raise "Parallel jobs should be at least 1" if parallel < 1
                    unchain(job_names)
            
                    @logger.info "Chaining jobs: #{job_names.inspect}" +
            Severity: Minor
            Found in lib/jenkins_api_client/job.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 build has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def build(job_name, params={}, opts = {})
                    if opts.nil? || opts.is_a?(FalseClass)
                      opts = {}
                    elsif opts.is_a?(TrueClass)
                      opts = { 'build_start_timeout' => @client_timeout }
            Severity: Minor
            Found in lib/jenkins_api_client/job.rb - About 1 hr to fix

              Method api_post_request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def api_post_request(url_prefix, form_data = {}, raw_response = false)
                    retries = @crumb_max_retries
                    begin
                      refresh_crumbs
              
              
              Severity: Minor
              Found in lib/jenkins_api_client/client.rb - About 1 hr to fix

                Method post_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def post_data(url_prefix, data, content_type)
                      retries = @crumb_max_retries
                      begin
                        refresh_crumbs
                
                
                Severity: Minor
                Found in lib/jenkins_api_client/client.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 console has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def console(job)
                        @client = Helper.setup(parent_options)
                        # Print progressive console output
                        response = @client.job.get_console_output(job)
                        puts response['output'] unless response['more']
                Severity: Minor
                Found in lib/jenkins_api_client/cli/job.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 list_available has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def list_available(filters = {})
                        supported_filters = [:category, :dependency]
                        filter_plural_map = {
                          :dependency => "dependencies",
                          :category => "categories"
                Severity: Minor
                Found in lib/jenkins_api_client/plugin_manager.rb - About 1 hr to fix

                  Method post_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def post_data(url_prefix, data, content_type)
                        retries = @crumb_max_retries
                        begin
                          refresh_crumbs
                  
                  
                  Severity: Minor
                  Found in lib/jenkins_api_client/client.rb - About 1 hr to fix

                    Method compare_versions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def compare_versions(version_a, version_b)
                          if version_a == version_b
                            return 0
                          else
                            version_a_d = deconstruct_version_string(version_a)
                    Severity: Minor
                    Found in lib/jenkins_api_client/client.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

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

                          rescue Exceptions::ForbiddenException => e
                            refresh_crumbs(true)
                    
                            if @crumbs_enabled
                              @logger.info "Retrying: #{@crumb_max_retries - retries + 1} out of" +
                    Severity: Minor
                    Found in lib/jenkins_api_client/client.rb and 1 other location - About 50 mins to fix
                    lib/jenkins_api_client/client.rb on lines 522..538

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

                    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

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

                          rescue Exceptions::ForbiddenException => e
                            refresh_crumbs(true)
                    
                            if @crumbs_enabled
                              @logger.info "Retrying: #{@crumb_max_retries - retries + 1} out of" +
                    Severity: Minor
                    Found in lib/jenkins_api_client/client.rb and 1 other location - About 50 mins to fix
                    lib/jenkins_api_client/client.rb on lines 461..477

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

                    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

                    Avoid deeply nested control flow statements.
                    Open

                                        @logger.info "Still waiting..." if attempts % 5 == 0
                    Severity: Major
                    Found in lib/jenkins_api_client/job.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      completion_proc.call(nil, false) if completion_proc
                      Severity: Major
                      Found in lib/jenkins_api_client/job.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language