Showing 29 of 55 total issues
Method up
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table :esa_charts do |t|
t.string :name
t.timestamps
- Create a ticketCreate a ticket
Method up
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table :esa_charts do |t|
t.string :name
t.timestamps
- Create a ticketCreate a ticket
Class Context
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Context < ActiveRecord::Base
attr_accessible :chart, :chart_id, :parent, :parent_id, :type, :name, :namespace, :position
attr_accessible :chart, :chart_id, :parent, :parent_id, :type, :name, :namespace, :position, :start_date, :end_date, :as => :admin
attr_readonly :chart, :parent
- Create a ticketCreate a ticket
Function generateTOC
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateTOC() {
if ($('#filecontents').length === 0) return;
var _toc = $('<ol class="top"></ol>');
var show = false;
var toc = _toc;
- Create a ticketCreate a ticket
Function searchItem
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function searchItem() {
for (var i = 0; i < searchCache.length / 50; i++) {
var item = searchCache[searchIndex];
var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
var matchString = regexSearchString;
- Read upRead up
- Create a ticketCreate a ticket
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 Ruleset
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Ruleset < ActiveRecord::Base
include ESA::Traits::Extendable
attr_accessible :name, :type, :chart
attr_readonly :name, :type, :chart
- Create a ticketCreate a ticket
Method lookup_extension
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.lookup_extension(name)
if self.esa_extensions.present?
matches = self.esa_extensions.map do |expr,extension|
if expr.is_a? Regexp and expr.match(name).present?
extension
- Read upRead up
- Create a ticketCreate a ticket
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 fullListSearch
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fullListSearch() {
// generate cache
searchCache = [];
$('#full_list li').each(function() {
var link = $(this).find('.object_link a');
- Create a ticketCreate a ticket
Method initialize
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@base_classes = [ESA::Ruleset, ESA::Event, ESA::Flag, ESA::Transaction].freeze
@extension_namespace = "Accounting"
- Create a ticketCreate a ticket
Method initialize_defaults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize_defaults
if not self.event_id.nil?
self.time ||= self.event.time if self.time.nil?
self.accountable ||= self.event.accountable if self.accountable_id.nil?
self.ruleset ||= self.event.ruleset if self.ruleset_id.nil?
- Read upRead up
- Create a ticketCreate a ticket
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 stateful_events
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stateful_events(accountable)
self.event_times(accountable).map do |nature,times|
if times.present? and times.is_a? Time
{nature: nature, time: times}
elsif times.present? and times.respond_to? :each
- Read upRead up
- Create a ticketCreate a ticket
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 summaryToggle
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function summaryToggle() {
$('.summary_toggle').click(function() {
if (localStorage) {
localStorage.summaryCollapsed = $(this).text();
}
- Create a ticketCreate a ticket
Method extension_name
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.extension_name(accountable)
if accountable.is_a? Class
if accountable.respond_to? :accountable_name
lookup_extension(accountable.accountable_name)
else
- Read upRead up
- Create a ticketCreate a ticket
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 check_freshness
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_freshness(depth=0, options = {})
if self.is_update_needed? or not has_subcontext_namespaces?(options[:namespace])
self.update!(options)
else
self.update_freshness_timestamp!
- Read upRead up
- Create a ticketCreate a ticket
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 accounts_of_the_same_chart?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def accounts_of_the_same_chart?
if self.new_record?
chart_ids = self.amounts.map{|a| if a.account.present? then a.account.chart_id else nil end}
else
chart_ids = self.accounts.pluck(:chart_id)
- Read upRead up
- Create a ticketCreate a ticket
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 create_and_process_events
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_and_process_events(accountable)
events_created = create_events(accountable)
if events_created
unprocessed_events(accountable).each do |event|
- Read upRead up
- Create a ticketCreate a ticket
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 default_namespace
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def default_namespace
if self.start_date.present? and self.end_date.present?
if self.start_date == self.end_date
"date"
elsif self.start_date == self.start_date.beginning_of_month and
- Read upRead up
- Create a ticketCreate a ticket
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 process_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.process_event(event)
flags_created = create_flags(event)
if flags_created
unprocessed_flags(event).map do |flag|
- Read upRead up
- Create a ticketCreate a ticket
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 default_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def default_name
if self.start_date.present? and self.end_date.present?
if self.start_date == self.end_date
"#{self.start_date.to_s}"
else
- Read upRead up
- Create a ticketCreate a ticket
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 maybe
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def maybe(attrs)
events = proxy_association.owner.esa_events
last_event = events.order('time DESC, created_at DESC').first
# make sure that the previous event was not of the same event type
- Read upRead up
- Create a ticketCreate a ticket
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"