Showing 18,390 of 18,390 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
button_group('container_monitoring', [
select(
:container_monitoring_choice,
nil,
t = N_('Monitoring'),
- 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 55.
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
10.times do |i|
@edit[:new][:options][:variables][i] ||= {}
@edit[:new][:options][:variables][i][:oid] ||= ""
@edit[:new][:options][:variables][i][:var_type] ||= "<None>"
@edit[:new][:options][:variables][i][:value] ||= ""
- 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 55.
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
10.times do |i|
@edit[:new][:snmp][:variables][i] ||= {}
@edit[:new][:snmp][:variables][i][:oid] ||= ""
@edit[:new][:snmp][:variables][i][:var_type] ||= "<None>"
@edit[:new][:snmp][:variables][i][:value] ||= ""
- 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 55.
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 load_c3_chart
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.load_c3_chart = function(data, chart_id, height) {
if (typeof (data.miqChart) === 'undefined') {
data.miqChart = 'Line';
}
- Create a ticketCreate a ticket
Function recalculateChartYAxisLabels
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.recalculateChartYAxisLabels = function(id) {
// hide/show chart with id
this.api.toggle(id);
var minMax = getMinMaxFromChart(this);
- Create a ticketCreate a ticket
Function setConfigInfo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setConfigInfo = function(configData) {
var method = {
name: configData.name,
display_name: configData.display_name,
class_id: configData.class_id,
- Create a ticketCreate a ticket
Function miqHttpInject
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function miqHttpInject(angular_app) {
angular_app.config(['$locationProvider', function($locationProvider) {
/**
* hashPrefix must be empty othervise it will conflict with HashRouter and create infinite loop
* React HashRouter can be configured to have hashbang prefix,
- Create a ticketCreate a ticket
Function number_with_delimiter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function number_with_delimiter(val, options) {
options = _.extend({ delimiter: ',', separator: '.' }, options || {});
var intpart;
var floatpart;
var minus;
- Create a ticketCreate a ticket
Function convertMultParamsToRailsMultParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convertMultParamsToRailsMultParams(fullParamString) {
const keyValuePairsArr = [];
if (fullParamString) {
fullParamString.split('&').forEach((element) => {
if (element) {
- Create a ticketCreate a ticket
Function setupForm
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const setupForm = (initialValues, resources, name) => {
const modifiedInitialValues = {
name, values: [], enforced: [], invalid: [], ...initialValues,
};
- Create a ticketCreate a ticket
Function loadvalues
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const loadvalues = (values) => {
let stop = false;
if (!allitems && values.selectedItems.length === options.length - 1) {
setAllItems(true);
values.selectedItems.push({ value: 'all', label: 'SELECT ALL' });
- Create a ticketCreate a ticket
Function KebabListItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const KebabListItem = (item, props) => {
if (item.type === 'separator') {
return <SideNavDivider key={item.id} />;
}
- Create a ticketCreate a ticket
Function onSubmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onSubmit = (values) => {
miqSparkleOn();
if (appliesToId) {
values.owner_id = appliesToId;
}
- Create a ticketCreate a ticket
Method li_link
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def li_link(args)
args[:if] = (args[:count] != 0) if args[:count]
args[:if] = true unless args.key?(:if)
link_text, title = build_link_text(args)
- Create a ticketCreate a ticket
Method shared_button_basic_info
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shared_button_basic_info(record, sb_items, custom_button)
style = record&.options&.[](:button_color)&.to_s
display_for = record&.options&.[](:display_for)
display_how_map = {'single' => _('Single entity'), 'list' => _('List'), 'both' => _('Single and list')}
display_for_value = display_how_map[display_for] if display_for.present?
- Create a ticketCreate a ticket
Method center_toolbar_filename_services
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def center_toolbar_filename_services
if x_active_tree == :sandt_tree
if TreeBuilder.get_model_for_prefix(@nodetype) == "ServiceTemplate"
"servicetemplate_center_tb"
elsif @sb[:buttons_node]
- Create a ticketCreate a ticket
Method edit_record
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit_record
assert_privileges(params[:pressed])
obj = find_checked_items
db = params[:db] if params[:db]
- Create a ticketCreate a ticket
Method build_automate_tree
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_automate_tree(type)
tree_name = "#{type}_tree".to_sym
# build the ae tree to show the tree select box for entry point
if x_active_tree == tree_name && @edit && @edit[:new][:fqname]
- Create a ticketCreate a ticket
Method group_reorder_set_form_vars
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def group_reorder_set_form_vars
@edit = {}
@edit[:new] = {}
@edit[:current] = {}
@edit[:key] = "group_reorder"
- Create a ticketCreate a ticket
Method show_details
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_details(db, options = {})
association = options[:association]
conditions = options[:conditions]
clickable = options[:clickable].nil?
@showtype = "details"
- Create a ticketCreate a ticket