theforeman/foreman_ansible

View on GitHub

Showing 105 of 105 total issues

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

/* eslint-disable max-lines */
import variableOverridesQuery from '../../../../../graphql/queries/hostVariableOverrides.gql';
import deleteAnsibleVariableOverride from '../../../../../graphql/mutations/deleteAnsibleVariableOverride.gql';
import updateAnsibleVariableOverride from '../../../../../graphql/mutations/updateAnsibleVariableOverride.gql';
import createAnsibleVariableOverride from '../../../../../graphql/mutations/createAnsibleVariableOverride.gql';

    Function NewRecurringJobModal has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const NewRecurringJobModal = props => {
      const { onClose, resourceId, resourceName } = props;
      const dispatch = useDispatch();
    
      const [callMutation] = useMutation(createJobInvocation, {

      Function withLoading has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const withLoading = Component => {
        const defaultEmptyStateProps = {
          header: __('Nothing Found!'),
          description: '',
        };
      Severity: Major
      Found in webpack/components/withLoading.js - About 3 hrs to fix

        Function ImportRolesAndVariablesTable has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        const ImportRolesAndVariablesTable = ({
          columnsData,
          rowsData,
          proxy,
          onSubmit,

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

        const DualList = props => {
          const defaultSelectState = { availableSelected: [], chosenSelected: [] };
          const [selectState, setSelectState] = useState(defaultSelectState);
        
          const onItemClick = stateName => itemName => (...args) => {
        Severity: Major
        Found in webpack/components/DualList/index.js - About 3 hrs to fix

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

                            <Td>
                              <a
                                onClick={() =>
                                  window.tfm.nav.pushUrl(
                                    `/job_invocations/${decodeId(job.id)}`
          webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js on lines 75..87

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

          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

                        <Td>
                          <a
                            onClick={() =>
                              window.tfm.nav.pushUrl(
                                `/job_invocations/${decodeId(job.id)}`
          webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js on lines 54..66

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

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

            render() {
              const {
                loading,
                pagination,
                itemCount,
          Severity: Major
          Found in webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js - About 2 hrs to fix

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

                <div className="pf-c-dual-list-selector__controls-item">
                  <button
                    className="pf-c-button pf-m-plain"
                    type="button"
                    disabled={props.addSelectedDisabled}
            Severity: Major
            Found in webpack/components/DualList/ListControls.js and 3 other locations - About 2 hrs to fix
            webpack/components/DualList/ListControls.js on lines 18..28
            webpack/components/DualList/ListControls.js on lines 29..39
            webpack/components/DualList/ListControls.js on lines 40..50

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

            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

                <div className="pf-c-dual-list-selector__controls-item">
                  <button
                    className="pf-c-button pf-m-plain"
                    type="button"
                    disabled={props.addAllDisabled}
            Severity: Major
            Found in webpack/components/DualList/ListControls.js and 3 other locations - About 2 hrs to fix
            webpack/components/DualList/ListControls.js on lines 7..17
            webpack/components/DualList/ListControls.js on lines 29..39
            webpack/components/DualList/ListControls.js on lines 40..50

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

            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

                <div className="pf-c-dual-list-selector__controls-item">
                  <button
                    className="pf-c-button pf-m-plain"
                    type="button"
                    disabled={props.removeSelectedDisabled}
            Severity: Major
            Found in webpack/components/DualList/ListControls.js and 3 other locations - About 2 hrs to fix
            webpack/components/DualList/ListControls.js on lines 7..17
            webpack/components/DualList/ListControls.js on lines 18..28
            webpack/components/DualList/ListControls.js on lines 29..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 86.

            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

                <div className="pf-c-dual-list-selector__controls-item">
                  <button
                    className="pf-c-button pf-m-plain"
                    type="button"
                    disabled={props.removeAllDisabled}
            Severity: Major
            Found in webpack/components/DualList/ListControls.js and 3 other locations - About 2 hrs to fix
            webpack/components/DualList/ListControls.js on lines 7..17
            webpack/components/DualList/ListControls.js on lines 18..28
            webpack/components/DualList/ListControls.js on lines 40..50

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

              if (Array.isArray(errors) && errors.length > 0) {
                showToast({
                  type: 'error',
                  message: formatError(joinErrors(errors)),
                });
            webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobHelper.js on lines 83..94

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

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                if (Array.isArray(errors) && errors.length > 0) {
                  showToast({
                    type: 'danger',
                    message: formatError(joinErrors(errors)),
                  });
            webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesModalHelper.js on lines 24..35

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

            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

            EditRolesForm.propTypes = {
              closeModal: PropTypes.func.isRequired,
              assignedRoles: PropTypes.array,
              availableRoles: PropTypes.array,
              actions: PropTypes.array.isRequired,
            webpack/components/DualList/ListItem.js on lines 55..62

            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

            ListItem.propTypes = {
              selected: PropTypes.bool.isRequired,
              dragging: PropTypes.bool,
              draggable: PropTypes.bool,
              onClick: PropTypes.func.isRequired,
            Severity: Major
            Found in webpack/components/DualList/ListItem.js and 1 other location - About 2 hrs to fix
            webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js on lines 79..86

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

            const EditRolesForm = props => {
              const {
                assignedRoles,
                availableRoles,
                closeModal,

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

              AnsibleVariableOverridesTable.propTypes = {
                variables: PropTypes.array.isRequired,
                hostAttrs: PropTypes.object.isRequired,
                hostId: PropTypes.number.isRequired,
                hostGlobalId: PropTypes.string.isRequired,
              webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js on lines 92..98

              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

              EditRolesModal.propTypes = {
                assignedRoles: PropTypes.array.isRequired,
                isOpen: PropTypes.bool.isRequired,
                closeModal: PropTypes.func.isRequired,
                hostId: PropTypes.number.isRequired,
              webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js on lines 221..227

              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

              File register.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              Foreman::Plugin.register :foreman_ansible do
                requires_foreman '>= 3.10.0'
                register_gettext
              
                settings do
              Severity: Minor
              Found in lib/foreman_ansible/register.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language