bcgov/nr-get-token

View on GitHub

Showing 143 of 143 total issues

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

  getUsers(acronym) {
    if (acronym) {
      return getokAxios().get(`${ApiRoutes.ACRONYMS}/${acronym}/users`);
    } else {
      return Promise.reject('No acronym supplied');
Severity: Major
Found in app/frontend/src/services/acronymService.js and 1 other location - About 1 hr to fix
app/frontend/src/services/acronymService.js on lines 21..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

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

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

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

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

Refactorings

Further Reading

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

  getAcronym(acronym) {
    if (acronym) {
      return getokAxios().get(`${ApiRoutes.ACRONYMS}/${acronym}`);
    } else {
      return Promise.reject('No acronym supplied');
Severity: Major
Found in app/frontend/src/services/acronymService.js and 1 other location - About 1 hr to fix
app/frontend/src/services/acronymService.js on lines 63..69

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

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

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

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

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

Refactorings

Further Reading

Consider simplifying this complex logical expression.
Open

      if (Array.isArray(userClients) && userClients.length) {
        state.acronyms = state.acronyms.map(acr => {
          const clientSet = userClients.find(client => client.acronym === acr.acronym);
          acr.clientStatus = {
            dev: clientSet && clientSet.dev && clientSet.dev.enabled,
Severity: Critical
Found in app/frontend/src/store/modules/user.js - About 1 hr to fix

    Function exports has 48 lines of code (exceeds 40 allowed). Consider refactoring.
    Open

    module.exports = (sequelize, DataTypes) => {
      const Acronym = sequelize.define('Acronym', {
        acronymId: {
          allowNull: false,
          defaultValue: DataTypes.UUIDV4,
    Severity: Minor
    Found in app/src/models/acronym.js - About 1 hr to fix

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

        DeploymentHistory.associate = models => {
          DeploymentHistory.belongsTo(models.Acronym, {
            foreignKey: 'acronymId'
          });
          DeploymentHistory.belongsTo(models.User, {
      Severity: Major
      Found in app/src/models/deploymenthistory.js and 1 other location - About 1 hr to fix
      app/src/models/useracronym.js on lines 22..29

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 61.

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

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

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

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

      Refactorings

      Further Reading

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

        UserAcronym.associate = models => {
          UserAcronym.belongsTo(models.Acronym, {
            foreignKey: 'acronymId'
          });
          UserAcronym.belongsTo(models.User, {
      Severity: Major
      Found in app/src/models/useracronym.js and 1 other location - About 1 hr to fix
      app/src/models/deploymenthistory.js on lines 31..38

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 61.

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

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

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

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

      Refactorings

      Further Reading

      Function exports has 43 lines of code (exceeds 40 allowed). Consider refactoring.
      Open

      module.exports = (sequelize, DataTypes) => {
        const User = sequelize.define('User', {
          userId: {
            allowNull: false,
            defaultValue: DataTypes.UUIDV4,
      Severity: Minor
      Found in app/src/models/user.js - About 1 hr to fix

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

          db.sequelize
            .authenticate()
            .then(() => {
              state.connections.data = true;
              log.info('Database connection reachable');
        Severity: Major
        Found in app/app.js and 1 other location - About 1 hr to fix
        app/app.js on lines 194..202

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

        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

            db.sequelize
              .authenticate()
              .then(() => (state.connections.data = true))
              .catch((err) => {
                state.connections.data = false;
        Severity: Major
        Found in app/app.js and 1 other location - About 1 hr to fix
        app/app.js on lines 160..175

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

        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

                {
                  'name': 'Client Host',
                  'protocol': 'openid-connect',
                  'protocolMapper': 'oidc-usersessionmodel-note-mapper',
                  'consentRequired': false,
        Severity: Major
        Found in app/src/components/realmAdminSvc.js and 2 other locations - About 55 mins to fix
        app/src/components/realmAdminSvc.js on lines 118..130
        app/src/components/realmAdminSvc.js on lines 144..156

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

        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

                queryInterface.bulkDelete('user_acronym', {
                  userAcronymId: {
                    [Sequelize.Op.in]: userAcronymData.map(entry => entry.userAcronymId)
                  }
                }, { transaction: t }),
        Severity: Major
        Found in app/src/seeders/20200330000000-dev-users.js and 2 other locations - About 55 mins to fix
        app/src/seeders/20200330000000-dev-users.js on lines 111..115
        app/src/seeders/20200330000000-dev-users.js on lines 116..120

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

        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

                {
                  'name': 'Client IP Address',
                  'protocol': 'openid-connect',
                  'protocolMapper': 'oidc-usersessionmodel-note-mapper',
                  'consentRequired': false,
        Severity: Major
        Found in app/src/components/realmAdminSvc.js and 2 other locations - About 55 mins to fix
        app/src/components/realmAdminSvc.js on lines 118..130
        app/src/components/realmAdminSvc.js on lines 131..143

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

        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

                queryInterface.bulkDelete('acronym', {
                  acronymId: {
                    [Sequelize.Op.in]: acronymData.map(entry => entry.acronymId)
                  }
                }, { transaction: t })
        Severity: Major
        Found in app/src/seeders/20200330000000-dev-users.js and 2 other locations - About 55 mins to fix
        app/src/seeders/20200330000000-dev-users.js on lines 106..110
        app/src/seeders/20200330000000-dev-users.js on lines 111..115

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

        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

                {
                  'name': 'Client ID',
                  'protocol': 'openid-connect',
                  'protocolMapper': 'oidc-usersessionmodel-note-mapper',
                  'consentRequired': false,
        Severity: Major
        Found in app/src/components/realmAdminSvc.js and 2 other locations - About 55 mins to fix
        app/src/components/realmAdminSvc.js on lines 131..143
        app/src/components/realmAdminSvc.js on lines 144..156

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

        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

                queryInterface.bulkDelete('user', {
                  userId: {
                    [Sequelize.Op.in]: userData.map(entry => entry.userId)
                  }
                }, { transaction: t }),
        Severity: Major
        Found in app/src/seeders/20200330000000-dev-users.js and 2 other locations - About 55 mins to fix
        app/src/seeders/20200330000000-dev-users.js on lines 106..110
        app/src/seeders/20200330000000-dev-users.js on lines 116..120

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

        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

            const [devClients, testClients, prodClients] = await Promise.all([
              utils.getClientsFromEnv('dev', makeItAnArray),
              utils.getClientsFromEnv('test', makeItAnArray),
              utils.getClientsFromEnv('prod', makeItAnArray),
            ]);
        Severity: Minor
        Found in app/src/components/acronyms.js and 1 other location - About 50 mins to fix
        app/src/components/users.js on lines 69..73

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

        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

            const [devClients, testClients, prodClients] = await Promise.all([
              utils.getClientsFromEnv('dev', acronyms),
              utils.getClientsFromEnv('test', acronyms),
              utils.getClientsFromEnv('prod', acronyms),
            ]);
        Severity: Minor
        Found in app/src/components/users.js and 1 other location - About 50 mins to fix
        app/src/components/acronyms.js on lines 135..139

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

        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

            try {
              const apiEndpoint = config.get('serviceClient.ches.apiEndpoint');
              const token = await email._getChesToken();
              const response = await axios.post(
                apiEndpoint + '/v1/email',
        Severity: Major
        Found in app/src/components/email.js and 5 other locations - About 45 mins to fix
        app/src/components/acronyms.js on lines 26..35
        app/src/components/acronyms.js on lines 43..52
        app/src/components/email.js on lines 12..28
        app/src/components/email.js on lines 83..123
        app/src/components/github.js on lines 15..38

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

        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

            try {
              const acronymDetails = await acronymService.findAll();
              log.verbose('acronymDetails', { function: 'getAllAcronyms', acronymDetails: acronymDetails });
              return acronymDetails ? acronymDetails : [];
            } catch (error) {
        Severity: Major
        Found in app/src/components/acronyms.js and 5 other locations - About 45 mins to fix
        app/src/components/acronyms.js on lines 26..35
        app/src/components/email.js on lines 12..28
        app/src/components/email.js on lines 40..68
        app/src/components/email.js on lines 83..123
        app/src/components/github.js on lines 15..38

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

        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

            try {
              const tokenEndpoint = config.get('serviceClient.ches.tokenEndpoint');
              const username = config.get('serviceClient.ches.username');
              const password = config.get('serviceClient.ches.password');
        
        
        Severity: Major
        Found in app/src/components/email.js and 5 other locations - About 45 mins to fix
        app/src/components/acronyms.js on lines 26..35
        app/src/components/acronyms.js on lines 43..52
        app/src/components/email.js on lines 40..68
        app/src/components/email.js on lines 83..123
        app/src/components/github.js on lines 15..38

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

        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