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
Class CheckinsController
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class CheckinsController < ApplicationController
include Reportable
before_filter :require_user
# GET /checkins
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
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.
Consider simplifying this complex logical expression. Open
if (this.options.ajax) {
var ajax = this.options.ajax;
if (typeof ajax == "string") {
ajax = { url:ajax };
}
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
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
Function ajaxLookup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
ajaxLookup: function () {
var query = this.$element.val();
if (query == this.query) {
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,
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
- Read upRead up
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)
- Read upRead up
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 }
- Read upRead up
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"