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
- 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
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
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
- 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
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'
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.
- 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_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.
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
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
- 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 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
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"
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 }
- 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 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 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 }
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?
Avoid deeply nested control flow statements. Open
completion_proc.call(build_number, false) if completion_proc
Avoid deeply nested control flow statements. Open
completion_proc.call(nil, true) if completion_proc
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
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]}"
- 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
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|
- 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
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(
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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(
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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}/
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76