owncloud/core

View on GitHub
settings/js/users/users.js

Summary

Maintainability
F
1 wk
Test Coverage

File users.js has 926 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Copyright (c) 2014, Arthur Schiwon <blizzz@owncloud.com>
 * Copyright (c) 2014, Raghu Nayyar <beingminimal@gmail.com>
 * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
 * This file is licensed under the Affero General Public License version 3 or later.
Severity: Major
Found in settings/js/users/users.js - About 2 days to fix

    Function add has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        add: function (user) {
            if (this.currentGid && this.currentGid !== '_everyone' && user.groups[this.currentGid] === undefined) {
                return;
            }
    
    
    Severity: Major
    Found in settings/js/users/users.js - About 4 hrs to fix

      Function _triggerGroupEdit has 92 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _triggerGroupEdit: function($td, isSubadminSelect) {
              var $groupsListContainer = $td.find('.groupsListContainer');
              var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group');
              var user = UserList.getUID($td);
              var checked = _.keys($td.data('groups')) || [];
      Severity: Major
      Found in settings/js/users/users.js - About 3 hrs to fix

        UserList has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        var UserList = {
            availableGroups: {},
            offset: 0,
            usersToLoad: 200,
            initialUsersToLoad: 200, // initial number of users to load
        Severity: Minor
        Found in settings/js/users/users.js - About 3 hrs to fix

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

              add: function (user) {
                  if (this.currentGid && this.currentGid !== '_everyone' && user.groups[this.currentGid] === undefined) {
                      return;
                  }
          
          
          Severity: Minor
          Found in settings/js/users/users.js - 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

          Function alphanum has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              alphanum: function(a, b) {
                  function chunkify(t) {
                      var tz = [], x = 0, y = -1, n = 0, i, j;
          
                      while (i = (j = t.charAt(x++)).charCodeAt(0)) {
          Severity: Minor
          Found in settings/js/users/users.js - 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

          Function applyGroupSelect has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              applyGroupSelect: function (element, user, checked) {
                  var $element = $(element);
          
                  var checkHandler = null;
                  if(user) { // Only if in a user row, and not the #newusergroups select
          Severity: Minor
          Found in settings/js/users/users.js - About 1 hr to fix

            Function _triggerGroupEdit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                _triggerGroupEdit: function($td, isSubadminSelect) {
                    var $groupsListContainer = $td.find('.groupsListContainer');
                    var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group');
                    var user = UserList.getUID($td);
                    var checked = _.keys($td.data('groups')) || [];
            Severity: Minor
            Found in settings/js/users/users.js - About 1 hr 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 update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                update: function (gid, limit) {
                    if (UserList.updating) {
                        return;
                    }
                    if(!limit) {
            Severity: Minor
            Found in settings/js/users/users.js - About 1 hr to fix

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

                  preSortSearchString: function(a, b) {
                      var pattern = this.filter;
                      if(typeof pattern === 'undefined') {
                          return undefined;
                      }
              Severity: Minor
              Found in settings/js/users/users.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

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

                  $('#CheckboxUserBackend').click(function() {
                      if ($('#CheckboxUserBackend').is(':checked')) {
                          $("#userlist .userBackend").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_backend', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1111..1119

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

              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

                  $('#CheckboxEmailAddress').click(function() {
                      if ($('#CheckboxEmailAddress').is(':checked')) {
                          $("#userlist .mailAddress").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_email', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1081..1089
              settings/js/users/users.js on lines 1111..1119

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

              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

                      $('#CheckboxCreationTime').click(function() {
                              if ($('#CheckboxCreationTime').is(':checked')) {
                                      $("#userlist .creationTime").show();
                                      OC.AppConfig.setValue('core', 'umgmt_show_creation_time', 'true');
                              } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1081..1089
              settings/js/users/users.js on lines 1111..1119

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

              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

                  $('#CheckboxQuota').click(function() {
                      if ($('#CheckboxQuota').is(':checked')) {
                          $("#userlist .quota").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_quota', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1081..1089

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

              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

                  $('#CheckboxIsEnabled').click(function () {
                      if ($('#CheckboxIsEnabled').is(':checked')) {
                          $("#userlist .enabled").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_is_enabled', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1081..1089
              settings/js/users/users.js on lines 1111..1119

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

              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

                  $('#CheckboxLastLogin').click(function() {
                      if ($('#CheckboxLastLogin').is(':checked')) {
                          $("#userlist .lastLogin").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_last_login', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1023..1031
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1081..1089
              settings/js/users/users.js on lines 1111..1119

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

              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

                  $('#CheckboxStorageLocation').click(function() {
                      if ($('#CheckboxStorageLocation').is(':checked')) {
                          $("#userlist .storageLocation").show();
                          OC.AppConfig.setValue('core', 'umgmt_show_storage_location', 'true');
                      } else {
              Severity: Major
              Found in settings/js/users/users.js and 6 other locations - About 3 hrs to fix
              settings/js/users/users.js on lines 1009..1017
              settings/js/users/users.js on lines 1037..1045
              settings/js/users/users.js on lines 1053..1061
              settings/js/users/users.js on lines 1067..1075
              settings/js/users/users.js on lines 1081..1089
              settings/js/users/users.js on lines 1111..1119

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

              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 (user.lastLogin === 0 && user.isGuest !== true) {
                          var resendImage = $('<img class="action">').attr({
                              src: OC.imagePath('core', 'actions/mail')
                          });
                          var resendLink = $('<a class="action resendInvitationEmail">')
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 3 hrs to fix
              settings/js/users/users.js on lines 131..141

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

              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 ($tr.find('td.remove img').length === 0 && OC.currentUser !== user.name) {
                          var deleteImage = $('<img class="action">').attr({
                              src: OC.imagePath('core', 'actions/delete')
                          });
                          var deleteLink = $('<a class="action delete">')
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 3 hrs to fix
              settings/js/users/users.js on lines 118..126

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

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

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

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

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

              Refactorings

              Further Reading

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

                      for(var i in groups) {
                          var gid = groups[i]['gid'];
                          var $li = GroupList.getGroupLI(gid);
                          var userCount = GroupList.getUserCount($li);
                          GroupList.setUserCount($li, userCount - 1);
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 320..325

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

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

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

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

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

              Refactorings

              Further Reading

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

                      for(var i in groups) {
                          var gid = groups[i]['gid'];
                          var $li = GroupList.getGroupLI(gid);
                          var userCount = GroupList.getUserCount($li);
                          GroupList.setUserCount($li, userCount + 1);
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 305..310

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

              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(user.creationTime !== 0) {
                                      creationTimeRel = OC.Util.relativeModifiedDate(user.creationTime);
                                      creationTimeAbs = OC.Util.formatDate(user.creationTime);
                              }
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 178..181

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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

                      if(user.lastLogin !== 0) {
                          lastLoginRel = OC.Util.relativeModifiedDate(user.lastLogin);
                          lastLoginAbs = OC.Util.formatDate(user.lastLogin);
                      }
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 193..196

              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

                      } else {
                          if ($.trim(email) === '') {
                              OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
                                  message: t('settings', 'A valid email must be provided')
                              }));
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 941..948

              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

                      if (setPassword === true) {
                          if ($.trim(password) === '') {
                              OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
                                  message: t('settings', 'A valid password must be provided')
                              }));
              Severity: Major
              Found in settings/js/users/users.js and 1 other location - About 1 hr to fix
              settings/js/users/users.js on lines 948..955

              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

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

                          if (!groupIsChecked && !groupIsAssignable) {
                              $groupsSelect.append($('<option value="' + escapeHTML(gid) + '" disabled="disabled">' + escapeHTML(group['name']) + '</option>'));
                              return;
                          }
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 40 mins to fix
              settings/js/users/users.js on lines 652..655

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

              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

                          if (groupIsChecked && !groupIsRemovable) {
                              $groupsSelect.append($('<option value="' + escapeHTML(gid) + '" disabled="disabled">' + escapeHTML(group['name']) + '</option>'));
                              return;
                          }
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 40 mins to fix
              settings/js/users/users.js on lines 648..651

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

              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

                      } else {
                          OC.AppConfig.setValue('core', 'umgmt_set_password', 'false');
                          $('#newemail').show();
                          $("#newuserpassword").hide();
                      }
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 40 mins to fix
              settings/js/users/users.js on lines 1096..1100

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

              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 ($('#CheckBoxPasswordOnUserCreate').is(':checked')) {
                          OC.AppConfig.setValue('core', 'umgmt_set_password', 'true');
                          $('#newemail').hide();
                          $('#newuserpassword').show();
                      } else {
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 40 mins to fix
              settings/js/users/users.js on lines 1100..1104

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

              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 (showPassword === true) {
                          $("#newuserpassword").show();
                          $("#newemail").hide();
                          $('#CheckBoxPasswordOnUserCreate').attr('checked', true);
                      } else {
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 35 mins to fix
              settings/js/users/users.js on lines 760..764

              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

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

                      } else {
                          $("#newemail").show();
                          $("#newuserpassword").hide();
                          $('#CheckBoxPasswordOnUserCreate').attr('checked', false);
                      }
              Severity: Minor
              Found in settings/js/users/users.js and 1 other location - About 35 mins to fix
              settings/js/users/users.js on lines 756..760

              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

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

                  getDisplayName: function(element) {
                      return ($(element).closest('tr').data('displayname') || '').toString();
                  },
              Severity: Minor
              Found in settings/js/users/users.js and 2 other locations - About 30 mins to fix
              settings/js/users/users.js on lines 337..339
              settings/js/users/users.js on lines 343..345

              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

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

                  getUID: function(element) {
                      return ($(element).closest('tr').data('uid') || '').toString();
                  },
              Severity: Minor
              Found in settings/js/users/users.js and 2 other locations - About 30 mins to fix
              settings/js/users/users.js on lines 340..342
              settings/js/users/users.js on lines 343..345

              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

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

                  getMailAddress: function(element) {
                      return ($(element).closest('tr').data('mailAddress') || '').toString();
                  },
              Severity: Minor
              Found in settings/js/users/users.js and 2 other locations - About 30 mins to fix
              settings/js/users/users.js on lines 337..339
              settings/js/users/users.js on lines 340..342

              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