Showing 6,062 of 6,062 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
def stringify_keys!(recursive = false)
keys.each do |key|
value = delete(key)
key = key.respond_to?(:to_s) ? key.to_s : key
- Read upRead up
- Create a ticketCreate a ticket
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 55.
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
def symbolize_keys!(recursive = false)
keys.each do |key|
value = delete(key)
key = key.respond_to?(:to_sym) ? key.to_sym : key
- Read upRead up
- Create a ticketCreate a ticket
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 55.
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
Function highlightWorker
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function highlightWorker() {
var end = +new Date + options.workTime;
var foundWork = work.length;
while (work.length) {
if (!lines[showingFrom].stateAfter) var task = showingFrom;
- Create a ticketCreate a ticket
Function _attachHandlers
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_attachHandlers: function(inst) {
var stepMonths = this._get(inst, "stepMonths"),
id = "#" + inst.id.replace( /\\\\/g, "\\" );
inst.dpDiv.find("[data-handler]").map(function () {
var handler = {
- Create a ticketCreate a ticket
Function option
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
- Create a ticketCreate a ticket
Function _destroy
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_destroy: function() {
var contents;
// clean up main element
this.element
- Create a ticketCreate a ticket
Function offsetString
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
offsetString = function(offset) {
try {
return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
offset, $.datepicker._getFormatConfig(inst));
}
- Create a ticketCreate a ticket
Method node_state_valid_for_role?
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.node_state_valid_for_role?(node, barclamp, role)
# We always want deployer-client, both for heartbeat but also because it
# sets up the ability to use the barclamp library
return true if role == "deployer-client"
- Create a ticketCreate a ticket
Function applyPlacement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
- Create a ticketCreate a ticket
Method upgrade!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade!
if upgrading?
return {
status: :unprocessable_entity,
message: I18n.t("api.crowbar.upgrade_ongoing")
- Create a ticketCreate a ticket
Method execute_scripts_and_wait_for_finish
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_scripts_and_wait_for_finish(nodes, script, seconds)
nodes.each do |node|
Rails.logger.info("Executing script '#{script}' at #{node.name}")
ssh_status = node.ssh_cmd(script).first
if ssh_status != 200
- Create a ticketCreate a ticket
Method keystone_migrate_and_restart
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def keystone_migrate_and_restart(node)
save_node_action("Making sure that Keystone is stopped on non-upgraded nodes")
cluster = node[:pacemaker][:config][:environment]
- Create a ticketCreate a ticket
Method cancel
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cancel
if Api::Upgrade.cancel
head :ok
else
render json: {
- Create a ticketCreate a ticket
Method export
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export
@batch = Batch::Export.new(
export_params
)
- Create a ticketCreate a ticket
Method proposal_delete
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def proposal_delete
code, message = @service_object.proposal_delete(
params[:id]
)
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
def proposal_show(name)
usage(-1) if name.nil? or name == ""
struct = get_json("/proposals/#{name}")
- Read upRead up
- Create a ticketCreate a ticket
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 54.
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
def show(name)
usage(-1) if name.nil? or name == ""
struct = get_json("/#{name}")
- Read upRead up
- Create a ticketCreate a ticket
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 54.
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
Function promise
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
- Create a ticketCreate a ticket
Function handlers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
handlers: function( event, handlers ) {
var sel, handleObj, matches, i,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
- Create a ticketCreate a ticket
Function attr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
attr: function( elem, name, value ) {
var hooks, ret,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
- Create a ticketCreate a ticket