Showing 56 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
- Read upRead up
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
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"
- Read upRead up
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") {
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
- Read upRead up
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}'" +
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
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}'" +
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}" +
- Read upRead up
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 }
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
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
- Read upRead up
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']
- Read upRead up
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"
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
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)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
@logger.info "Still waiting..." if attempts % 5 == 0
Avoid deeply nested control flow statements. Open
completion_proc.call(nil, false) if completion_proc
Avoid deeply nested control flow statements. Open
progress_proc.call(build_start_timeout, (Time.now.to_i - start), attempts) if progress_proc
Avoid deeply nested control flow statements. Open
choices << choice_child.content.strip \
unless choice_child.content.strip.empty?