Showing 18,390 of 18,390 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
const headerData = () => ([
{
key: 'name',
header: __('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 74.
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
} else if (type === DELETE_ASSIGNED_TAG) {
params = meta.onDelete(meta.type, params, tag.tagValue.id)();
$.post({ url: meta.url, data: JSON.stringify(params), contentType: 'application/json' });
}
- 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 74.
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
host: {
is_link: true,
href: (event.host === null) ? '' : `/host/show/${event.host.id}`,
label: (event.host === null) ? '' : event.host.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 74.
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
} else {
params = meta.onDelete(meta.type, params, selected.item.id)();
$.post({ url: meta.url, data: JSON.stringify(params), contentType: 'application/json' });
}
- 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 74.
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 prov_set_show_vars
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prov_set_show_vars
@showtype = "main"
@options = @miq_request.get_options # Get the provision options from the request record
@options[:org_controller] = "vm"
if @options[:schedule_time]
- Create a ticketCreate a ticket
Method action_type
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action_type(type, amount)
case type
when "advanced_settings"
n_("Advanced Setting", "Advanced Settings", amount)
when "disks"
- Create a ticketCreate a ticket
Method replace_right_cell
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def replace_right_cell(options = {})
action, presenter = options.values_at(:action, :presenter)
@explorer = true
@sb[:action] = action unless action.nil?
if @sb[:action] || params[:display]
- Create a ticketCreate a ticket
Method get_method_form_vars
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_method_form_vars
@ae_method = @edit[:ae_method_id] ? MiqAeMethod.find(@edit[:ae_method_id]) : MiqAeMethod.new
@in_a_form = true
if params[:item].blank? && params[:button] != "accept" && params["action"] != "field_delete"
# for method_inputs view
- Create a ticketCreate a ticket
Method ap_ce_delete
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ap_ce_delete
assert_privileges("ap_delete")
return unless load_edit("ap_edit__#{params[:id]}", "replace_cell__explorer")
- Create a ticketCreate a ticket
Method schedule_form_field_changed
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def schedule_form_field_changed
assert_privileges(@edit && @edit[:rpt_id] ? "miq_report_schedule_edit" : "miq_report_schedule_add")
return unless load_edit("schedule_edit__#{params[:id]}", "replace_cell__explorer")
schedule_get_form_vars
- Create a ticketCreate a ticket
Method schedule_set_form_vars
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def schedule_set_form_vars
@timezone_abbr = get_timezone_abbr
@edit = {}
@folders = []
- Create a ticketCreate a ticket
Function prepareSubmitData
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const prepareSubmitData = (values, recId, appliesToClass, appliesToId, initialValues, buttonIcon) => {
const submitValues = values;
submitValues.applies_to_class = appliesToClass;
if (recId) {
submitValues.applies_to_id = initialValues.applies_to_id;
- 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
Function createSchema
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function createSchema(fieldss, recordId, emsId, mode, loadSchema, alertState, alertOptions) {
let selectedOptions = []; // in edit form, selectedOptions are options that are passed in when open the form for first time
let editSelectedOptions = []; // in edit form, editSelectedOptions recorded all the selected options once the form is changed
let selectedOptionsChanged = false; // in edit form, selectedOptionsChanged changes to true once there is a change in selected options
- 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
Function TimeProfileTable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const TimeProfileTable = ({
initialData,
}) => {
const { headers, rows } = tableData(initialData);
- 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 build_link_text
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build_link_text(args)
if args.key?(:tables)
entity_name = ui_lookup(:tables => args[:tables])
link_text = args.key?(:link_text) ? "#{args[:link_text]} (#{args[:count]})" : "#{entity_name} (#{args[:count]})"
title = _("Show all %{names}") % {:names => entity_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"
Further reading
Function PfAggregateStatusCard
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const PfAggregateStatusCard = ({
showTopBorder, altLayout, layout, data,
}) => {
const shouldShowTopBorder = () => (showTopBorder === true);
const isAltLayout = () => (altLayout === true || layout === 'tall');
- 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 center_toolbar_filename_explorer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def center_toolbar_filename_explorer
if %w[vm_cloud vm_infra vm_or_template].include?(@layout)
center_toolbar_name_vm_or_template
elsif x_active_tree == :ae_tree
center_toolbar_filename_automate
- 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 process_storage
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_storage(storages, task, _ = nil)
storages, _storages_out_region = filter_ids_in_region(storages, _("Datastore"))
return if storages.empty?
if task == "destroy"
- 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 ranges_and_rates
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ranges_and_rates(num_tiers, tiers, detail, first_tier)
range_rate = {
:start => [first_tier.start ? first_tier.start : 0],
:finish => [first_tier.finish == Float::INFINITY ? _('Infinity') : first_tier.finish],
:fixed_rate => [first_tier.fixed_rate ? first_tier.fixed_rate : 0.0],
- 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 delete_host_aggregates
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def delete_host_aggregates
assert_privileges("host_aggregate_delete")
host_aggregates = checked_or_params
- 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"