Showing 18,390 of 18,390 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
const getNetworkName = (id, data) => {
if (data.submitParams.networkIds.add.includes(id)) {
return __('to be determined');
}
return __(' ');
- 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 59.
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
const getNetworkMac = (id, data) => {
if (data.submitParams.networkIds.add.includes(id)) {
return __('not available yet');
}
return __(' ');
- 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 59.
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
useEffect(() => {
// The list of registered fields shows up after this render, so the validation has to happen
// with a delay and has to be pulled back via the state.
setTimeout(() => setState((state) => ({ ...state, depsValid: dv })));
formOptions.change(name, isValid);
- 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 59.
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 associate_floating_ip_vms
assert_privileges("instance_associate_floating_ip")
recs = checked_or_params
@record = find_record_with_rbac(VmCloud, recs.first)
if @record.supports?(:associate_floating_ip) && @record.ext_management_system.present?
- 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 58.
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 disassociate_floating_ip_vms
assert_privileges("instance_disassociate_floating_ip")
recs = checked_or_params
@record = find_record_with_rbac(VmCloud, recs.first)
if @record.supports?(:disassociate_floating_ip) && @record.ext_management_system.present?
- 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 58.
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 miqOnLoad
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.miqOnLoad = function() {
// controller to be used in url in miqDropComplete method
ManageIQ.widget.dashboardUrl = 'dashboard/widget_dd_done';
// Initialize the dashboard column sortables
- Create a ticketCreate a ticket
Function miqInitCodemirror
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.miqInitCodemirror = function(options) {
if (!miqDomElementExists(options.text_area_id)) {
return;
}
- Create a ticketCreate a ticket
Function saveDialogDetails
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveDialogDetails() {
var action;
var dialogData;
var dialogId;
- Create a ticketCreate a ticket
Function createSchema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSchema(ems, recordId, loadSchema, emptySchema, providerFields = []) {
const providers = ems.filter((tenant) => tenant.type !== 'ManageIQ::Providers::Nuage::NetworkManager');
const providerOptions = providers.map(({ id, name }) => ({ label: name, value: id }));
providerOptions.unshift({ label: `<${__('Choose')}>`, value: '-1' });
- Create a ticketCreate a ticket
Function Quaditem
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Quaditem = (props) => {
const {
text, fonticon, color, fileicon, piechart, className, tooltip, background,
} = props;
const shortText = abbrNumber(text);
- Create a ticketCreate a ticket
Function GenericTableRow
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function GenericTableRow(props) {
const { item, onClick } = props;
const value = renderValue(item.value, onClick);
return (
- Create a ticketCreate a ticket
Method report_schedule
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_schedule(schedules)
data = {:title => _('Schedules'), :mode => "miq_report_schedules bordered-list simple_table", :rows => []}
if schedules.blank?
data[:message] = _("Report is not Scheduled.")
else
- Create a ticketCreate a ticket
Function componentDidMount
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidMount() {
const apiPromises = [];
const { recordId, gridChecks, dispatch } = this.props;
const catalogItemsIds = recordId ? [recordId] : _.uniq(gridChecks);
- Create a ticketCreate a ticket
Method list_view
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_view(display, record)
data = {:mode => "miq_host_#{display}"}
rows = []
case display
when "devices"
- Create a ticketCreate a ticket
Method set_active_tab
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_active_tab(nodetype)
node = nodetype.downcase.split("-")
case x_active_tree
when :settings_tree
case node[0]
- Create a ticketCreate a ticket
Method prefill_val_types
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prefill_val_types
self.val1 ||= {}
self.val2 ||= {}
val1[:type] = case exp_typ
when 'field'
- Create a ticketCreate a ticket
Method chart_chooser
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def chart_chooser
assert_privileges('utilization')
unless params[:task_id] # Only do this first time thru
@sb[:options][:chart_date] = params[:miq_date_1] if params[:miq_date_1]
@sb[:options][:chart_date] = params[:miq_date_2] if params[:miq_date_2]
- Create a ticketCreate a ticket
Method add_update_method_add
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_update_method_add
method = params[:id] != "new" ? find_record_with_rbac(MiqAeMethod, params[:id]) : MiqAeMethod.new
old_method_attributes = method.attributes.clone
method.name = params["name"]
- Create a ticketCreate a ticket
Method miq_policy_edit_events
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def miq_policy_edit_events
assert_privileges('miq_policy_events_assignment')
case params[:button]
when "cancel"
@sb[:action] = @edit = nil
- Create a ticketCreate a ticket
Method rbac_replace_right_cell
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rbac_replace_right_cell(nodetype, presenter)
if %w[accordion_select change_tab tree_select].include?(params[:action])
presenter.replace(:ops_tabs, r[:partial => "all_tabs"])
elsif nodetype == "group_seq"
presenter.update(:rbac_details, r[:partial => "ldap_seq_form"])
- Create a ticketCreate a ticket