ManageIQ/manageiq-ui-classic

View on GitHub

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
Severity: Major
Found in app/controllers/mixins/sandbox.rb and 1 other location - About 1 hr to fix
app/helpers/application_helper/page_layouts.rb on lines 170..234

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

Further Reading

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]
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb and 1 other location - About 1 hr to fix
app/controllers/report_controller/reports/editor.rb on lines 1693..1705

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

Further Reading

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)
Severity: Major
Found in app/controllers/floating_ip_controller.rb and 1 other location - About 1 hr to fix
app/controllers/cloud_network_controller.rb on lines 45..63

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

Further Reading

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)
Severity: Major
Found in app/controllers/cloud_network_controller.rb and 1 other location - About 1 hr to fix
app/controllers/floating_ip_controller.rb on lines 43..64

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

Further Reading

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]
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb and 1 other location - About 1 hr to fix
app/controllers/report_controller/reports/editor.rb on lines 1570..1582

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

Further Reading

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,
Severity: Minor
Found in app/javascript/components/host-edit-form/host-edit-form.schema.js - About 1 hr to fix

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();

Severity: Minor
Found in app/javascript/oldjs/import.js - About 1 hr to fix

Function formCatalogData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const formCatalogData = () => {
  const catalogData = {
    name: '',
    description: '',
    service_template_id: '',

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] = {
Severity: Minor
Found in app/javascript/components/reconfigure-vm-form/helpers/disk.js - About 1 hr to fix

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' },
Severity: Minor
Found in app/javascript/spec/settings-compan-categories/data.js - About 1 hr to fix

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) {
Severity: Minor
Found in app/javascript/components/workers-form/helpers.jsx - About 1 hr to fix

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');
Severity: Minor
Found in app/javascript/components/dashboard_toolbar.jsx - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/application_controller/performance.rb - About 1 hr to fix

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"
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr to fix

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)
Severity: Minor
Found in app/controllers/application_controller/ci_processing.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/application_controller/performance/options.rb - About 1 hr to fix

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])

Severity: Minor
Found in app/controllers/host_controller.rb - About 1 hr to fix

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]
Severity: Minor
Found in app/controllers/miq_ae_class_controller.rb - About 1 hr to fix

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")

Severity: Minor
Found in app/controllers/ops_controller/settings/cap_and_u.rb - About 1 hr to fix

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
Severity: Minor
Found in app/controllers/chargeback_rate_controller.rb - About 1 hr to fix
Severity
Category
Status
Source
Language