maestrano/mno-enterprise

View on GitHub

Showing 152 of 305 total issues

Function link has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    link: function(scope, element, attrs, ctrls) {
      var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];

      if (!ngModelCtrl) {
         return; // do nothing if no ng-model

    Function link has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          link: function(scope, elem, attrs, ctrl) {
            // editable controller
            var eCtrl = ctrl[0];
    
            // form controller
    Severity: Major
    Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 2 hrs to fix

      Function positionElements has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            positionElements: function(hostEl, targetEl, positionStr, appendToBody) {
              var positionStrParts = positionStr.split('-');
              var pos0 = positionStrParts[0], pos1 = positionStrParts[1] || 'center';
      
              var hostElPos,

        Function setupInputEvents has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          this.setupInputEvents = function(hoursInputEl, minutesInputEl) {
            if ($scope.readonlyInput) {
              $scope.updateHours = angular.noop;
              $scope.updateMinutes = angular.noop;
              return;

          Method finalize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

            def finalize
              @confirmation_token = params[:user].delete(:confirmation_token)
              self.resource = resource_class.find_for_confirmation(@confirmation_token)
          
              # Exit action and redirect if user is already confirmed

          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

          Method handle_password_change has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

                def handle_password_change
                  return if warden.nil?
                  if not devise_controller? and not ignore_password_expire? and not request.format.nil? #and request.format.html?
                    Devise.mappings.keys.flatten.any? do |scope|
                      if signed_in?(scope) and warden.session(scope)['password_expired']
          Severity: Minor
          Found in core/lib/devise/controllers/extension_helpers.rb - 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

          Method apply_template! has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def apply_template!
            assert_compatible_rails_version
            assert_valid_options
          
            @mnoe_version = ask("Choose mno-enterprise version:", limited_to: available_mnoe_versions).to_sym
          Severity: Major
          Found in rails-template/mnoe-app-template.rb - About 2 hrs to fix

            Function show has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Tooltip.prototype.show = function () {
                var e = $.Event('show.bs.' + this.type)
            
                if (this.hasContent() && this.enabled) {
                  this.$element.trigger(e)

              Method impac_abilities has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def impac_abilities(orgs_with_acl)
                  can :create_impac_dashboards, MnoEnterprise::Impac::Dashboard do |d|
                    orgs = d.organizations(orgs_with_acl)
                    orgs.present? && orgs.all? do |org|
                      org.acl[:related] && org.acl[:related][:dashboards] && org.acl[:related][:dashboards][:create]
              Severity: Major
              Found in core/lib/mno_enterprise/concerns/models/ability.rb - About 2 hrs to fix

                Method attributes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                        def attributes(*attributes)
                          define_attribute_methods attributes
                
                          attributes.each do |attribute|
                            attribute = attribute.to_sym
                Severity: Minor
                Found in core/lib/her_extension/model/attributes.rb - 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 TabsetCtrl has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                .controller('TabsetController', ['$scope', function TabsetCtrl($scope) {
                  var ctrl = this,
                      tabs = ctrl.tabs = $scope.tabs = [];
                
                  ctrl.select = function(selectedTab) {

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

                  function promiseCollection() {
                    return {
                      promises: [],
                      hasFalse: false,
                      hasString: false,
                Severity: Major
                Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 2 hrs to fix

                  Function link has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        link: function(scope, element, attrs) {
                          element.addClass(attrs.windowClass || '');
                          scope.size = attrs.size;
                  
                          scope.close = function(evt) {

                    Function link has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        link: function(scope, elem, attrs) {
                          var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope);
                    
                          var changeCounter = 0,
                            currentScope,

                      Method show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def show
                          @confirmation_token = params[:confirmation_token]
                          self.resource = resource_class.find_for_confirmation(@confirmation_token)
                      
                          # Exit if no resources

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

                                post: function(scope, elem, attrs, ctrl) {
                                  var eForm;
                      
                                  if(attrs.editableForm && scope[attrs.editableForm] && scope[attrs.editableForm].$show) {
                                    eForm = scope[attrs.editableForm];
                      Severity: Minor
                      Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

                        Function init has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            self.init = function(single) {
                              self.single = single;
                        
                              self.name = $attrs.eName || $attrs[self.directiveName];
                              /*
                        Severity: Minor
                        Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

                          Function slide has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            Carousel.prototype.slide = function (type, next) {
                              var $active   = this.$element.find('.item.active')
                              var $next     = next || this.getItemForDirection(type, $active)
                              var isCycling = this.interval
                              var direction = type == 'next' ? 'left' : 'right'

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

                                self.render = function() {
                                  var theme = self.theme;
                            
                                  //build input
                                  self.inputEl = angular.element(self.inputTpl);
                            Severity: Minor
                            Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

                              Method setup_apps has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def setup_apps(user = nil, app_nids = [], opts = {})
                                    return [] unless user
                                    return [] unless (user.organizations.reload.count == 1)
                                    return [] unless (org = user.organizations.first)
                                    return [] unless MnoEnterprise::Ability.new(user).can?(:edit,org)

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language