arangamani/jenkins_api_client

View on GitHub

Showing 56 of 76 total issues

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

        Consider simplifying this complex logical expression.
        Open

                if version_a_d[0] > version_b_d[0] ||
                  (version_a_d[0] == version_b_d[0] && version_a_d[1] > version_b_d[1]) ||
                  (version_a_d[0] == version_b_d[0] && version_a_d[1] == version_b_d[1] && version_a_d[2] > version_b_d[2])
                  return 1
                else
        Severity: Major
        Found in lib/jenkins_api_client/client.rb - About 40 mins to fix

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

                def wait_for_ready
                  Timeout::timeout(@timeout) do
                    while true do
                      response = @client.get_root
                      @logger.info "Waiting for jenkins to restart..."
          Severity: Minor
          Found in lib/jenkins_api_client/system.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 create_list_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def create_list_view(params)
                  # Name is a required parameter. Raise an error if not specified
                  raise ArgumentError, "Name is required for creating view" \
                    unless params.is_a?(Hash) && params[:name]
                  create(params[:name], "listview")
          Severity: Minor
          Found in lib/jenkins_api_client/view.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 list_available has a Cognitive Complexity of 7 (exceeds 5 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 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 list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def list(filter = nil, ignorecase = true, slaveonly = false)
                  @logger.info "Obtaining nodes from jenkins matching filter '#{filter}'"
                  node_names = []
                  response_json = @client.api_get_request("/computer")
                  response_json["computer"].each do |computer|
          Severity: Minor
          Found in lib/jenkins_api_client/node.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 exec_cli has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def exec_cli(command, args = [])
                base_dir = File.dirname(__FILE__)
                server_url = "http://#{@server_ip}:#{@server_port}/#{@jenkins_path}"
                cmd = "java -jar #{base_dir}/../../java_deps/jenkins-cli.jar -s #{server_url}"
                cmd << " -i #{@identity_file}" if @identity_file && !@identity_file.empty?
          Severity: Minor
          Found in lib/jenkins_api_client/client.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 setup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.setup(options)
                  if options[:username] && options[:server_ip] && \
                    (options[:password] || options[:password_base64])
                    creds = options
                  elsif options[:creds_file]
          Severity: Minor
          Found in lib/jenkins_api_client/cli/helper.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 get_artifacts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_artifacts(job_name, dldir, build_number = nil)
                @artifacts = job.find_artifacts(job_name,build_number)
                results = []
                @artifacts.each do |artifact|
                  uri = URI.parse(artifact)
          Severity: Minor
          Found in lib/jenkins_api_client/client.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 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 online_offline_lists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def online_offline_lists(filter = nil, ignorecase = true)
                  @logger.info "Obtaining nodes from jenkins matching filter '#{filter}'"
                  offline_node_names = []
                  online_node_names = []
                  response_json = @client.api_get_request("/computer")
          Severity: Minor
          Found in lib/jenkins_api_client/node.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_installed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def list_installed(filters = {})
                  supported_filters = [
                    :active, :bundled, :deleted, :downgradable, :enabled, :hasUpdate,
                    :pinned
                  ]
          Severity: Minor
          Found in lib/jenkins_api_client/plugin_manager.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 views based on filter '#{filter}'"
                  view_names = []
                  response_json = @client.api_get_request("", "tree=views[name]")
                  response_json["views"].each { |view|
          Severity: Minor
          Found in lib/jenkins_api_client/view.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

          Severity
          Category
          Status
          Source
          Language