ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

MiqStructuredListLink.propTypes = {
  row: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.any), PropTypes.shape({})]).isRequired,
  clickEvents: PropTypes.bool.isRequired,
  onClick: PropTypes.func,
};
app/javascript/components/miq-structured-list/miq-structured-list-body/miq-structured-list-body-value.jsx on lines 19..23
app/javascript/components/miq-structured-list/miq-structured-list-body/value-tags/miq-structured-list-conditional-tag.jsx on lines 16..20

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 75.

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

    Donut: _.defaultsDeep(
      {
        data: { type: 'donut' },
        tooltip: { show: true },
        legend: { show: true, position: 'right' },
Severity: Major
Found in app/javascript/oldjs/miq_c3_config.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/miq_c3_config.js on lines 143..150

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 75.

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

    Pie: _.defaultsDeep(
      {
        data: { type: 'pie' },
        tooltip: { show: true },
        legend: { show: true, position: 'right' },
Severity: Major
Found in app/javascript/oldjs/miq_c3_config.js and 1 other location - About 2 hrs to fix
app/javascript/oldjs/miq_c3_config.js on lines 152..159

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 75.

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

  button_group('ems_cloud_vmdb', [
    select(
      :ems_cloud_vmdb_choice,
      nil,
      t = N_('Configuration'),
Severity: Major
Found in app/helpers/application_helper/toolbar/ems_clouds_center.rb and 1 other location - About 2 hrs to fix
app/helpers/application_helper/toolbar/ems_infras_center.rb on lines 2..48

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 82.

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

  button_group('ems_infra_vmdb', [
    select(
      :ems_infra_vmdb_choice,
      nil,
      t = N_('Configuration'),
Severity: Major
Found in app/helpers/application_helper/toolbar/ems_infras_center.rb and 1 other location - About 2 hrs to fix
app/helpers/application_helper/toolbar/ems_clouds_center.rb on lines 2..48

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 82.

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 KeyValueListComponent has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const KeyValueListComponent = (props) => {
  const {
    input, label, keyLabel, valueLabel,
  } = useFieldApi(props);
  const formOptions = useFormApi();

Function createSchema has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createSchema = (edit, ems, initialValues, state, setState) => {
  let emsId = state.ems_id;
  if (initialValues && initialValues.ems_id) {
    emsId = initialValues.ems_id;
  }

Function componentDidMount has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  componentDidMount() {
    const {
      recordId, gridChecks, modalData, dispatch,
    } = this.props;
    const itemsIds = gridChecks && Array.isArray(gridChecks) && gridChecks.length > 0 ? _.uniq(gridChecks) : [recordId];
Severity: Minor
Found in app/javascript/components/remove-generic-item-modal.jsx - About 1 hr to fix

Function dataHelper has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const dataHelper = (values, timeProfileId, action, userid) => {
  let data = {};
  let APIaction = 'edit';
  let metrics = values.rollup_daily_metrics;
  let profileType = values.profile_type;
Severity: Minor
Found in app/javascript/components/settings-time-profile-form/helper.js - About 1 hr to fix

Function KeyValueListComponent has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const KeyValueListComponent = (props) => {
  const {
    input, label, keyLabel, valueLabel,
  } = useFieldApi(props);
  const formOptions = useFormApi();
Severity: Minor
Found in app/javascript/components/terraform-template-catalog-form/helper.js - About 1 hr to fix

Method included has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.included(included_class)
    included_class.button_group('service_vmdb', [
                                  included_class.select(
                                    :service_vmdb_choice,
                                    nil,
Severity: Minor
Found in app/helpers/application_helper/toolbar/service/vmdb_mixin.rb - About 1 hr to fix

Method build_grid has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_grid
    case @edit[:wf]
    when MiqProvisionConfiguredSystemWorkflow
      build_dialog_page_miq_provision_configured_system_workflow
    when MiqProvisionVirtWorkflow
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 1 hr to fix

Method prov_edit has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def prov_edit
    assert_privileges("miq_request_edit")
    if params[:button] == "cancel"
      req = MiqRequest.find(session[:edit][:req_id]) if session[:edit] && session[:edit][:req_id]
      flash_to_session(
Severity: Minor
Found in app/controllers/application_controller/miq_request_methods.rb - About 1 hr to fix

Method schedule_form_fields has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def schedule_form_fields
    assert_privileges("schedule_edit")

    schedule = MiqSchedule.find(params[:id])

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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    "actions": [
        {
            "name": "query",
            "method": "post",
            "href": "http://localhost:3001/api/zones"
Severity: Major
Found in app/javascript/spec/ansible-edit-catalog-form/mockdata.js and 3 other locations - About 1 hr to fix
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2805..2826
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2879..2900
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2914..2935

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 74.

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 4 locations. Consider refactoring.
Open

    "actions": [
        {
            "name": "edit",
            "method": "post",
            "href": "http://localhost:3001/api/configuration_script_sources"
Severity: Major
Found in app/javascript/spec/ansible-edit-catalog-form/mockdata.js and 3 other locations - About 1 hr to fix
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2879..2900
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2914..2935
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 4297..4318

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 74.

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 4 locations. Consider refactoring.
Open

    "actions": [
        {
            "name": "delete",
            "method": "post",
            "href": "http://localhost:3001/api/authentications"
Severity: Major
Found in app/javascript/spec/ansible-edit-catalog-form/mockdata.js and 3 other locations - About 1 hr to fix
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2805..2826
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2914..2935
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 4297..4318

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 74.

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 4 locations. Consider refactoring.
Open

    "actions": [
        {
            "name": "delete",
            "method": "post",
            "href": "http://localhost:3001/api/authentications"
Severity: Major
Found in app/javascript/spec/ansible-edit-catalog-form/mockdata.js and 3 other locations - About 1 hr to fix
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2805..2826
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 2879..2900
app/javascript/spec/ansible-edit-catalog-form/mockdata.js on lines 4297..4318

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 74.

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

      source_vm: {
        is_link: true,
        href: (event.vm === null) ? '' : `/vm_infra/show/${event.vm.id}`,
        label: (event.vm === null) ? '' : event.vm.name,
      },
app/javascript/components/timeline-options/timeline-helper.js on lines 115..119

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 74.

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

export const getDriveTableHeaders = () => [
  { key: 'name', header: __('Name') },
  { key: 'hostFile', header: __('Host File') },
  { key: 'disconnect', header: __('Disconnect') },
  { key: 'action', header: __('Actions') },
app/javascript/components/request-workflow-status/data.js on lines 12..29

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 74.

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

Severity
Category
Status
Source
Language