Showing 42 of 7,746 total issues
Function prototype
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
Searcher.prototype = new function() {
// search is performed in chunks of 1000 for non-blocking user input
var CHUNK_SIZE = 1000;
// do not try to find more than 100 results
var MAX_RESULTS = 100;
- 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
File schema.rb
has 566 lines of code (exceeds 250 allowed). Consider refactoring. Open
ActiveRecord::Schema.define(version: 2019_10_31_013911) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Function prototype
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
Searcher.prototype = new function() {
// search is performed in chunks of 1000 for non-blocking user input
var CHUNK_SIZE = 1000;
// do not try to find more than 100 results
var MAX_RESULTS = 100;
Class Person
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Person < ApplicationRecord
has_paper_trail
include Commentable
include Loggable
Function prototype
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Search.prototype = $.extend({}, Navigation, new function() {
var suid = 1;
this.init = function() {
var _this = this;
- 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
File person_spec.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.describe Person do
describe 'validations' do
subject { build :person }
Method change
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def change
add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type
add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id
- 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
Class Event
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ApplicationRecord
has_paper_trail
include Loggable
before_save :calc_duration, :trim_id_code
Function prototype
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Search.prototype = $.extend({}, Navigation, new function() {
var suid = 1;
this.init = function() {
var _this = this;
File availability_spec.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
RSpec.describe Availability, type: :model do
let(:a_person) { build(:person) }
Method initialize
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(current_user)
current_user ||= User.new
roles = current_user.roles.map {|x| x.to_s}
if roles.blank?
cannot :manage, :all
Method respond
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def respond
case event_codename
when "custom"
# available custom 1/15/2017 0800 01/15/2021 Work
unless start_time.is_a? Time and end_time.is_a? Time
- 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 respond
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def respond
response = ""
@person.upcoming_events.each do |event|
if event.people.include?(@person)
response += "🔷 "
- 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
Function performSearch
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function performSearch(data, regexps, queries, highlighters, state) {
var searchIndex = data.searchIndex;
var longSearchIndex = data.longSearchIndex;
var info = data.info;
var result = [];
Method service_duration
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def service_duration
if self.start_date.present?
if self.end_date.present?
self.end_date.year - self.start_date.year + ( self.start_date.yday < self.end_date.yday ? 1 : 0 )
else
- 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 change
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def change
create_table :people do |t|
t.string "firstname"
t.string "lastname"
t.string "status"
Method respond
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def respond
case event_codename
when "custom"
# unavailable custom 1/15/2017 0800 01/15/2021 Work
unless start_time.is_a? Time and end_time.is_a? Time
- 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 get_nested_editor_views
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_nested_editor_views(outer_model_name, nested_model_name, things_to_look_for)
outer_model = outer_model_name.to_sym
nested_model = nested_model_name.to_sym
nested_model_controller = nested_model_name.pluralize.to_sym
Function onkeydown
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.onkeydown = function(e) {
if (!this.navigationActive) return;
switch(e.keyCode) {
case 37: //Event.KEY_LEFT:
if (this.moveLeft()) e.preventDefault();
Method respond
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond
case event_codename
when "custom"
# available custom 1/15/2017 0800 01/15/2021 Work
unless start_time.is_a? Time and end_time.is_a? Time