theforeman/foreman_remote_execution

View on GitHub

Showing 250 of 250 total issues

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

            {hostMethod === hostMethods.hostGroups && (
              <SelectGQL
                selected={selectedHostGroups}
                setSelected={setSelectedHostGroups}
                apiKey={HOST_GROUPS}
Severity: Major
Found in webpack/JobWizard/steps/HostsAndInputs/index.js and 1 other location - About 1 hr to fix
webpack/JobWizard/steps/HostsAndInputs/index.js on lines 191..200

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

Method prepended has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.prepended(base)
      base.instance_eval do
        has_many :targeting_hosts, :dependent => :destroy, :foreign_key => 'host_id'
        has_many :template_invocations, :dependent => :destroy, :foreign_key => 'host_id'
        has_one :execution_status_object, :class_name => 'HostStatus::ExecutionStatus', :foreign_key => 'host_id', :dependent => :destroy
Severity: Minor
Found in app/models/concerns/foreman_remote_execution/host_extensions.rb - About 1 hr to fix

    Method inner_plan has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def inner_plan(job_invocation, host, template_invocation, proxy_selector, options)
            raise _('Could not use any template used in the job invocation') if template_invocation.blank?
            features = template_invocation.template.remote_execution_features.pluck(:label).uniq
            action_subject(host,
              :host_display_name => host.to_label,
    Severity: Minor
    Found in app/lib/actions/remote_execution/run_host_job.rb - About 1 hr to fix

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

      ScheduleType.propTypes = {
        isTypeStatic: PropTypes.bool.isRequired,
        scheduleType: PropTypes.string.isRequired,
        setScheduleValue: PropTypes.func.isRequired,
        setValid: PropTypes.func.isRequired,
      Severity: Major
      Found in webpack/JobWizard/steps/Schedule/ScheduleType.js and 1 other location - About 1 hr to fix
      webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js on lines 123..128

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

      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

      SelectedChip.propTypes = {
        categoryName: PropTypes.string.isRequired,
        selected: PropTypes.array.isRequired,
        setSelected: PropTypes.func.isRequired,
        setLabel: PropTypes.func.isRequired,
      Severity: Major
      Found in webpack/JobWizard/steps/HostsAndInputs/SelectedChips.js and 1 other location - About 1 hr to fix
      webpack/JobWizard/steps/Schedule/ScheduleType.js on lines 94..99

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

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

      export const JobWizard = ({ rerunData }) => {
        const routerSearch = useSelector(selectRouterSearch);
        const [feature, setFeature] = useState(routerSearch.feature);
        const jobCategoriesResponse = useSelector(selectJobCategoriesResponse);
        const [jobTemplateID, setJobTemplateID] = useState(
      Severity: Minor
      Found in webpack/JobWizard/JobWizard.js - About 1 hr 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 fill_continuous_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def fill_continuous_output(continuous_output)
              if input[:with_event_logging]
                continuous_output_from_template_invocation_events(continuous_output)
                return
              end
      Severity: Minor
      Found in app/lib/actions/remote_execution/run_host_job.rb - About 1 hr 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 CategoryAndTemplate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const CategoryAndTemplate = ({
        jobCategories,
        jobTemplates,
        setJobTemplate,
        selectedTemplateID,
      Severity: Minor
      Found in webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js - About 1 hr 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 ReviewDetails has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      const ReviewDetails = ({
        jobCategory,
        jobTemplateID,
        advancedValues,
        scheduleValue,
      Severity: Minor
      Found in webpack/JobWizard/steps/ReviewDetails/index.js - About 1 hr 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 cancelJob has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const cancelJob = (jobId, force) => dispatch => {
        const infoToast = () =>
          force
            ? sprintf(__('Trying to abort the job %s.'), jobId)
            : sprintf(__('Trying to cancel the job %s.'), jobId);
      Severity: Minor
      Found in webpack/JobInvocationDetail/JobInvocationActions.js - About 1 hr to fix

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

            formProps={{
              label: __('Concurrency level'),
              labelIcon: helpLabel(
                __(
                  'Run at most N tasks at a time. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1.'
        Severity: Major
        Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 1 hr to fix
        webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 35..47

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

        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

            formProps={{
              label: __('Timeout to kill'),
              labelIcon: helpLabel(
                __(
                  'Time in seconds from the start on the remote host after which the job should be killed.'
        Severity: Major
        Found in webpack/JobWizard/steps/AdvancedFields/Fields.js and 1 other location - About 1 hr to fix
        webpack/JobWizard/steps/AdvancedFields/Fields.js on lines 152..164

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        Severity: Major
        Found in webpack/JobWizard/__tests__/integration.test.js and 10 other locations - About 1 hr to fix
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

        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

        Method register has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.register(label, name, options = {})
            pending_migrations = ::Foreman::Plugin.registered_plugins[:foreman_remote_execution]&.pending_migrations
            begin
              # Let's not try to register features if rex is not registered as a plugin
              return false if pending_migrations || pending_migrations.nil?
        Severity: Minor
        Found in app/models/remote_execution_feature.rb - About 1 hr 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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        Severity: Major
        Found in webpack/JobWizard/__tests__/validation.test.js and 10 other locations - About 1 hr to fix
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 180..186
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

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

            render(
              <MockedProvider mocks={gqlMock} addTypename={false}>
                <Provider store={store}>
                  <JobWizard />
                </Provider>
        webpack/JobWizard/__tests__/integration.test.js on lines 90..96
        webpack/JobWizard/__tests__/validation.test.js on lines 32..38
        webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js on lines 103..109
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 19..25
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 117..123
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 149..155
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 173..179
        webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js on lines 192..198
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 16..22
        webpack/JobWizard/steps/HostsAndInputs/__tests__/TemplateInputs.test.js on lines 54..60

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

        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