Showing 748 of 748 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
def downgrade(ta, td, a, d)
unless ta["db"].key? "max_pool_size"
a["db"].delete "max_pool_size"
end
unless ta["db"].key? "min_pool_size"
- 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 50.
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 downgrade(ta, td, a, d)
a["mysql"].delete("innodb_buffer_pool_size") unless ta["mysql"].key? "innodb_buffer_pool_size"
a["mysql"].delete("max_connections") unless ta["mysql"].key? "max_connections"
a["mysql"].delete("tmp_table_size") unless ta["mysql"].key? "tmp_table_size"
a["mysql"].delete("max_heap_table_size") unless ta["mysql"].key? "max_heap_table_size"
- 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 50.
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
Method downgrade
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def downgrade ta, td, a, d
if a.key? "ml2_type_drivers"
if a["ml2_type_drivers"].include? "vlan"
a["networking_mode"] = "vlan"
elsif a["ml2_type_drivers"].include? "gre"
- Create a ticketCreate a ticket
Method upgrade
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade(ta, td, a, d)
a["ha"] = ta["ha"] unless a.key? "ha"
# Cookbooks expect the 'enabled' flag under high level 'ha' map
# - only during the upgrade it was moved under 'ha/mysql'
- Create a ticketCreate a ticket
Method upgrade
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade ta, td, a, d
a["db"] = ta["db"]
# we use a class variable to set the same password in the proposal and in the
# role; we also try to import the database password from the node that was
- Create a ticketCreate a ticket
Method create_proposal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_proposal
@logger.debug("Ceilometer create_proposal: entering")
base = super
base["attributes"][@bc_name]["database_instance"] = find_dep_proposal("database", true)
- Create a ticketCreate a ticket
Method validate_vxlan
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_vxlan(vxlan_settings)
if vxlan_settings["vni_start"] < 0 || vxlan_settings["vni_start"] > 16777215
validation_error I18n.t("barclamp.#{@bc_name}.validation.vxlan_vni_start")
end
if vxlan_settings["vni_end"] < 0 || vxlan_settings["vni_end"] > 16777215
- Create a ticketCreate a ticket
Method action_create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_create
# create
# new_resource can have password defined or not;
# search a user
# if found,
- Create a ticketCreate a ticket
Method upgrade
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgrade ta, td, a, d
if a["networking_mode"]
a["ml2_type_drivers"] = [a["networking_mode"]]
a["ml2_type_drivers_default_provider_network"] = a["networking_mode"]
a["ml2_type_drivers_default_tenant_network"] = a["networking_mode"]
- Create a ticketCreate a ticket
Method validate_cisco_aci
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_cisco_aci(proposal)
# Checks for Cisco ACI ml2 driver
ml2_mechanism_drivers = proposal["attributes"]["neutron"]["ml2_mechanism_drivers"]
ml2_type_drivers = proposal["attributes"]["neutron"]["ml2_type_drivers"]
- Create a ticketCreate a ticket
Method validate_proposal_after_save
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_proposal_after_save(proposal)
validate_one_for_role proposal, "designate-server"
validate_one_for_role proposal, "designate-worker"
designate_bc = proposal["attributes"][@bc_name]
- Create a ticketCreate a ticket
Method apply_role_pre_chef_call
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_role_pre_chef_call(old_role, role, all_nodes)
@logger.debug("Neutron apply_role_pre_chef_call: entering #{all_nodes.inspect}")
return if all_nodes.empty?
net_svc = NetworkService.new @logger
- Create a ticketCreate a ticket
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (type_drivers.indexOf('vlan') == -1) {
type_drivers.push('vlan')
$('#ml2_type_drivers').val(type_drivers).trigger('change');
}
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (type_drivers.indexOf('vlan') == -1) {
type_drivers.push('vlan');
$('#ml2_type_drivers').val(type_drivers).trigger('change');
}
- 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
if node[:barbican][:ha][:enabled]
admin_address = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
bind_host = admin_address
bind_port = node[:barbican][:ha][:ports][:api]
else
- 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 47.
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 node[:keystone][:ha][:enabled]
admin_address = Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
bind_admin_host = admin_address
bind_admin_port = node[:keystone][:ha][:ports][:admin_port]
else
- 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 47.
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 3 locations. Consider refactoring. Open
def upgrade ta, td, a, d
a["volume_defaults"]["rbd"]["admin_keyring"] = ta["volume_defaults"]["rbd"]["admin_keyring"]
a["volumes"].each do |volume|
next if volume["backend_driver"] != "rbd"
volume["rbd"]["admin_keyring"] = ta["volume_defaults"]["rbd"]["admin_keyring"]
- 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 46.
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 3 locations. Consider refactoring. Open
def upgrade(ta, td, a, d)
a["volume_defaults"]["vmware"]["cluster_name"] = ta["volume_defaults"]["vmware"]["cluster_name"]
a["volumes"].each do |volume|
next if volume["backend_driver"] != "vmware"
volume["vmware"]["cluster_name"] = ta["volume_defaults"]["vmware"]["cluster_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 46.
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 3 locations. Consider refactoring. Open
def upgrade(ta, td, a, d)
a["volume_defaults"]["rbd"]["flatten_volume_from_snapshot"] = \
ta["volume_defaults"]["rbd"]["flatten_volume_from_snapshot"]
a["volumes"].each do |volume|
- 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 46.
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
Method compute_deltas
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def compute_deltas
req_disks = @new_resource.disks
keyed_req = {} # for easy lookup, make a map of the requested disks
cur = @ring_test
name = @new_resource.name
- Read upRead up
- Create a ticketCreate a ticket
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"