Showing 18,390 of 18,390 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
const groupData = groupOptions.resources.map((group, index) => ({ label: group.description, value: group.id, key: `key_${index}` }));
- 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 56.
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 donutChartData = [
{
group: config.usageDataName,
value: memoryData.used,
},
- 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 56.
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
return {
is_button: true,
title: __('Resize'),
text: __('Resize'),
alt: __('Resize'),
- 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 56.
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 selectListElement
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var selectListElement = function(scope, timeout, ctrl, refresh) {
timeout(function() {
if (refresh) {
if (scope[scope['form_' + ctrl.$name + '_ngHide']] === true) {
angular.element(scope['form_' + ctrl.$name]).selectpicker('hide');
- Create a ticketCreate a ticket
Function createSchema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createSchema(ems, cloudNetworkId, loadSchema, emptySchema, providerFields = []) {
const providers = ems.filter((tenant) => tenant.type !== 'ManageIQ::Providers::Nuage::NetworkManager');
const fields = [{
component: componentTypes.SUB_FORM,
title: __('Network Provider'),
- Create a ticketCreate a ticket
Function datetime_range
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
datetime_range: function(val, options) {
options = options || {};
if (!options.format) {
return val;
}
- Create a ticketCreate a ticket
Function link
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(_scope, _elm, attrs, ctrl) {
function multipleValidator(modelValue) {
var memtype = attrs.memtype;
var multiple = attrs.validateMultiple;
var minvalue = attrs.miqmin;
- Create a ticketCreate a ticket
Function cancelDisconnectDrives
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const cancelDisconnectDrives = (row, data, setData) => {
const { id } = row;
const index = id.substring(5);
const datatableData = data.dataTable.drives;
datatableData[index].filename = datatableData[index].disconnect_filename;
- Create a ticketCreate a ticket
Function reducers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const reducers = (oncheck, onclick) => (state = {}, action) => {
const node = action.nodeId !== undefined ? Tree.nodeSelector(state, action.nodeId) : undefined;
switch (action.type) {
case ACTIONS.CHECKED_DIRECTLY:
- Create a ticketCreate a ticket
Function createSchema
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createSchema = (recordId, data, setData, roles, options, memory, onCellClick, buttonClick) => {
let formFields;
switch (data.form.type) {
case TYPES.DISK:
- Create a ticketCreate a ticket
Function getPodsData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getPodsData = (data, createdlabel, deletedLabel) => {
if (data && data.xData && data.yCreated && data.yDeleted) {
const columnsData = data.xData;
const createdData = data.yCreated;
const deletedData = data.yDeleted;
- Create a ticketCreate a ticket
Function cancelConnectDrives
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const cancelConnectDrives = (row, data, setData) => {
const { id } = row;
const index = id.substring(5);
const datatableData = data.dataTable.drives;
datatableData[index].filename = datatableData[index].old_filename;
- Create a ticketCreate a ticket
Function cancelEditNetwork
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const cancelEditNetwork = (row, data, setData, roles) => {
const index = row.id.substring(7);
const networkRows = data.dataTable.networkAdapters;
if (!roles.isVmwareCloud) {
- Create a ticketCreate a ticket
Function taggingMiddleware
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const taggingMiddleware = (store) => (next) => (action) => {
let selected;
const { type, meta, tag } = action;
if (meta && meta.url) {
- Create a ticketCreate a ticket
Function packagesFromModules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const packagesFromModules = (modules) => {
// find the package.json file for each module
modules = modules.filter(m => m.includes("node_modules"));
var packagePaths = modules.map(m => {
var match = m.match(/(.*node_modules\/)([^/]+)(\/[^/]+)?/);
- Create a ticketCreate a ticket
Function onSubmit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onSubmit = (values) => {
miqSparkleOn();
var vm_id, volume_id, redirectUrl;
if (dropdownLabel == "Instance") {
- Create a ticketCreate a ticket
Function setRenderForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setRenderForm = (row, type, action) => {
if (type === TYPES.DISK && action === 'edit') {
return true;
}
if (type === TYPES.NETWORK || type === TYPES.EDITNETWORK) {
- Create a ticketCreate a ticket
Function FormButtons
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FormButtons(props) {
const primaryTitle = props.customLabel || (props.newRecord ? __('Add') : __('Save'));
const primaryHandler = (props.newRecord ? props.addClicked : props.saveClicked) || props.addClicked || props.saveClicked;
// NOTE: These strings will be translated by <MiqButton />
- Create a ticketCreate a ticket
Method apply_common_props
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_common_props(button, input)
button.update(
:color => input[:color],
:data => button.data(input[:data]),
:hidden => button[:hidden] || !!input[:hidden],
- Create a ticketCreate a ticket
Method calculate_disk_name
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_disk_name(disk)
case disk.device_type
when "cdrom-raw"
"CD-ROM (IDE #{disk.location})"
when "atapi-cdrom"
- Create a ticketCreate a ticket