theforeman/foreman_remote_execution

View on GitHub

Showing 230 of 230 total issues

File foreman_remote_execution.js has 1594 lines of code (exceeds 250 allowed). Consider refactoring.
Open

 locales['foreman_remote_execution'] = locales['foreman_remote_execution'] || {}; locales['foreman_remote_execution']['ja'] = {
  "domain": "foreman_remote_execution",
  "locale_data": {
    "foreman_remote_execution": {
      "": {

    File job_invocation_composer.rb has 535 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class JobInvocationComposer
      class JobTemplateNotFound < StandardError; end
    
      class FeatureNotFound < StandardError; end
    
    
    Severity: Major
    Found in app/models/job_invocation_composer.rb - About 1 day to fix

      File JobWizard.js has 498 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* eslint-disable max-lines */
      /* eslint-disable camelcase */
      import React, { useState, useEffect, useCallback } from 'react';
      import { useDispatch, useSelector } from 'react-redux';
      import PropTypes from 'prop-types';
      Severity: Minor
      Found in webpack/JobWizard/JobWizard.js - About 7 hrs to fix

        File Schedule.test.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable max-lines */
        import React from 'react';
        import { Provider } from 'react-redux';
        import configureMockStore from 'redux-mock-store';
        import { fireEvent, screen, render, act } from '@testing-library/react';
        Severity: Minor
        Found in webpack/JobWizard/steps/Schedule/__tests__/Schedule.test.js - About 6 hrs to fix

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

          export const SSHUserField = ({ value, setValue, defaultValue }) => (
            <FormGroup
              label={__('SSH user')}
              labelIcon={helpLabel(__('A user to be used for SSH.'), 'ssh-user')}
              fieldId="ssh-user"
          Severity: Major
          Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 6 hrs to fix
          webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 9..31

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

          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 EffectiveUserField = ({ value, setValue, defaultValue }) => (
            <FormGroup
              label={__('Effective user')}
              labelIcon={helpLabel(
                __(
          Severity: Major
          Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 6 hrs to fix
          webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 217..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 155.

          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

                  ...(scheduleValue.scheduleType === SCHEDULE_TYPES.FUTURE
                    ? [
                        {
                          name: SCHEDULE_TYPES.FUTURE,
                          component: (
          Severity: Major
          Found in webpack/JobWizard/JobWizard.js and 1 other location - About 5 hrs to fix
          webpack/JobWizard/JobWizard.js on lines 376..405

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

          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

                  ...(scheduleValue.scheduleType === SCHEDULE_TYPES.RECURRING
                    ? [
                        {
                          name: SCHEDULE_TYPES.RECURRING,
                          component: (
          Severity: Major
          Found in webpack/JobWizard/JobWizard.js and 1 other location - About 5 hrs to fix
          webpack/JobWizard/JobWizard.js on lines 346..375

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

          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

          Class JobInvocationComposer has 41 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class JobInvocationComposer
            class JobTemplateNotFound < StandardError; end
          
            class FeatureNotFound < StandardError; end
          
          
          Severity: Minor
          Found in app/models/job_invocation_composer.rb - About 5 hrs to fix

            File AdvancedFields.test.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable max-lines */
            import React from 'react';
            import { Provider } from 'react-redux';
            import { mount } from '@theforeman/test';
            import { fireEvent, screen, render, act } from '@testing-library/react';

              Function DateTimePicker has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

              export const DateTimePicker = ({
                dateTime,
                setDateTime,
                isDisabled,
                ariaLabel,
              Severity: Minor
              Found in webpack/JobWizard/steps/form/DateTimePicker.js - About 4 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

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

              export const KeyPassphraseField = ({ value, setValue }) => (
                <FormGroup
                  label={__('Private key passphrase')}
                  labelIcon={helpLabel(
                    __(
              Severity: Major
              Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 4 hrs to fix
              webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 126..148

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

              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 EffectiveUserPasswordField = ({ value, setValue }) => (
                <FormGroup
                  label={__('Effective user password')}
                  labelIcon={helpLabel(
                    __(
              Severity: Major
              Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 4 hrs to fix
              webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 102..124

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

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

              export const formatter = (input, values, setValue) => {
                const isSelectType = !!input?.options;
                const inputType = input.value_type;
                const isTextType = inputType === 'plain' || !inputType; // null defaults to plain
              
              
              Severity: Major
              Found in webpack/JobWizard/steps/form/Formatter.js - About 4 hrs to fix

                File index.js has 335 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable max-lines */
                import React, { useEffect, useState } from 'react';
                import {
                  Button,
                  DescriptionList,
                Severity: Minor
                Found in webpack/JobWizard/steps/ReviewDetails/index.js - About 4 hrs to fix

                  Class RemoteExecutionProvider has 32 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class RemoteExecutionProvider
                  
                    EFFECTIVE_USER_METHODS = %w[sudo dzdo su].freeze
                  
                    class << self
                  Severity: Minor
                  Found in app/models/remote_execution_provider.rb - About 4 hrs to fix

                    File fixtures.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* eslint-disable max-lines */
                    import configureMockStore from 'redux-mock-store';
                    import hostsQuery from '../steps/HostsAndInputs/hosts.gql';
                    import hostgroupsQuery from '../steps/HostsAndInputs/hostgroups.gql';
                    
                    
                    Severity: Minor
                    Found in webpack/JobWizard/__tests__/fixtures.js - About 3 hrs to fix

                      File engine.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module ForemanRemoteExecution
                        DYNFLOW_QUEUE = :remote_execution
                      
                        class Engine < ::Rails::Engine
                          engine_name 'foreman_remote_execution'
                      Severity: Minor
                      Found in lib/foreman_remote_execution/engine.rb - About 3 hrs to fix

                        Class JobInvocation has 29 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class JobInvocation < ApplicationRecord
                          CACHE_PREFIX = "job_invocation".freeze
                        
                          audited :except => [:task_id, :targeting_id, :task_group_id, :triggering_id]
                        
                        
                        Severity: Minor
                        Found in app/models/job_invocation.rb - About 3 hrs to fix

                          Class RunHostsJob has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class RunHostsJob < Actions::ActionWithSubPlans
                                include Actions::RecurringAction
                                include Actions::ObservableAction
                                include Actions::RemoteExecution::EventHelpers
                          
                          
                          Severity: Minor
                          Found in app/lib/actions/remote_execution/run_hosts_job.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language