Showing 91 of 175 total issues
File bootstrap-datetimepicker.js
has 1543 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* =========================================================
* bootstrap-datetimepicker.js
* =========================================================
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
File sched.rb
has 730 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rubygems'
require 'prawn'
require 'json'
require 'pp'
Method render_pdf
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
def render_pdf(options, filename, cache_filename = nil, user = nil)
@options = options
@options = {} if @options.nil?
@options.reverse_merge!({
user: 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 generate_differences
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def generate_differences(a = original, b = committed)
return [a.class.name, nil] if !a.nil? && b.nil?
return [nil, b.class.name] if !b.nil? && a.nil?
differences = {}
- 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 click
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
click: function (e) {
e.stopPropagation();
e.preventDefault();
var target = $(e.target).closest('span, td, th, legend');
if (target.length == 1) {
Function fill
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
fill: function () {
if (this.date == null || this.viewDate == null) {
return;
}
var d = new Date(this.viewDate),
Method show
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def show
# TODO: need to handle format here, and return an empty schedule for ICS requests
# where the user does exist, 404 where it does not, and redirect for html requests.
raise ActiveRecord::RecordNotFound.new('Not Found') unless @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 render_pdf
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_pdf(options, filename, cache_filename = nil, user = nil)
@options = options
@options = {} if @options.nil?
@options.reverse_merge!({
user: nil,
Function Datetimepicker
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Datetimepicker = function (element, options) {
var that = this;
this.element = $(element);
Method check_for_proofread_changes
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def check_for_proofread_changes
return true if @is_proofreader and @is_proofreader == :no_really
needs_clearing = false
changes.keys.each do |field_name|
- 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 instructable.rb
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Instructable < ApplicationRecord
belongs_to :user
has_many :instances, -> { order('start_time, location') }, dependent: :destroy
has_many :changelogs, as: :target
accepts_nested_attributes_for :instances, allow_destroy: true
Function parseDate
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseDate: function (date, format, language, type) {
if (date instanceof Date) {
var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000);
dateUTC.setMilliseconds(0);
return dateUTC;
Function keydown
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
keydown: function (e) {
if (this.picker.is(':not(:visible)')) {
if (e.keyCode == 27) // allow escape to hide and re-show picker
this.show();
return;
File calendar_renderer.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'csv'
class CalendarRenderer
include GriffinPdf
include GriffinMarkdown
Method render_topic_list
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def render_topic_list(pdf, instructables)
previous_topic = ''
instructables.sort { |a, b|
[a.formatted_topic, a.name.gsub('*', '')] <=> [b.formatted_topic, b.name.gsub('*', '')]
- 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 index
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def index
render_options = {}
respond_to do |format|
uncached = params[:uncached_for_tests].present?
- 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 render
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render(pdf, opts)
debug = false
if debug
pdf.stroke_axis
Method render_ics
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def render_ics(options, filename, cache_filename = nil)
@options = options
@options = {} if options.nil?
@options.reverse_merge!({
calendar_name: "Pennsic #{Pennsic.year} Master Schedule",
- 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 Instructable
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Instructable < ApplicationRecord
belongs_to :user
has_many :instances, -> { order('start_time, location') }, dependent: :destroy
has_many :changelogs, as: :target
accepts_nested_attributes_for :instances, allow_destroy: true
File changelog.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Changelog < ApplicationRecord
belongs_to :user
belongs_to :target, polymorphic: true
default_scope { where(year: 2032) }