Showing 18,390 of 18,390 total issues
Method add_interface
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_interface
assert_privileges("network_router_add_interface")
@router = find_record_with_rbac(NetworkRouter, params[:id])
case params[:button]
- Create a ticketCreate a ticket
Method widget_validate_entries
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def widget_validate_entries
if %w[r c].include?(@sb[:wtype]) && (!@edit[:new][:repfilter] || @edit[:new][:repfilter] == "")
add_flash(_("A Report must be selected"), :error)
end
if %w[role group].include?(@edit[:new][:visibility_typ])
- Create a ticketCreate a ticket
Method heatmaps
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def heatmaps
# Get latest hourly rollup for each node.
cluster_ids = @ems.ems_clusters if @ems.present?
metrics = MetricRollup.latest_rollups(EmsCluster.name, cluster_ids)
metrics = metrics.where('timestamp > ?', 30.days.ago.utc).includes(:resource)
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
if record.current_group
row = row_data_for_group_and_role(_('Current Group'), record.current_group.description, "ff ff-group")
if role_allows?(:feature => "rbac_group_show")
row[:cells][:link] = record.current_group.description
row[:cells][:onclick] = settings_user_onclick("g-#{record.current_group.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 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
if group.miq_user_role
row = row_data_for_role(_('Role'), group.miq_user_role.name, "ff ff-user-role")
if role_allows?(:feature => "rbac_group_show")
row[:cells][:link] = group.miq_user_role.name
row[:cells][:onclick] = select_tree_node_onclick("ur-#{group.miq_user_role.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 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
when "reset", nil # Reset or first time in
@in_a_form = true
params[:id] ||= find_checked_items[0]
@policy = MiqPolicy.find_by(:id => params[:id]) # Get existing record
- 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
when "reset", nil # Reset or first time in
@in_a_form = true
params[:id] ||= find_checked_items[0]
@policy = MiqPolicy.find_by(:id => params[:id]) # Get existing record
- 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
Function renderGitImport
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderGitImport: function(branches, tags, gitRepoId, messages) {
clearMessages();
var message = messages.message;
var messageLevel = messages.level;
- Create a ticketCreate a ticket
Function link
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, elem, attr, ctrl) {
scope['form_' + ctrl.$name] = elem[0];
scope['form_' + ctrl.$name + '_timerHide'] = attr.timerHide;
scope.$watch(attr.ngModel, function() {
- Create a ticketCreate a ticket
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const validation = (values) => {
const errors = {};
if (values.ems_id === '-1') {
errors.ems_id = __('Required');
- Create a ticketCreate a ticket
Function onSubmit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onSubmit = (values) => {
const submitValues = prepareSubmitData(values, recId, appliesToClass, appliesToId, initialValues, buttonIcon);
let saveMessage = sprintf(__(`Custom Button %s has been successfully saved.`), submitValues.name);
if (recId) {
API.put(`/api/custom_buttons/${recId}`, submitValues, { skipErrors: [400] })
- Create a ticketCreate a ticket
Function buildDataTableObject
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const buildDataTableObject = (pointChoice) => {
const tableData = [];
pointChoice.eventsObj.forEach((event) => {
// TODO: Different timeline show different data, ensure all necessary data is included
const emsUrl = event.ext_management_system.type.includes('StorageManager') ? 'ems_storage' : 'ems_infra/show';
- Create a ticketCreate a ticket
Function modal
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function modal(title, Inner, closed, removeId) {
const overrides = {
addClicked: (orig) => Promise.resolve(orig()).then(closed),
saveClicked: (orig) => Promise.resolve(orig()).then(closed),
cancelClicked: (orig) => Promise.resolve(orig()).then(closed),
- Create a ticketCreate a ticket
Function getPodsTrendChart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getPodsTrendChart = (isLoading, dashboardData) => {
if (isLoading !== true) {
if (dashboardData.data.pod_metrics.dataAvailable) {
const tooltipType = dashboardData.data.pod_metrics.interval_name;
let config = 'hourlyPodUsageConfig';
- Create a ticketCreate a ticket
Function removeCatalogItems
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const removeCatalogItems = (catalogItems) => {
const apiPromises = [];
miqSparkleOn();
catalogItems.forEach((item) => {
- Create a ticketCreate a ticket
Function GetCompliantResources
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const GetCompliantResources = ({ ...props }) => {
const buttonLabel = __('Check Compliant Resources');
const progressMsg = __('Checking');
const defaultText = __(' ');
const helperText = 'Check which currently attached resources comply with the selected capabilities:';
- Create a ticketCreate a ticket
Function componentDidMount
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidMount() {
miqSparkleOn();
const { catalogId } = this.props;
if (catalogId) {
Promise.all([
- Create a ticketCreate a ticket
Function toolbarReducer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const toolbarReducer = (state, action) => {
switch (action.type) {
case 'INCREMENT':
return {
...state,
- Create a ticketCreate a ticket
Function getOverflowButtons
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getOverflowButtons = (widgetButtons, widgetId, widgetType, widgetTitle, setState, widgetModel, lastRun, nextRun) => {
const menuItems = [];
const parsedButtons = JSON.parse(widgetButtons);
parsedButtons.forEach((button) => {
menuItems.push(<OverflowMenuItem
- Create a ticketCreate a ticket
Method get_custom_buttons
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_custom_buttons(model, record, toolbar_result)
cbses = CustomButtonSet.find_all_by_class_name(button_class_name(model), service_template_id(record))
cbses = CustomButtonSet.filter_with_visibility_expression(cbses, record)
cbses.sort_by { |cbs| cbs.set_data[:group_index] }.collect do |cbs|
- Create a ticketCreate a ticket