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

                                <tbody>
                                    {this.props.data.treatments
                                        .filter(el => el['orderedDuringVisit'] === this.props.visitId)
                                        .map(el => <Medication key={el.id} data={el} />)}
                                </tbody>
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 351..355

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

                                <tbody>
                                    {this.props.data.tests
                                        .filter(el => el['orderedDuringVisit'] === this.props.visitId)
                                        .map(el => <Test key={el.id} data={el} />)}
                                </tbody>
packages/optimise-ui/src/components/patientProfile/patientChart.jsx on lines 369..373

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

DemographicDataController has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class DemographicDataController {

    static createDemographic({ body, user }, res) {
        if ((!body.hasOwnProperty('patient') || !body.hasOwnProperty('DOB') || !body.hasOwnProperty('gender') || !body.hasOwnProperty('dominant_hand')
            || !body.hasOwnProperty('ethnicity') || !body.hasOwnProperty('country_of_origin'))) {
Severity: Minor
Found in packages/optimise-core/src/controllers/demographicDataController.js - About 2 hrs to fix

    OptimiseServer has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OptimiseServer {
        constructor(config) {
            this.config = new optimiseOptions(config);
            this.app = express();
    
    
    Severity: Minor
    Found in packages/optimise-core/src/optimiseServer.js - About 2 hrs to fix

      Function render has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render() {
              if (!this.props.data.demographicData) {
                  return null;
              }
              const { visits } = this.props.data;
      Severity: Major
      Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 2 hrs to fix

        Function render has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            render() {
                const { patientProfile, fields } = this.props;
                const { interruptionReasons, meddra_Hash } = fields;
        
                let _style = style;

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

              static searchReasons(reason) {
                  return new Promise((resolve, reject) => dbcon()('REASONS').select('*').where('value', 'like', reason).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.GETFAIL, error))));
              }
          Severity: Major
          Found in packages/optimise-core/src/core/treatment.js and 1 other location - About 2 hrs to fix
          packages/optimise-core/src/core/treatment.js on lines 52..54

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

          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

              static searchDrugs(drugSample) {
                  return new Promise((resolve, reject) => dbcon()('AVAILABLE_DRUGS').select('*').where('name', 'like', drugSample).then((result) => resolve(result)).catch((error) => reject(ErrorHelper(message.errorMessages.GETFAIL, error))));
              }
          Severity: Major
          Found in packages/optimise-core/src/core/treatment.js and 1 other location - About 2 hrs to fix
          packages/optimise-core/src/core/treatment.js on lines 44..46

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

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

              render() {
                  const { match, location } = this.props;
                  const { pregnancySubStudyConsent } = this.props.data;
                  const pageNumberToElementMap = {
                      0: <VisitFrontPageIntroduction match={match} location={location} />,

            Function filterEmptyRenders has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            const filterEmptyRenders = (allFields, inputType, typedict) => allFields.map(data => {
            
                const toTitleCase = (str) => str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
            
                let value;
            Severity: Minor
            Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 2 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    case actionTypes.availableFields.GET_PREGNANCY_ENTRY_TYPES_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                        newState = { ...state, pregnancyEntryTypes: action.payload, pregnancyEntryTypes_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

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

                    case actionTypes.availableFields.GET_CE_TYPES_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                        newState = { ...state, clinicalEventTypes: action.payload, clinicalEventTypes_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 133..136
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

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

                    case actionTypes.availableFields.GET_VISIT_SECTIONS_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                        newState = { ...state, visitSections: action.payload, visitSections_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 133..136

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

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

                    case actionTypes.availableFields.GET_TEST_TYPES_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.name; return map; }, {});
                        newState = { ...state, testTypes: action.payload, testTypes_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 133..136
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

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

                    case actionTypes.availableFields.GET_PREGNANCY_ENTRY_FIELDS_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                        newState = { ...state, pregnancyEntryFields: action.payload, pregnancyEntryFields_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 133..136
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

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

                    case actionTypes.availableFields.GET_PREGNANCY_OUTCOMES_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                        newState = { ...state, pregnancyOutcomes: action.payload, pregnancyOutcomes_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 117..120
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 133..136
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

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

                    case actionTypes.availableFields.GET_DIAGNOSES_SUCCESS:
                        hash = action.payload.reduce((map, el) => { map[el.id] = el.value; return map; }, {});
                        newState = { ...state, diagnoses: action.payload, diagnoses_Hash: [hash] };
                        break;
            Severity: Major
            Found in packages/optimise-ui/src/redux/reducers.js and 6 other locations - About 2 hrs to fix
            packages/optimise-ui/src/redux/reducers.js on lines 60..63
            packages/optimise-ui/src/redux/reducers.js on lines 87..90
            packages/optimise-ui/src/redux/reducers.js on lines 125..128
            packages/optimise-ui/src/redux/reducers.js on lines 129..132
            packages/optimise-ui/src/redux/reducers.js on lines 133..136
            packages/optimise-ui/src/redux/reducers.js on lines 165..168

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

            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

                plugins: (process.env.NODE_ENV === 'development' ? [
                    new RunScriptWebpackPlugin({
                        name: 'server.js'
                    }),
                    new webpack.HotModuleReplacementPlugin()
            Severity: Major
            Found in packages/optimise-remote-control/webpack.config.server.js and 1 other location - About 2 hrs to fix
            packages/optimise-sync/webpack.config.server.js on lines 40..52

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

            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

                    items.push({
                        id: 'edss_plotter_padding',
                        group: 5,
                        start: moment(maxTimeStart).subtract(1, 'day').valueOf(),
                        end: moment().add(1, 'day').valueOf(),
            packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx on lines 215..223

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

            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

                plugins: (process.env.NODE_ENV === 'development' ? [
                    new RunScriptWebpackPlugin({
                        name: 'server.js'
                    }),
                    new webpack.HotModuleReplacementPlugin()
            Severity: Major
            Found in packages/optimise-sync/webpack.config.server.js and 1 other location - About 2 hrs to fix
            packages/optimise-remote-control/webpack.config.server.js on lines 42..54

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

            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