Showing 18,390 of 18,390 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
button_group('rbac_role_vmdb', [
select(
:rbac_role_vmdb_choice,
nil,
t = N_('Configuration'),
- 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 71.
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
button_group('user_vmdb', [
select(
:user_vmdb_choice,
nil,
t = N_('Configuration'),
- 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 71.
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 evacuate_form_fields
assert_privileges("instance_evacuate")
@record = find_record_with_rbac(VmOrTemplate, params[:id])
hosts = []
unless @record.ext_management_system.nil?
- 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 71.
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 live_migrate_form_fields
assert_privileges("instance_live_migrate")
@record = find_record_with_rbac(VmOrTemplate, params[:id])
hosts = []
unless @record.ext_management_system.nil?
- 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 71.
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 chartData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.chartData = function(type, data, data2) {
if (type === undefined) {
return emptyChart();
}
- Create a ticketCreate a ticket
Function getPodsTable
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getPodsTable = (isLoading, dashboardData) => {
if (isLoading !== true) {
if (dashboardData.data.pods.length > 0) {
const rows = dashboardData.data.pods.map((row) => ({
...row,
- Create a ticketCreate a ticket
Function FirmwareRegistryForm
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FirmwareRegistryForm = () => {
const TYPES = {
rest_api_depot: { value: 'FirmwareRegistry::RestApiDepot', label: __('Rest API Depot') },
};
- Create a ticketCreate a ticket
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { isLoaded } = this.props;
if (!isLoaded) {
return (
- Create a ticketCreate a ticket
Method process_vm_buttons
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_vm_buttons(pfx)
case params[:pressed]
when "#{pfx}_policy_sim" then polsimvms
when "#{pfx}_compare" then comparemiq
when "#{pfx}_scan" then scanvms
- Create a ticketCreate a ticket
Method textual_generate_openstack_status
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def textual_generate_openstack_status
@record.service_group_names.collect do |x|
running_count = @record.host_ids_with_running_service_group(x.name).count
failed_count = @record.host_ids_with_failed_service_group(x.name).count
all_count = @record.host_ids_with_service_group(x.name).count
- Create a ticketCreate a ticket
Method disks_attributes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def disks_attributes
disks = []
return disks if @record.hardware.disks.empty?
# HDDs
- Create a ticketCreate a ticket
Method ab_group_reorder
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ab_group_reorder
assert_privileges("ab_group_reorder")
case params[:button]
when "cancel"
add_flash(_("Button Group Reorder cancelled"))
- Create a ticketCreate a ticket
Method update
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
assert_privileges("miq_ae_class_edit")
return unless load_edit("aeclass_edit__#{params[:id]}", "replace_cell__explorer")
get_form_vars
- Create a ticketCreate a ticket
Method upload_csv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_csv
assert_privileges("region_edit")
return unless load_edit("#{@sb[:active_tab]}_edit__#{@sb[:selected_server_id]}", "replace_cell__explorer")
- Create a ticketCreate a ticket
Method rbac_user_delete
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rbac_user_delete
assert_privileges("rbac_user_delete")
users = []
if params[:id] # showing a list
if params[:id].nil? || !User.exists?(:id => params[:id])
- Create a ticketCreate a ticket
Method determine_filter_type_and_value
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def determine_filter_type_and_value(schedule)
if schedule.sched_action && schedule.sched_action[:method] && !schedule_automate(schedule)
if schedule.miq_search # See if a search filter is attached
filter_type = schedule.miq_search.search_type == "user" ? "my" : "global"
filter_value = schedule.miq_search.id
- Create a ticketCreate a ticket
Method send_button_changes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_button_changes
if @edit
@changed = (@edit[:new] != @edit[:current])
elsif @assign
@changed = (@assign[:new] != @assign[:current])
- Create a ticketCreate a ticket
Method set_record_vars
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_record_vars
@edit[:set_assignments] = []
if @edit[:new][:cbshow_typ].ends_with?("-tags")
assigned_rates_from_all_categories = @edit[:cb_assign][:tags].values.reduce({}, :merge)
assigned_rates_from_all_categories.each_key do |id|
- Create a ticketCreate a ticket
Method gfv_charts
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gfv_charts
if params[:chosen_graph] && params[:chosen_graph] != @edit[:new][:graph_type]
if params[:chosen_graph] == "<No chart>"
@edit[:new][:graph_type] = nil
# Reset other setting to initial settings if choosing <No chart>
- Create a ticketCreate a ticket
Method features
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def features
[
{
:role => "miq_report_saved_reports",
:role_any => true,
- Create a ticketCreate a ticket