Showing 18,390 of 18,390 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
TREE_WHITELIST = %w[
ab_tree
action_tree
ae_tree
alert_profile_tree
- 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 65.
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 @edit[:new][:model] == ApplicationController::TREND_MODEL
unless @edit[:new][:perf_trend_col]
add_flash(_('Trending for is required'), :error)
end
unless @edit[:new][:perf_limit_col] || @edit[:new][:perf_limit_val]
- 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 65.
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
when "add"
options = form_params
ems = ExtManagementSystem.find(options[:ems_id])
if FloatingIp.class_by_ems(ems)&.supports?(:create)
- 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 65.
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
when "add"
options = form_params
ems = ExtManagementSystem.find(options[:ems_id])
if CloudNetwork.class_by_ems(ems)&.supports?(:create)
options.delete(:ems_id)
- 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 65.
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 @edit[:new][:model] == ApplicationController::TREND_MODEL
unless @edit[:new][:perf_trend_col]
add_flash(_('Filter tab is not available until Trending for field has been selected'), :error)
end
unless @edit[:new][:perf_limit_col] || @edit[:new][:perf_limit_val]
- 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 65.
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 createSchema
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSchema(ids, endpointFields, emptySchema, getHostData) {
const fields = [
...(ids.length <= 1
? [{
component: componentTypes.TEXT_FIELD,
- Create a ticketCreate a ticket
Function setUpImportClickHandlers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.setUpImportClickHandlers = function(url, grid, importCallback) {
$('.import-commit').click(function() {
miqSparkleOn();
clearMessages();
- Create a ticketCreate a ticket
Function formCatalogData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const formCatalogData = () => {
const catalogData = {
name: '',
description: '',
service_template_id: '',
- Create a ticketCreate a ticket
Function setDiskData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setDiskData = (disks, roles, data, setData) => {
const diskData = [];
disks.forEach((disk, i) => {
const id = `disk${i}`;
diskData[i] = {
- Create a ticketCreate a ticket
Function settingsCompanyCategoriesData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const settingsCompanyCategoriesData = () => {
const headers = [
{ header: _('Name'), key: 'name' },
{ header: _('Description'), key: 'description' },
{ header: _('Show in Console'), key: 'show' },
- Create a ticketCreate a ticket
Function generateRefreshOptions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateRefreshOptions = (constrained = false, initialStep = 50, initialIndex = 200) => {
let index = initialIndex;
let step = initialStep;
const options = [];
while (index < 1000) {
- Create a ticketCreate a ticket
Function addMenu
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addMenu = (items, locked) => {
const title = locked
? __('Cannot add a Widget, this Dashboard has been locked by the Administrator')
: __('Add widget');
const buttonName = __('Add widget');
- Create a ticketCreate a ticket
Method timeline_current
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def timeline_current(chart_click_data, ts)
@record = identify_tl_or_perf_record
@perf_record = @record.kind_of?(MiqServer) ? @record.vm : @record # Use related server vm record
new_opts = tl_session_data(request.parameters["controller"]) || ApplicationController::Timelines::Options.new
new_opts[:model] = @perf_record.class.base_class.to_s
- Create a ticketCreate a ticket
Method process_storage
has 35 lines of code (exceeds 25 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"
- Create a ticketCreate a ticket
Method process_objects
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_objects(objs, task, display_name = nil)
klass = record_class
klass_str = klass.to_s
assert_rbac(klass, objs)
- Create a ticketCreate a ticket
Method set_dates
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_dates(start_date, end_date, allow_interval_override)
tz = time_profile_tz || self.tz # Use time profile tz or chosen tz, if no profile tz
self.sdate = start_date.in_time_zone(tz)
self.edate = end_date.in_time_zone(tz)
self.sdate_daily = sdate.hour.zero? ? sdate : sdate + 1.day
- Create a ticketCreate a ticket
Method edit
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit
assert_privileges("host_edit")
if session[:host_items].nil?
@host = find_record_with_rbac(Host, params[:id])
- Create a ticketCreate a ticket
Method validate_method_data
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_method_data
assert_privileges("miq_ae_method_edit")
return unless load_edit("aemethod_edit__#{params[:id]}", "replace_cell__explorer")
@edit[:new][:data] = params[:cls_method_data] if params[:cls_method_data]
- Create a ticketCreate a ticket
Method cu_collection_update
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cu_collection_update
assert_privileges("region_edit")
return unless load_edit("cu_edit__collection", "replace_cell__explorer")
- Create a ticketCreate a ticket
Method set_rate_details
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_rate_details
@edit[:new][:details] = []
tiers = []
@rate ||= ChargebackRate.new
rate_details = @rate.chargeback_rate_details
- Create a ticketCreate a ticket