dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

                    <select name='reasonForVisit'
                        onChange={this._handleKeyChange}
                        value={reasonForVisit}
                        autoComplete='off'
                    >
packages/optimise-ui/src/components/editMedicalElements/editVisit.jsx on lines 170..180

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

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 reducers.js has 358 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import initialState from './initialState';
import { combineReducers } from 'redux';
import actionTypes from './actions/listOfActions';
import { dispatch as workerDispatch } from '../webWorker';

Severity: Minor
Found in packages/optimise-ui/src/redux/reducers.js - About 4 hrs to fix

    Function createCe has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        static createCe({ body, user }, res) {
            if ((body.hasOwnProperty('visitId') || body.hasOwnProperty('patient')) && body.hasOwnProperty('dateStartDate') && body.hasOwnProperty('type') &&
                typeof body.visitId === 'number' && typeof body.dateStartDate === 'string' && typeof body.type === 'number') {
                const momentStart = moment(body.dateStartDate, moment.ISO_8601);
                if (!momentStart.isValid()) {
    Severity: Minor
    Found in packages/optimise-core/src/controllers/ceController.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

    File utils.jsx has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component, Fragment } from 'react';
    import { Link } from 'react-router-dom';
    import merge from 'deepmerge';
    import moment from 'moment';
    import { PickDate } from '../createMedicalElements/datepicker';
    Severity: Minor
    Found in packages/optimise-ui/src/components/medicalData/utils.jsx - About 4 hrs to fix

      Function createTreatment has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          static createTreatment({ body, user }, res) {
              if (!(body.hasOwnProperty('visitId') && body.hasOwnProperty('drugId') && body.hasOwnProperty('startDate'))) {
                  res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
                  return;
              }
      Severity: Minor
      Found in packages/optimise-core/src/controllers/treatmentController.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

      File createConmitantMeds.jsx has 350 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Component } from 'react';
      import { connect } from 'react-redux';
      import { BackButton } from '../medicalData/utils';
      import store from '../../redux/store';
      import { DeleteButton } from '../patientProfile/sharedComponents';

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

                    for (let i = 0; i < globalMaxComorbidities; i++) {
                        line[`comorbid_recorded_during_visit_code_${i + 1}`] = tree.comorbidities[i] ? tree.comorbidities[i].comorbid_recorded_during_visit_code : '';
                        line[`comorbid_recorded_during_visit_name_${i + 1}`] = tree.comorbidities[i] ? tree.comorbidities[i].comorbid_recorded_during_visit_name : '';
                    }
        packages/optimise-core/src/controllers/exportDataController.js on lines 149..152

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

        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

                    for (let i = 0; i < globalMaxDiagnosis; i++) {
                        line[`diagnosis_${i + 1}`] = tree.diagnoses[i] ? tree.diagnoses[i].diagnosis : '';
                        line[`diagnosis_date_${i + 1}`] = tree.diagnoses[i] ? tree.diagnoses[i].diagnosisDate : '';
                    }
        packages/optimise-core/src/controllers/exportDataController.js on lines 155..158

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

        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

                        <td><EditButton to={renderedInFrontPage ? `/patientProfile/${patientId}/visitFrontPage/${this.props.match.params.visitId}/page/${this.props.match.params.currentPage}/edit/${data.id}${this.props.location.search}` : `/patientProfile/${patientId}/edit/clinicalEvent/${data.id}`} /></td>
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 103..103
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 146..146

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

        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

                        <td><EditButton to={renderedInFrontPage ? `/patientProfile/${patientId}/visitFrontPage/${this.props.match.params.visitId}/page/${this.props.match.params.currentPage}/edit/${data.id}${this.props.location.search}` : `/patientProfile/${patientId}/edit/test/${data.id}`} /></td>
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 146..146
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 181..181

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

        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

                        <td><EditButton to={renderedInFrontPage ? `/patientProfile/${patientId}/visitFrontPage/${this.props.match.params.visitId}/page/${this.props.match.params.currentPage}/edit/${data.id}${this.props.location.search}` : `/patientProfile/${patientId}/edit/treatment/${data.id}`} /></td>
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 103..103
        packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 181..181

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

        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

                for (let i = 0; i < numOfUpdates; i++) {
                    const entry = {
                        field: Object.keys(body.update)[i],
                        value: body.update[Object.keys(body.update)[i]],
                        createdByUser: user.id,
        Severity: Major
        Found in packages/optimise-core/src/controllers/dataController.js and 1 other location - About 4 hrs to fix
        packages/optimise-core/src/controllers/dataController.js on lines 96..105

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

        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

                case actionTypes.availableFields.GET_ICD11_SUCCESS:
                    hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                    workerDispatch({
                        type: actionTypes.availableFields.GET_ICD11_TREE_SUCESS,
                        work: 'tree',
        Severity: Major
        Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 4 hrs to fix
        packages/optimise-ui/src/redux/reducers.js on lines 141..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 121.

        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

                for (let i = 0; i < numOfAdds; i++) {
                    const entry = {
                        field: Object.keys(body.add)[i],
                        value: body.add[Object.keys(body.add)[i]],
                        createdByUser: user.id,
        Severity: Major
        Found in packages/optimise-core/src/controllers/dataController.js and 1 other location - About 4 hrs to fix
        packages/optimise-core/src/controllers/dataController.js on lines 86..95

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

        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

                case actionTypes.availableFields.GET_MEDDRA_SUCESS:
                    hash = action.payload.reduce((map, el) => { map[el.id] = el; return map; }, {});
                    workerDispatch({
                        type: actionTypes.availableFields.GET_MEDDRA_TREE_SUCESS,
                        work: 'tree',
        Severity: Major
        Found in packages/optimise-ui/src/redux/reducers.js and 1 other location - About 4 hrs to fix
        packages/optimise-ui/src/redux/reducers.js on lines 153..161

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

        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 treatmentInterruptions.jsx has 345 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Component } from 'react';
        import { connect } from 'react-redux';
        import moment from 'moment';
        import { BackButton } from './utils';
        import { PickDate } from '../createMedicalElements/datepicker';

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

                      if (!momentStart.isValid() && body.startDate !== null) {
                          const msg = message.dateError[momentStart.invalidAt()] !== undefined ? message.dateError[momentStart.invalidAt()] : message.userError.INVALIDDATE;
                          res.status(400).json(ErrorHelper(msg, new Error(message.userError.INVALIDDATE)));
                          return;
                      }
          packages/optimise-core/src/controllers/demographicDataController.js on lines 57..61
          packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 34..38
          packages/optimise-core/src/controllers/testController.js on lines 19..23
          packages/optimise-core/src/controllers/treatmentController.js on lines 160..164
          packages/optimise-core/src/controllers/visitController.js on lines 38..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 120.

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

                  if (!momentVisit.isValid() && body.visitDate !== null) {
                      const msg = message.dateError[momentVisit.invalidAt()] !== undefined ? message.dateError[momentVisit.invalidAt()] : message.userError.INVALIDDATE;
                      res.status(400).json(ErrorHelper(msg, new Error(message.userError.INVALIDDATE)));
                      return;
                  }
          Severity: Major
          Found in packages/optimise-core/src/controllers/visitController.js and 5 other locations - About 4 hrs to fix
          packages/optimise-core/src/controllers/demographicDataController.js on lines 57..61
          packages/optimise-core/src/controllers/demographicDataController.js on lines 90..94
          packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 34..38
          packages/optimise-core/src/controllers/testController.js on lines 19..23
          packages/optimise-core/src/controllers/treatmentController.js on lines 160..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 120.

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

                  if (!momentExpect.isValid() && body.expectedOccurDate !== null) {
                      const msg = message.dateError[momentExpect.invalidAt()] !== undefined ? message.dateError[momentExpect.invalidAt()] : message.userError.INVALIDDATE;
                      res.status(400).json(ErrorHelper(msg, new Error(message.userError.INVALIDDATE)));
                      return;
                  }
          Severity: Major
          Found in packages/optimise-core/src/controllers/testController.js and 5 other locations - About 4 hrs to fix
          packages/optimise-core/src/controllers/demographicDataController.js on lines 57..61
          packages/optimise-core/src/controllers/demographicDataController.js on lines 90..94
          packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 34..38
          packages/optimise-core/src/controllers/treatmentController.js on lines 160..164
          packages/optimise-core/src/controllers/visitController.js on lines 38..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 120.

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

                      if (!momentDiagnos.isValid() && body.diagnosisDate !== null) {
                          const msg = messages.dateError[momentDiagnos.invalidAt()] !== undefined ? messages.dateError[momentDiagnos.invalidAt()] : messages.userError.INVALIDDATE;
                          res.status(400).json(ErrorHelper(msg, new Error(messages.userError.INVALIDDATE)));
                          return;
                      }
          packages/optimise-core/src/controllers/demographicDataController.js on lines 57..61
          packages/optimise-core/src/controllers/demographicDataController.js on lines 90..94
          packages/optimise-core/src/controllers/testController.js on lines 19..23
          packages/optimise-core/src/controllers/treatmentController.js on lines 160..164
          packages/optimise-core/src/controllers/visitController.js on lines 38..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 120.

          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