rsercano/mongoclient

View on GitHub
client/imports/ui/user_management/roles.js

Summary

Maintainability
F
5 days
Test Coverage

File roles.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Communicator, ReactivityProvider } from '/client/imports/facades';
import { Notification, ErrorHandler, SessionManager, UIComponents } from '/client/imports/modules';
import Helper from '/client/imports/helpers/helper';
import UsermanagementHelper from './helper';
import { _ } from 'meteor/underscore';
Severity: Minor
Found in client/imports/ui/user_management/roles.js - About 5 hrs to fix

    prototype has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    UserManagementRoles.prototype = {
      addInheritRole() {
        const db = $('#cmbDatabasesForInheritRole').val();
        const role = $('#cmbRolesForDBForInheritedRole').val();
    
    
    Severity: Minor
    Found in client/imports/ui/user_management/roles.js - About 2 hrs to fix

      Function applyPrivilegeToRole has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        applyPrivilegeToRole() {
          const cmbPrivilegeSelector = $('#cmbPrivilegeResource');
          const cmbPrivilegeCollection = $('#cmbPrivilegeCollection');
      
          const actions = $('#cmbActionsOfPrivilege').val();
      Severity: Minor
      Found in client/imports/ui/user_management/roles.js - About 1 hr to fix

        Function saveRole has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          saveRole() {
            const titleSelector = $('#addEditRoleModalTitle');
            const roleNameSelector = $('#inputRoleUM');
        
            if (SessionManager.get(SessionManager.strSessionUsermanagementRole) && SessionManager.get(SessionManager.strSessionUsermanagementRole).isBuiltin
        Severity: Minor
        Found in client/imports/ui/user_management/roles.js - About 1 hr to fix

          Function initRoles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            initRoles() {
              Notification.start('#btnCloseUMRoles');
          
              const command = {
                rolesInfo: 1,
          Severity: Minor
          Found in client/imports/ui/user_management/roles.js - About 1 hr to fix

            Function popEditRoleModal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              popEditRoleModal(role) {
                $('#addEditRoleModalTitle').text(Helper.translate({ key: 'edit_role' }));
            
                Notification.start('#btnCloseUMRoles');
            
            
            Severity: Minor
            Found in client/imports/ui/user_management/roles.js - About 1 hr to fix

              Function applyPrivilegeToRole has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                applyPrivilegeToRole() {
                  const cmbPrivilegeSelector = $('#cmbPrivilegeResource');
                  const cmbPrivilegeCollection = $('#cmbPrivilegeCollection');
              
                  const actions = $('#cmbActionsOfPrivilege').val();
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 55 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function saveRole has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                saveRole() {
                  const titleSelector = $('#addEditRoleModalTitle');
                  const roleNameSelector = $('#inputRoleUM');
              
                  if (SessionManager.get(SessionManager.strSessionUsermanagementRole) && SessionManager.get(SessionManager.strSessionUsermanagementRole).isBuiltin
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function getActionColumn has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              const getActionColumn = function ({ isBuiltin = false, actionType = 'DELETE', targetIndex = 2, editClass = 'editor_edit_privilege', deleteClass = 'editor_delete' }) {
                return {
                  targets: [targetIndex],
                  data: null,
                  width: '5%',
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function initResourcesForPrivileges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                initResourcesForPrivileges(dbToSelect, collectionToSelect) {
                  Communicator.call({
                    methodName: 'getDatabases',
                    callback: (err, result) => {
                      let data;
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function addInheritRole has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                addInheritRole() {
                  const db = $('#cmbDatabasesForInheritRole').val();
                  const role = $('#cmbRolesForDBForInheritedRole').val();
              
                  if (!db) {
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function getResourceObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                getResourceObject(resourceString) {
                  if (resourceString !== 'anyResource' && resourceString !== 'cluster') {
                    const result = {};
              
                    if (resourceString.indexOf('@') !== -1) {
              Severity: Minor
              Found in client/imports/ui/user_management/roles.js - About 35 mins 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

              Avoid too many return statements within this function.
              Open

                  if (resource.db) return resource.db;
              Severity: Major
              Found in client/imports/ui/user_management/roles.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return '';
                Severity: Major
                Found in client/imports/ui/user_management/roles.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      if (resource.collection) return `<b>${resource.collection}</b>`;
                  Severity: Major
                  Found in client/imports/ui/user_management/roles.js - About 30 mins to fix

                    Function getResource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      getResource(resource) {
                        if (!resource) return '';
                        if (resource.anyResource) return 'anyResource';
                        if (resource.cluster) return 'cluster';
                        if (resource.db && resource.collection) return `<b>${resource.collection}</b>@${resource.db}`;
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function startEditingRole has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      startEditingRole() {
                        if (!SessionManager.get(SessionManager.strSessionUsermanagementPrivilege)) return;
                    
                        $('#addEditPrivilegeModalTitle').text(Helper.translate({ key: 'edit_privilege' }));
                        $('#addEditPrivilegeModalText').text('');
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function initActionsForPrivilege has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      initActionsForPrivilege(actions) {
                        Communicator.call({
                          methodName: 'getAllActions',
                          callback: (err, result) => {
                            let data;
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js - About 25 mins 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 2 locations. Consider refactoring.
                    Open

                      addInheritRole() {
                        const db = $('#cmbDatabasesForInheritRole').val();
                        const role = $('#cmbRolesForDBForInheritedRole').val();
                    
                        if (!db) {
                    Severity: Major
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 1 day to fix
                    client/imports/ui/user_management/users.js on lines 46..72

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

                    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

                      populateInheritRolesToSave() {
                        const result = [];
                        const rolesToInherit = $('#tblRolesToInherit').DataTable().rows().data();
                        for (let i = 0; i < rolesToInherit.length; i += 1) {
                          result.push({
                    Severity: Major
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 4 hrs to fix
                    client/imports/ui/user_management/users.js on lines 189..200

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 118.

                    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

                      deleteRole() {
                        if (!SessionManager.get(SessionManager.strSessionUsermanagementRole)) return;
                    
                        const command = { dropRole: SessionManager.get(SessionManager.strSessionUsermanagementRole).role };
                        UsermanagementHelper.proceedDroppingRoleOrUser('#btnCloseUMRoles', command, () => { this.initRoles(); });
                    Severity: Major
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 2 hrs to fix
                    client/imports/ui/user_management/users.js on lines 159..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 84.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if (err || result.error) ErrorHandler.showMeteorFuncError(err, result);
                            else {
                              this.initRoles();
                              Notification.success('saved-successfully');
                    
                    
                    Severity: Major
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 1 hr to fix
                    client/imports/ui/user_management/users.js on lines 114..119

                    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

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

                            UIComponents.Combobox.init({ selector, data, options: { create_option: true, persistent_create_option: true, skip_no_results: true } });
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 35 mins to fix
                    client/imports/ui/user_management/roles.js on lines 375..375

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                            UIComponents.Combobox.init({ selector, data, options: { create_option: true, persistent_create_option: true, skip_no_results: true } });
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js and 1 other location - About 35 mins to fix
                    client/imports/ui/user_management/roles.js on lines 396..396

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                        const connection = ReactivityProvider.findOne(ReactivityProvider.types.Connections, { _id: SessionManager.get(SessionManager.strSessionConnection)._id });
                    Severity: Major
                    Found in client/imports/ui/user_management/roles.js and 11 other locations - About 35 mins to fix
                    client/imports/ui/backup/index.js on lines 204..204
                    client/imports/ui/collection/add.js on lines 277..277
                    client/imports/ui/collection/update_view_pipeline.js on lines 36..36
                    client/imports/ui/collection/validation_rules.js on lines 25..25
                    client/imports/ui/connection/helper.js on lines 117..117
                    client/imports/ui/connection/index.js on lines 128..128
                    client/imports/ui/user_management/tree.js on lines 116..116
                    client/imports/ui/user_management/users.js on lines 132..132
                    client/imports/ui/user_management/users.js on lines 226..226
                    client/imports/views/layouts/navigation/navigation.js on lines 28..28
                    client/imports/views/layouts/navigation/navigation.js on lines 110..110

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                              if (err || result.error) ErrorHandler.showMeteorFuncError(err, result);
                              else data = Helper.populateComboboxData(result.result, 'name');
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js and 2 other locations - About 30 mins to fix
                    client/imports/ui/backup/index.js on lines 35..36
                    client/imports/ui/user_management/roles.js on lines 328..329

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if (err || result.error) ErrorHandler.showMeteorFuncError(err, result);
                            else data = Helper.populateComboboxData(result.result, 'name');
                    Severity: Minor
                    Found in client/imports/ui/user_management/roles.js and 2 other locations - About 30 mins to fix
                    client/imports/ui/backup/index.js on lines 35..36
                    client/imports/ui/user_management/roles.js on lines 356..357

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status