ManageIQ/manageiq-ui-classic

View on GitHub

Showing 18,390 of 18,390 total issues

Method fields_get_form_vars has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def fields_get_form_vars
    @ae_class = MiqAeClass.find_by(:id => @edit[:ae_class_id])
    @in_a_form = true
    @in_a_form_fields = true
    if params[:item].blank? && !%w[accept save].include?(params[:button]) && params["action"] != "field_delete"
Severity: Major
Found in app/controllers/miq_ae_class_controller.rb - About 2 hrs to fix

Method build_edit_screen has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build_edit_screen
    build_tabs

    get_time_profiles # Get time profiles list (global and user specific)
    cb_entities_by_provider if Chargeback.db_is_chargeback?(@edit[:new][:model]) && [ChargebackContainerImage, ChargebackContainerProject, MeteringContainerImage, MeteringContainerProject].include?(@edit[:new][:model].safe_constantize)
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs to fix

Method gfv_chargeback has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def gfv_chargeback
    # Chargeback options
    if params.key?(:cb_show_typ)
      @edit[:new][:cb_show_typ] = params[:cb_show_typ].presence
      @refresh_div = "filter_div"
Severity: Major
Found in app/controllers/report_controller/reports/editor.rb - About 2 hrs to fix

File schedules.rb has 405 lines of code (exceeds 400 allowed). Consider refactoring.
Open

module ReportController::Schedules
  extend ActiveSupport::Concern

  def show_schedule
    if @schedule.nil?
Severity: Minor
Found in app/controllers/report_controller/schedules.rb - About 2 hrs to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  while (index < 1000) {
    const valueInMb = index * 1024 * 1024;
    options.push({
      value: valueInMb,
      label: toHumanSize(valueInMb),
Severity: Major
Found in app/javascript/components/workers-form/helpers.jsx and 1 other location - About 2 hrs to fix
app/javascript/components/workers-form/helpers.jsx on lines 176..186

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

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  while (index < 1000) {
    const valueInMb = index * 1024 * 1024;
    options.push({
      value: valueInMb,
      label: toHumanSize(valueInMb),
Severity: Major
Found in app/javascript/components/workers-form/helpers.jsx and 1 other location - About 2 hrs to fix
app/javascript/components/workers-form/helpers.jsx on lines 139..149

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

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

RecentVmGraph.propTypes = {
  providerId: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
  config: PropTypes.string.isRequired,
  apiUrl: PropTypes.string.isRequired,
app/javascript/components/provider-dashboard-charts/provider-dashboard-utilization-chart/index.js on lines 86..92
app/javascript/components/provider-dashboard-charts/servers-pie-chart/index.js on lines 69..75

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

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

UtilizationChartGraph.propTypes = {
  providerId: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
  cpuConfig: PropTypes.string.isRequired,
  memoryConfig: PropTypes.string.isRequired,
app/javascript/components/provider-dashboard-charts/recent-vm-chart/index.js on lines 36..42
app/javascript/components/provider-dashboard-charts/servers-pie-chart/index.js on lines 69..75

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

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

ServersDataChart.propTypes = {
  providerId: PropTypes.string.isRequired,
  serversAvailableConfig: PropTypes.string.isRequired,
  serversHealthConfig: PropTypes.string.isRequired,
  apiUrl: PropTypes.string.isRequired,
app/javascript/components/provider-dashboard-charts/provider-dashboard-utilization-chart/index.js on lines 86..92
app/javascript/components/provider-dashboard-charts/recent-vm-chart/index.js on lines 36..42

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

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

      <div className="tab-content-header-actions">
        <Button
          onClick={() => onSelect('')}
          onKeyPress={() => onSelect('')}
          title={__('Click on this row to create a new mapping rule')}
app/javascript/components/settings-company-categories/index.jsx on lines 18..26

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

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

    cy.get('@get').then((getCall) => {
      expect(getCall.state).to.equal('Complete');
      expect(getCall.response).to.include({
        statusCode: 302,
      });
Severity: Major
Found in cypress/e2e/ui/login.cy.js and 1 other location - About 2 hrs to fix
cypress/e2e/ui/Overview/dashboard.cy.js on lines 157..162

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

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

      <div className="tab-content-header-actions">
        <Button
          onClick={() => onSelect('')}
          onKeyPress={() => onSelect('')}
          title={__('Click to add a new category')}
app/javascript/components/settings-label-tag-mapping/index.jsx on lines 31..39

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

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

    cy.wait('@post').then((getCall) => {
      expect(getCall.state).to.equal('Complete');
      expect(getCall.response).to.include({
        statusCode: 200,
      });
Severity: Major
Found in cypress/e2e/ui/Overview/dashboard.cy.js and 1 other location - About 2 hrs to fix
cypress/e2e/ui/login.cy.js on lines 24..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 77.

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 Datastore has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const Datastore = ({
  type, initialData, hasOptions, datastoreTypes,
}) => {
  const {
    miqHeaders, miqRows, hasCheckbox, nodeTree,
Severity: Minor
Found in app/javascript/components/data-tables/datastore/index.jsx - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function OrcherstrationTemplateForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const OrcherstrationTemplateForm = ({ isStack, otId, copy }) => {
  const [initialValues, setinItialValues] = useState({});
  const [submitAction, setSubmitAction] = useState();
  const [isLoading, setLoading] = useState(true);

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function WorkflowRepositoryForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const WorkflowRepositoryForm = ({ repositoryId }) => {
  const [{
    initialValues, isLoading, provider,
  }, setState] = useState({
    isLoading: true,
Severity: Minor
Found in app/javascript/components/workflow-repository-form/index.jsx - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function HostInitiatorForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const HostInitiatorForm = ({ redirect, storageManagerId }) => {
  const [state, setState] = useState({});
  const [storageId, setStorageId] = useState(undefined);
  const { isLoading, initialValues } = state;

Severity: Minor
Found in app/javascript/components/host-initiator-form/index.jsx - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method report_information has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def report_information(sb_data, report)
    if sb_data[:miq_report_id] && report
      data = {:title => _('Basic Information'), :mode => 'miq_report_basic_information'}
      rows = []
      rows.push(row_data(_('ID'), report.id))
Severity: Minor
Found in app/helpers/report_helper/report_information_helper.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function AnsibleRepositoryForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const AnsibleRepositoryForm = ({ repositoryId }) => {
  const [{
    initialValues, isLoading, provider,
  }, setState] = useState({
    isLoading: true,
Severity: Minor
Found in app/javascript/components/ansible-repository-form/index.jsx - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function EmbeddedTerraformRepositoryForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

const EmbeddedTerraformRepositoryForm = ({ repositoryId }) => {
  const [{
    initialValues, isLoading, provider,
  }, setState] = useState({
    isLoading: true,

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language