Showing 748 of 748 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
database_user "grant privileges to the #{grafana_db[:user]} database user" do
connection db_settings[:connection]
database_name grafana_db[:database]
username grafana_db[:user]
password grafana_db[:password]
- 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 53.
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
database_user "grant privileges to the #{d[:user]} database user" do
connection db_settings[:connection]
database_name d[:database]
username d[:user]
password d[:password]
- 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 53.
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
database_user "grant privileges to the #{monasca_db[:user]} database user" do
connection db_settings[:connection]
database_name monasca_db[:database]
username monasca_db[:user]
password monasca_db[:password]
- 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 53.
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 networking_plugin_check
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function networking_plugin_check() {
switch ($('#networking_plugin').val()) {
case 'ml2':
$('#vmware_container').hide();
$('#ml2_mechanism_drivers_container').show();
- Create a ticketCreate a ticket
Method downgrade
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def downgrade(ta, td, a, d)
a["ldap"].delete("user_description_attribute")
a["ldap"].delete("group_members_are_ids")
a["ldap"].delete("user_enabled_emulation_use_group_config")
a["ldap"]["project_tree_dn"] = ta["ldap"]["project_tree_dn"]
- Create a ticketCreate a ticket
Method swift_settings
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def swift_settings(node, glance)
swift = CrowbarUtilsSearch.node_search_with_cache(node, "roles:swift-proxy").first || {}
# configure swift only if direct deploy interface is enabled
return unless swift && node[:ironic][:enabled_deploy_interfaces].include?("direct")
- Create a ticketCreate a ticket
Method auth_body
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auth_body(auth)
body = {
auth: {
identity: {
methods: ["password"],
- Create a ticketCreate a ticket
Method set_retention_policy
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.set_retention_policy(db_name, policy_name, duration, replicas,
shard_group_duration: nil, default: nil,
**options)
rps_available = InfluxDBHelper.get_retention_policies(db_name, **options)
rp = rps_available.find { |rp| rp['name'] == policy_name }
- Create a ticketCreate a ticket
Method create_proposal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_proposal
@logger.debug("Magnum create_proposal: entering")
base = super
nodes = NodeObject.all
- Create a ticketCreate a ticket
Method apply_role_pre_chef_call
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_role_pre_chef_call(old_role, role, all_nodes)
@logger.debug("Keystone apply_role_pre_chef_call: entering #{all_nodes.inspect}")
server_elements, server_nodes, ha_enabled = role_expand_elements(role, "keystone-server")
- Create a ticketCreate a ticket
Method create_proposal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_proposal
@logger.debug("Cinder create_proposal: entering")
base = super
nodes = NodeObject.all
- Create a ticketCreate a ticket
Method apply_role_pre_chef_call
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_role_pre_chef_call(old_role, role, all_nodes)
@logger.debug("octavia apply_role_pre_chef_call: entering #{all_nodes.inspect}")
return if all_nodes.empty?
if old_role
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
pacemaker_primitive evacuate_primitive do
agent "ocf:openstack:NovaEvacuate"
params ({
"auth_url" => keystone_settings["internal_auth_url"],
# "region_name" => keystone_settings["endpoint_region"],
- 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 51.
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
pacemaker_primitive nova_primitive do
agent "ocf:openstack:NovaCompute"
params ({
"auth_url" => keystone_settings["internal_auth_url"],
# "region_name" => keystone_settings["endpoint_region"],
- 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 51.
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 (values.indexOf($('#ml2_type_drivers_default_provider_network').val()) < 0) {
$('#ml2_type_drivers_default_provider_network').val(values[0]).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 57.
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 (values.indexOf($('#ml2_type_drivers_default_provider_network').val()) < 0) {
$('#ml2_type_drivers_default_tenant_network').val(values[0]).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 57.
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 action_create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def action_create
begin
unless exists?(:logins)
if @new_resource.windows_user
db.execute("CREATE LOGIN [#{@new_resource.username}] FROM WINDOWS").do
- 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"
Further reading
Method network_settings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def network_settings(node)
@ip ||= Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address
@cluster_admin_ip ||= nil
if node[:magnum][:ha][:enabled] && !@cluster_admin_ip
- 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"
Further reading
Method unset_db_synced
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.unset_db_synced
# keystone is not included here because we keep it running for some longer
# during the upgrade and don't what the chef-recipes to trigger the database
# schema migrations.
- 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"
Further reading
Method validate_proposal_after_save
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_proposal_after_save(proposal)
validate_one_for_role proposal, "monasca-server"
nodes = proposal["deployment"][@bc_name]["elements"]
nodes["monasca-server"].each do |node|
n = NodeObject.find_node_by_name(node)
- 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"