maestrano/mno-enterprise

View on GitHub

Showing 152 of 305 total issues

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

      def process_response_errors
        if self.response_errors && self.response_errors.any?
          self.response_errors.each do |error|
            key = error[:attribute] && !error[:attribute].empty? ? error[:attribute] : :base
            val = error[:value] && !error[:value].empty? ? error[:value] : error[:title]
Severity: Minor
Found in core/app/models/mno_enterprise/base_resource.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

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

    def index
      if params[:terms]
        # Search mode
        @users = []
        JSON.parse(params[:terms]).map { |t| @users = @users | MnoEnterprise::User.where(Hash[*t]).fetch }
Severity: Minor
Found in api/app/controllers/mno_enterprise/jpi/v1/admin/users_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

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

  def index
    if params[:terms]
      # Search mode
      @organizations = []
      JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]).fetch }

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

  def update_member
    attributes = params[:member]

    # Authorize and update => Admin or Super Admin
    authorize! :invite_member, organization

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

  def description
    # Return cached value if one
    return @description if @description

    # Parse the html document to try to find
Severity: Minor
Found in core/lib/html_processor.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

Method intuit has a Cognitive Complexity of 10 (exceeds 5 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']

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

    def after_confirmation_path_for(resource_name, resource, opts = {})
      return new_user_session_path unless resource

      # 3 days is the duration of an invite.
      if resource.created_at > 3.days.ago

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

      postrender: function() {
        //apply `form-control` class to std inputs
        switch(this.directiveName) {
          case 'editableText':
          case 'editableSelect':
Severity: Minor
Found in frontend/app/assets/javascripts/mno_enterprise/lib/xeditable.js - About 1 hr to fix

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

        link: function(scope, elm, attrs, tabsetCtrl, transclude) {
          scope.$watch('active', function(active) {
            if (active) {
              tabsetCtrl.select(scope);
            }

      Function goNext has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function goNext(slide, index, direction) {
          // Scope has been destroyed, stop here.
          if (destroyed) { return; }
      
          angular.extend(slide, {direction: direction, active: true});

        Function hide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Collapse.prototype.hide = function () {
            if (this.transitioning || !this.$element.hasClass('in')) return
        
            var startEvent = $.Event('hide.bs.collapse')
            this.$element.trigger(startEvent)

          Function refresh has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            ScrollSpy.prototype.refresh = function () {
              var offsetMethod = 'offset'
              var offsetBase   = 0
          
              if (!$.isWindow(this.$scrollElement[0])) {

            Function start has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        callbacks.start = function(e, ui) {
                          if (opts['ui-floating'] === 'auto') {
                            // since the drag has started, the element will be
                            // absolutely positioned, so we check its siblings
                            var siblings = ui.item.siblings();
            Severity: Minor
            Found in frontend/app/assets/javascripts/mno_enterprise/lib/sortable.js - About 1 hr to fix

              Function next has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function next() {
                    $active
                      .removeClass('active')
                      .find('> .dropdown-menu > .active')
                        .removeClass('active')

                Function $get has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  this.$get = ['$window', '$compile', '$timeout', '$document', '$position', '$interpolate', '$rootScope', '$parse', function($window, $compile, $timeout, $document, $position, $interpolate, $rootScope, $parse) {

                  Method update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      render_not_found('kpi') unless kpi.present?
                      authorize! :update_impac_kpis, kpi
                  
                      params = kpi_update_params

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

                    def show
                      @current_user = current_user
                      @org_invite = MnoEnterprise::OrgInvite.active.where(id: params[:id], token: params[:token]).first
                      redirect_path = mnoe_home_path
                  
                  
                  Severity: Minor
                  Found in api/lib/mno_enterprise/concerns/controllers/org_invites_controller.rb - About 55 mins to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function $get has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          function ($injector, $rootScope, $q, $templateRequest, $controller, $modalStack) {

                    Method info has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def info(key, current_user_id, description, subject_type, subject_id, metadata)
                    Severity: Minor
                    Found in api/lib/mno_enterprise/audit_events_listener.rb - About 45 mins to fix

                      Method send_info has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def self.send_info(key, current_user_id, description, subject_type, subject_id, metadata)
                      Severity: Minor
                      Found in api/lib/mno_enterprise/event_logger.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language