arangamani/jenkins_api_client

View on GitHub
lib/jenkins_api_client/job.rb

Summary

Maintainability
F
2 wks
Test Coverage

Method get_build_params has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
Open

      def get_build_params(job_name)
        @logger.info "Obtaining the build params of '#{job_name}'"
        xml = get_config(job_name)
        n_xml = Nokogiri::XML(xml)
        params = n_xml.xpath("//parameterDefinitions").first
Severity: Minor
Found in lib/jenkins_api_client/job.rb - About 2 days 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 job.rb has 1112 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'jenkins_api_client/urihelper'

module JenkinsApi
  class Client
    # This class communicates with the Jenkins "/job" API to obtain details
Severity: Major
Found in lib/jenkins_api_client/job.rb - About 2 days to fix

    Method get_build_id_from_queue has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
    Open

          def get_build_id_from_queue(response, expected_build_id, opts)
            # If we get this far the API hasn't detected an error response (it would raise Exception)
            # So no need to check response code
            # Obtain the queue ID from the location
            # header and wait till the build is moved to one of the executors and a
    Severity: Minor
    Found in lib/jenkins_api_client/job.rb - About 1 day 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 Job has 78 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Job
          include JenkinsApi::UriHelper
    
          # Version that jenkins started to include queued build info in build response
          JENKINS_QUEUE_ID_SUPPORT_VERSION = '1.519'
    Severity: Major
    Found in lib/jenkins_api_client/job.rb - About 1 day to fix

      Method build_freestyle_config has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_freestyle_config(params)
              # Supported SCM providers
              supported_scm = ["git", "subversion", "cvs"]
      
              # Set default values for params that are not specified.
      Severity: Minor
      Found in lib/jenkins_api_client/job.rb - About 1 day 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_freestyle_config has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_freestyle_config(params)
              # Supported SCM providers
              supported_scm = ["git", "subversion", "cvs"]
      
              # Set default values for params that are not specified.
      Severity: Major
      Found in lib/jenkins_api_client/job.rb - About 3 hrs to fix

        Method get_build_params has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def get_build_params(job_name)
                @logger.info "Obtaining the build params of '#{job_name}'"
                xml = get_config(job_name)
                n_xml = Nokogiri::XML(xml)
                params = n_xml.xpath("//parameterDefinitions").first
        Severity: Major
        Found in lib/jenkins_api_client/job.rb - About 3 hrs to fix

          Method get_build_id_the_old_way has a Cognitive Complexity of 24 (exceeds 5 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 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

          Method get_build_id_from_queue has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def get_build_id_from_queue(response, expected_build_id, opts)
                  # If we get this far the API hasn't detected an error response (it would raise Exception)
                  # So no need to check response code
                  # Obtain the queue ID from the location
                  # header and wait till the build is moved to one of the executors and a
          Severity: Major
          Found in lib/jenkins_api_client/job.rb - About 2 hrs to fix

            Method skype_notification has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def skype_notification(params, xml)
                    params[:skype_strategy] = case params[:skype_strategy]
                    when "all"
                      "ALL"
                    when "failure"
            Severity: Major
            Found in lib/jenkins_api_client/job.rb - About 2 hrs to fix

              Method build has a Cognitive Complexity of 16 (exceeds 5 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 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

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

                        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

                            Avoid deeply nested control flow statements.
                            Open

                                                progress_proc.call(build_start_timeout, (Time.now.to_i - start), attempts) if progress_proc
                            Severity: Major
                            Found in lib/jenkins_api_client/job.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      choices << choice_child.content.strip \
                                                        unless choice_child.content.strip.empty?
                              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(build_number, false) if completion_proc
                                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, true) if completion_proc
                                  Severity: Major
                                  Found in lib/jenkins_api_client/job.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    rescue JenkinsApi::Exceptions::ApiException => e
                                                      completion_proc.call(nil, false) if completion_proc
                                                      @logger.warn "Error while attempting to cancel pending job for '#{job_name}'. #{e.class} #{e}"
                                                      raise
                                    Severity: Major
                                    Found in lib/jenkins_api_client/job.rb - About 45 mins to fix

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

                                            def scm_cvs(params, xml)
                                              xml.scm(:class => "hudson.scm.CVSSCM",
                                                      :plugin => "cvs@1.6") {
                                                xml.cvsroot "#{params[:scm_url]}"
                                                xml.module "#{params[:scm_module]}"
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                            def list(filter, ignorecase = true)
                                              @logger.info "Obtaining jobs matching filter '#{filter}'"
                                              response_json = @client.api_get_request("")
                                              jobs = []
                                              response_json["jobs"].each do |job|
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.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

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

                                              if n_xml.xpath("//hudson.tasks.Mailer").empty?
                                                p_xml = Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |b_xml|
                                                  notification_email(params, b_xml)
                                                end
                                                email_xml = Nokogiri::XML(p_xml.to_xml).xpath(
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 45 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 433..441

                                      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 2 locations. Consider refactoring.
                                      Open

                                              if n_xml.xpath("//hudson.plugins.skype.im.transport.SkypePublisher").empty?
                                                p_xml = Nokogiri::XML::Builder.new(:encoding => "UTF-8") do |b_xml|
                                                  skype_notification(params, b_xml)
                                                end
                                                skype_xml = Nokogiri::XML(p_xml.to_xml).xpath(
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 45 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 395..403

                                      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 4 locations. Consider refactoring.
                                      Open

                                            def unblock_build_when_upstream_building(job_name)
                                              @logger.info "Unblocking builds of '#{job_name}' when upstream" +
                                                " projects are building"
                                              xml = get_config(job_name)
                                              n_xml = Nokogiri::XML(xml)
                                      Severity: Major
                                      Found in lib/jenkins_api_client/job.rb and 3 other locations - About 40 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1169..1178
                                      lib/jenkins_api_client/job.rb on lines 1188..1197
                                      lib/jenkins_api_client/job.rb on lines 1207..1216

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

                                      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 4 locations. Consider refactoring.
                                      Open

                                            def block_build_when_downstream_building(job_name)
                                              @logger.info "Blocking builds of '#{job_name}' when downstream" +
                                                " projects are building"
                                              xml = get_config(job_name)
                                              n_xml = Nokogiri::XML(xml)
                                      Severity: Major
                                      Found in lib/jenkins_api_client/job.rb and 3 other locations - About 40 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1188..1197
                                      lib/jenkins_api_client/job.rb on lines 1207..1216
                                      lib/jenkins_api_client/job.rb on lines 1226..1235

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

                                      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 4 locations. Consider refactoring.
                                      Open

                                            def block_build_when_upstream_building(job_name)
                                              @logger.info "Blocking builds of '#{job_name}' when upstream" +
                                                " projects are building"
                                              xml = get_config(job_name)
                                              n_xml = Nokogiri::XML(xml)
                                      Severity: Major
                                      Found in lib/jenkins_api_client/job.rb and 3 other locations - About 40 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1169..1178
                                      lib/jenkins_api_client/job.rb on lines 1188..1197
                                      lib/jenkins_api_client/job.rb on lines 1226..1235

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

                                      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 4 locations. Consider refactoring.
                                      Open

                                            def unblock_build_when_downstream_building(job_name)
                                              @logger.info "Unblocking builds of '#{job_name}' when downstream" +
                                                " projects are building"
                                              xml = get_config(job_name)
                                              n_xml = Nokogiri::XML(xml)
                                      Severity: Major
                                      Found in lib/jenkins_api_client/job.rb and 3 other locations - About 40 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1169..1178
                                      lib/jenkins_api_client/job.rb on lines 1207..1216
                                      lib/jenkins_api_client/job.rb on lines 1226..1235

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

                                      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

                                                    param.children.each do |value|
                                                      param_hash[:name] = value.content if value.name == "name"
                                                      if value.name == "description"
                                                        param_hash[:description] = value.content
                                                      end
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 35 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1295..1301

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

                                      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

                                                    param.children.each do |value|
                                                      param_hash[:name] = value.content if value.name == "name"
                                                      if value.name == "description"
                                                        param_hash[:description] = value.content
                                                      end
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 35 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 1284..1290

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

                                      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

                                              response_json["jobs"].each do |job|
                                                if ignorecase
                                                  jobs << job["name"] if job["name"] =~ /#{filter}/i
                                                else
                                                  jobs << job["name"] if job["name"] =~ /#{filter}/
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 35 mins to fix
                                      lib/jenkins_api_client/view.rb on lines 188..192

                                      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

                                                      rescue JenkinsApi::Exceptions::ApiException => e
                                                        completion_proc.call(nil, false) if completion_proc
                                                        @logger.warn "Error while attempting to cancel pending job for '#{job_name}'. #{e.class} #{e}"
                                                        raise
                                                      end
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 15 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 974..979

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

                                      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

                                                  rescue JenkinsApi::Exceptions::ApiException => e
                                                    # Jenkins Api threw an error at us
                                                    completion_proc.call(nil, false) if completion_proc
                                                    @logger.warn "Problem while waiting for '#{job_name}' build to start.  #{e.class} #{e}"
                                                    raise
                                      Severity: Minor
                                      Found in lib/jenkins_api_client/job.rb and 1 other location - About 15 mins to fix
                                      lib/jenkins_api_client/job.rb on lines 962..966

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

                                      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

                                      There are no issues that match your filters.

                                      Category
                                      Status