maestrano/mno-enterprise

View on GitHub

Showing 152 of 305 total issues

Function parse has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  this.parse = function(input, format, baseDate) {
    if (!angular.isString(input) || !format) {
      return input;
    }

    Function createNew has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          createNew: function() {
            var stack = [];
    
            return {
              add: function(key, value) {

      Function open has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            $modalStack.open = function(modalInstance, modal) {
              var modalOpener = $document[0].activeElement,
                modalBodyClass = modal.openedClass || OPENED_MODAL_CLASS;
      
              openedWindows.add(modalInstance, {

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

            link: function(scope, element, attrs, ctrl) {
              var range = ctrl.yearRange;
        
              ctrl.step = { years: range };
              ctrl.element = element;

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

              def initialize(invoice)
                raise ArgumentError, "Received #{invoice.class} object (expected instance of Invoice)" unless invoice.is_a?(MnoEnterprise::Invoice)
                @invoice = invoice
                @pdf = nil
                @data = {}
          Severity: Minor
          Found in core/app/pdf/mno_enterprise/invoice_pdf.rb - About 1 hr to fix

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

            module.exports = function(config) {
            
              var configuration = {
                files: listFiles(),
            
            
            Severity: Minor
            Found in frontend-admin/karma.conf.js - About 1 hr to fix

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

                  link: function(scope, element, attrs, ctrl) {
                    ctrl.step = { years: 1 };
                    ctrl.element = element;
              
                    ctrl._refreshView = function() {

                Method find_for_oauth has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.find_for_oauth(auth, opts = {}, signed_in_resource = nil)
                      # Get the identity and user if they exist
                      identity = Identity.find_for_oauth(auth)
                
                      # If a signed_in_resource is provided it always overrides the existing user
                Severity: Minor
                Found in core/app/models/mno_enterprise/user.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 link has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      link: function(scope, element, attrs) {
                        function expand() {
                          element.removeClass('collapse')
                            .addClass('collapsing')
                            .attr('aria-expanded', true)

                  Function createNew has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        createNew: function() {
                          var map = {};
                  
                          return {
                            entries: function() {

                    Function resolveSuccess has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                  .then(function resolveSuccess(tplAndVars) {
                    
                                    var modalScope = (modalOptions.scope || $rootScope).$new();
                                    modalScope.$close = modalInstance.close;
                                    modalScope.$dismiss = modalInstance.dismiss;

                      Function activate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        Tab.prototype.activate = function (element, container, callback) {
                          var $active    = container.find('> .active')
                          var transition = callback
                            && $.support.transition
                            && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)

                        Function TabsetCtrl has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Function getMatchesAsync has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  var getMatchesAsync = function(inputValue) {
                                    var locals = {$viewValue: inputValue};
                                    isLoadingSetter(originalScope, true);
                                    isNoResultsSetter(originalScope, false);
                                    $q.when(parserResult.source(originalScope, locals)).then(function(matches) {

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

                              Modal.prototype.show = function (_relatedTarget) {
                                var that = this
                                var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
                            
                                this.$element.trigger(e)

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

                                Collapse.prototype.show = function () {
                                  if (this.transitioning || this.$element.hasClass('in')) return
                              
                                  var activesData
                                  var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')

                                Method create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def create
                                    if params[:kpi][:widget_id].present?
                                      return render_not_found('widget') if widget.blank?
                                    else
                                      return render_not_found('dashboard') if dashboard.blank?

                                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 new has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def new
                                    @apps = params[:apps]
                                    @organizations = current_user.organizations.to_a
                                    @organization = @organizations.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }
                                
                                
                                Severity: Minor
                                Found in api/lib/mno_enterprise/concerns/controllers/provision_controller.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 _refreshView has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      ctrl._refreshView = function() {
                                        var year = ctrl.activeDate.getFullYear(),
                                          month = ctrl.activeDate.getMonth(),
                                          firstDayOfMonth = new Date(year, month, 1),
                                          difference = ctrl.startingDay - firstDayOfMonth.getDay(),

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

                                    Modal.prototype.backdrop = function (callback) {
                                      var that = this
                                      var animate = this.$element.hasClass('fade') ? 'fade' : ''
                                  
                                      if (this.isShown && this.options.backdrop) {
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language