brianwisti/marysplace-rails

View on GitHub

Showing 12 of 12 total issues

Class ClientsController has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class ClientsController < ApplicationController
  before_filter :require_user
  authorize_resource
  helper_method :sort_column, :sort_direction

Severity: Minor
Found in app/controllers/clients_controller.rb - About 4 hrs to fix

    Class CheckinsController has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class CheckinsController < ApplicationController
      include Reportable
      before_filter :require_user
    
      # GET /checkins
    Severity: Minor
    Found in app/controllers/checkins_controller.rb - About 3 hrs to fix

      Class PointsEntryTypesController has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class PointsEntryTypesController < ApplicationController
        before_filter :require_user
      
        # GET /points_entry_types
        # GET /points_entry_types.json
      Severity: Minor
      Found in app/controllers/points_entry_types_controller.rb - About 2 hrs to fix

        File typeahead.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* =============================================================
         * bootstrap-typeahead.js v2.0.3
         * http://twitter.github.com/bootstrap/javascript.html#typeahead
         * =============================================================
         * Copyright 2012 Twitter, Inc.
        Severity: Minor
        Found in app/assets/javascripts/typeahead.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                  if (this.options.ajax) {
                      var ajax = this.options.ajax;
                      if (typeof ajax == "string") {
                          ajax = { url:ajax };
                      }
          Severity: Critical
          Found in app/assets/javascripts/typeahead.js - About 1 hr to fix

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

              def initialize(user)
                user ||= User.new
            
                if user.role? :front_desk
                  can :create, Checkin
            Severity: Minor
            Found in app/models/ability.rb - About 1 hr to fix

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

                  var Typeahead = function (element, options) {
                      this.$element = $(element)
                      this.options = $.extend({}, $.fn.typeahead.defaults, options)
                      this.matcher = this.options.matcher || this.matcher
                      this.sorter = this.options.sorter || this.sorter
              Severity: Minor
              Found in app/assets/javascripts/typeahead.js - About 1 hr to fix

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

                        ajaxLookup: function () {
                    
                            var query = this.$element.val();
                            
                            if (query == this.query) {
                Severity: Minor
                Found in app/assets/javascripts/typeahead.js - About 1 hr to fix

                  Method client_params has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def client_params
                      client_params = params[:client]
                  
                      if client_params
                        client_params.permit(:current_alias,
                  Severity: Minor
                  Found in app/controllers/clients_controller.rb - About 1 hr to fix

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

                      def build_points_entry
                        @points_entry            ||= PointsEntry.new
                        @points_entry.attributes   = points_entry_params
                        @points_entry.added_by   ||= current_user
                    
                    
                    Severity: Minor
                    Found in app/controllers/points_entries_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

                    Method no_checkin_for_client_on_same_day has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def no_checkin_for_client_on_same_day
                        return unless checkin_at
                    
                        time = Time.new(checkin_at.year, checkin_at.month, checkin_at.day, 0, 0)
                    
                    
                    Severity: Minor
                    Found in app/models/checkin.rb - About 25 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

                    Method sortable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def sortable(column, title = nil)
                        title ||= column.titleize
                        css_class = column == sort_column ? "current #{sort_direction}" : nil
                        direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
                        link_to title, { sort: column, direction: direction }, { class: css_class }
                    Severity: Minor
                    Found in app/helpers/application_helper.rb - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language