maestrano/mno-enterprise

View on GitHub

Showing 152 of 305 total issues

Function then has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      then: function(callbacks) {
        callbacks = callbacks || {};
        var onTrue = callbacks.onTrue || angular.noop;
        var onFalse = callbacks.onFalse || angular.noop;
        var onString = callbacks.onString || angular.noop;
Severity: Minor
Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

    Method api_stub_configure has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def api_stub_configure(api)
          # This block should match the her.rb initializer
          api.setup MnoEnterprise.send(:api_options).merge(url: "http://localhost:65000") do |c|
            # Request
            c.use Faraday::Request::BasicAuthentication, MnoEnterprise.tenant_id, MnoEnterprise.tenant_key

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

          link: function(scope, element, attrs, ctrls) {
            var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1];
      
            element.find('input').css({display: 'none'});
      
      

        Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize(user, session)
            user ||= MnoEnterprise::User.new
        
            #===================================================
            # Organization
        Severity: Minor
        Found in core/lib/mno_enterprise/concerns/models/ability.rb - About 1 hr to fix

          Function removeAfterAnimate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function removeAfterAnimate(domEl, scope, done) {
                  var asyncDeferred;
                  var asyncPromise = null;
                  var setIsAsync = function() {
                    if (!asyncDeferred) {

            Method fetch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def fetch
                      foreign_key_value = @parent.attributes[@opts[:foreign_key].to_sym]
                      data_key_value = @parent.attributes[@opts[:data_key].to_sym]
                      return @opts[:default].try(:dup) if (@parent.attributes.include?(@name) && @parent.attributes[@name].nil? && @params.empty?) || (foreign_key_value.blank? && data_key_value.blank?)
            
            
            Severity: Minor
            Found in core/lib/her_extension/model/associations/belongs_to_association.rb - 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 $transition has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var $transition = function(element, trigger, options) {
                options = options || {};
                var deferred = $q.defer();
                var endEventName = $transition[options.animation ? 'animationEndEventName' : 'transitionEndEventName'];
            
            

              Function parser has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function parser(optionsExp) {
                  var match;
              
                  if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) {
                    throw 'ng-options parse error';
              Severity: Minor
              Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

                Function getPages has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function getPages(currentPage, totalPages) {
                        var pages = [];
                
                        // Default page limits
                        var startPage = 1, endPage = totalPages;

                  Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Tooltip.prototype.applyPlacement = function (offset, placement) {
                      var $tip   = this.tip()
                      var width  = $tip[0].offsetWidth
                      var height = $tip[0].offsetHeight
                  
                  

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

                      Tab.prototype.show = function () {
                        var $this    = this.element
                        var $ul      = $this.closest('ul:not(.dropdown-menu)')
                        var selector = $this.data('target')
                    
                    

                      Method info has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def info(key, current_user_id, description, subject_type, subject_id, metadata)
                            u = User.find(current_user_id)
                            data = {created_at: Time.now.to_i, email: u.email, user_id: u.id, event_name: key.tr('_', '-')}
                            case key
                              when 'user_update', 'organization_update'
                      Severity: Minor
                      Found in api/lib/mno_enterprise/intercom_events_listener.rb - About 1 hr to fix

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

                                    function createTooltip() {
                                      // There can only be one tooltip element per directive shown at once.
                                      if (tooltip) {
                                        removeTooltip();
                                      }

                          Function EditableController has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            function EditableController($scope, $attrs, $element, $parse, editableThemes, editableOptions, $rootScope, $compile, $q) {
                          Severity: Major
                          Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

                            Function browserSyncInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function browserSyncInit(baseDir, browser) {
                              browser = browser === undefined ? 'default' : browser;
                            
                              var routes = null;
                              if(baseDir === conf.paths.src || (util.isArray(baseDir) && baseDir.indexOf(conf.paths.src) !== -1)) {
                            Severity: Minor
                            Found in frontend-admin/gulp/server.js - About 1 hr to fix

                              Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def create
                                  #  Filling the time at which TOS were accepted
                                  if params[:tos]
                                    params[:user][:meta_data] = {tos_accepted_at: Time.current}
                                  end

                                Function checkPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  Affix.prototype.checkPosition = function () {
                                    if (!this.$element.is(':visible')) return
                                
                                    var height       = this.$element.height()
                                    var offset       = this.options.offset

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

                                      link: function (scope, element, attrs, dropdownCtrl) {
                                  
                                        element.bind('keydown', function(e) {
                                          if ([38, 40].indexOf(e.which) !== -1) {
                                            e.preventDefault();

                                    Method intuit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def intuit
                                        auth = request.env['omniauth.auth']
                                        opts = {
                                          orga_on_create: create_orga_on_user_creation(auth.info.email),
                                          authorized_link_to_email: session['omniauth.intuit.authorized_link_to_email']

                                      Method index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def index
                                            if params[:terms]
                                              # For search mode
                                              @dashboard_templates = []
                                              JSON.parse(params[:terms]).map { |t| @dashboard_templates = @dashboard_templates | dashboard_templates.where(Hash[*t]) }

                                      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