Showing 368 of 368 total issues
Method load_events
has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring. Open
def load_events
@source_type = params[:source_type].nil? ? "" : params[:source_type]
@pool_select = params[:pool_select].nil? ? "" : params[:pool_select]
@provider_select =
params[:provider_select].nil? ? "" : params[:provider_select]
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
class << self
include CommonFilterMethods
end
# type-specific associations to allow filter includes
- 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 307.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
class << self
include CommonFilterMethods
end
# type-specific associations to allow filter includes
- 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 307.
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
File deployment.rb
has 533 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'util/deployable_xml'
require 'util/config_server_util'
class Deployment < ActiveRecord::Base
acts_as_paranoid
Class Deployment
has 54 methods (exceeds 20 allowed). Consider refactoring. Open
class Deployment < ActiveRecord::Base
acts_as_paranoid
include Alberich::PermissionedObject
class << self
Class Instance
has 50 methods (exceeds 20 allowed). Consider refactoring. Open
class Instance < ActiveRecord::Base
acts_as_paranoid
class << self
include CommonFilterMethods
File deployments_controller.rb
has 433 lines of code (exceeds 250 allowed). Consider refactoring. Open
class DeploymentsController < ApplicationController
before_filter :require_user
before_filter :load_deployments, :only => [:index, :show]
before_filter :load_deployment, :only => [:edit, :update]
before_filter :check_inaccessible_instances, :only => :multi_stop
Method populate_realms
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def populate_realms
reload
# if the provider is not running, mark as unavailable and don't refresh its
# realms
- 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 providers_controller.rb
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ProvidersController < ApplicationController
before_filter :require_user
before_filter :load_providers, :only => [:index, :show, :new, :edit, :create, :update]
before_filter :load_providers_types, :only => [:new, :edit, :update, :create]
before_filter ResourceLinkFilter.new({ :provider => :provider_type }),
Method path_to
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
def path_to(page_name)
case page_name
when /^the home\s?page$/
'/'
File instance.rb
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'util/deployable_xml'
require 'util/instance_config_xml'
class Instance < ActiveRecord::Base
acts_as_paranoid
File pools_controller.rb
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PoolsController < ApplicationController
include QuotaAware
before_filter :require_user
before_filter :set_params_and_header, :only => [:index, :show]
before_filter :load_pools, :only => [:show]
Class ApplicationController
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
class ActionError < RuntimeError; end
class PartialSuccessError < RuntimeError
attr_reader :failures, :successes
def initialize(msg, failures={}, successes=[])
Method after_update
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def after_update(instance)
# This can get stale, so reload it -- if it exists
instance.deployment.reload if instance.deployment
if instance.state_changed?
event = Event.new(:source => instance, :event_time => DateTime.now,
- 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 export_logs
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def export_logs
load_events
load_headers
csvm = get_csv_class
- 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 hardware_profiles_controller.rb
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
class HardwareProfilesController < ApplicationController
before_filter :require_user
before_filter :load_hardware_profiles, :only => [:index, :show]
before_filter :setup_new_hardware_profile, :only => [:new]
before_filter :setup_hardware_profile, :only => [:new, :create, :matching_provider_hardware_profiles, :edit, :update]
Method statistics
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
def statistics
@statistics = Hash.new
@providers.each do |provider|
@statistics[provider.id] = {
"running_instances" => 0,
Method create
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:cancel]
redirect_to polymorphic_path([Catalog.find(Array(params[:catalog_id])[0]), Deployable])
return
end
- 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
queryParams: function() {
var paramsToInclude = ['deployments_preset_filter', 'deployments_search', 'page'];
var result = Conductor.extractQueryParams(paramsToInclude);
// If there is no URL param for the preset filter, we still need to merge in the preset 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 117.
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
queryParams: function() {
var paramsToInclude = ['instances_preset_filter', 'instances_search', 'page'];
var result = Conductor.extractQueryParams(paramsToInclude);
// If there is no URL param for the preset filter, we still need to merge in the preset 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 117.
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