Showing 39 of 49 total issues
Method index
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def index
restaurant = params[:restaurant] || "Mensa"
@restaurant = Restaurant.where(name: restaurant).first
@restaurants = Restaurant.all(sort: [[ :name, :desc ]])
- 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 call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
if env['REQUEST_METHOD'] == 'GET'
request = Rack::Request.new(env)
encoding = Rack::Utils.select_best_encoding(
%w(gzip identity), request.accept_encoding)
- 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 spin
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
spin: function(target) {
this.stop();
var self = this;
var o = self.opts;
var el = self.el = css(createEl(0, {className: o.className}), {position: 'relative', zIndex: o.zIndex});
Function autogrow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.autogrow = function(options) {
this.filter('textarea').each(function() {
var $this = $(this),
Function getJSON
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getJSON(url, data, fn) {
if (jQuery.isFunction(data)) {
fn = data;
data = null;
}
Method index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
restaurant = params[:restaurant] || "Mensa"
@restaurant = Restaurant.where(name: restaurant).first
@restaurants = Restaurant.all(sort: [[ :name, :desc ]])
Function lines
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spinner.prototype.lines = function(el, o) {
var r = o.length+o.width;
var s = 2*r;
function grp() {
Function watch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
var watch = function() {
// listener was stopped or we've run out of pages
if (settings.totalPages <= settings.currentPage) {
stopListener();
// if there is a afterStopListener callback we call it
Function Datepicker
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Datepicker = function(element, options){
this.element = $(element);
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
this.picker = $(DPGlobal.template)
.appendTo('body')
Function lines
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
lines: function(el, o) {
var i = 0;
var seg;
function fill(color, shadow) {
Method update_database
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.update_database
Restaurant.all.each do |restaurant|
restaurant.menus.where(:date.lt => Date.today.to_time.midnight.utc).destroy_all
end
self.get_menu_data(ENV["STWPB_CSV_URL"]).each do |restaurant, menus|
- 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 export
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def export
events = current_user.events.where(start_time: Time.now..(Time.now + 6.months))
respond_to do |format|
format.ics do
@cal = RiCal.Calendar do |cal|
- 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
Consider simplifying this complex logical expression. Open
if ( !overrideChecks && (!isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor) ) return;
Method recurring_end_greater_than_start_time
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def recurring_end_greater_than_start_time
if recurring
if recurring_end
errors.add(:recurring_end, "can't be set before start time") if recurring_end < start_time.to_date
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 parsed_side_dishes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parsed_side_dishes(locale = nil)
result = {}
if self[:side_dishes].respond_to?(:each)
self[:side_dishes].each do |key, val|
result[key] = JSON.parse(val) if val
- 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 update_next_class_information!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_next_class_information!
min_interval = 100.days
self.course_data.each do |data|
date = data["date"]
time_from_key = "time_from"
- 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 extract_youtube_videos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_youtube_videos (html_string)
urls = URI.extract html_string
urls_converted = urls.uniq.map do |url|
if url.blank?
nil
- 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 _name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _name
if self.course and !self.custom
return self.course.title if self.course.course_type === "course"
return self.course.group_title if self.course.course_type === "group"
end
- 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 update_recurring
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_recurring # untested. might be an infinite loop. TODO
if self.recurring or self.parent_event
(self.recurring ? self : self.parent_event).children_events.each do |e|
e.update_attributes(name: self.name, start_time: self.start_time, end_time: self.end_time, location: self.location)
end
- 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"