Showing 34 of 54 total issues
Method footer
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def footer(sender, bank_account, vat_number, uid_number, vesr_included)
height = vesr_included ? 310 : 20
height -= 20 unless bank_account and bank_account.bank
title_width = 45
sender_vcard = sender.vcard
- 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 scrollintoview
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollintoview: function (options) {
/// <summary>Scrolls the first element in the set into view by scrolling its closest scrollable parent.</summary>
/// <param name="options" type="Object">Additional options that can configure scrolling:
/// duration (default: "fast") - jQuery animation speed (can be a duration string or number of milliseconds)
/// direction (default: "both") - select possible scrollings ("vertical" or "y", "horizontal" or "x", "both")
Method create
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def create
@booking = Booking.new(params[:booking])
if current_tenant.vat_obligation?
@vat_full_booking = Booking.new(params[:vat_full_booking])
- 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 Invoice
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Invoice < ActiveRecord::Base
# Aspects
include ApplicationHelper
# Scopes
Method footer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def footer(sender, bank_account, vat_number, uid_number, vesr_included)
height = vesr_included ? 310 : 20
height -= 20 unless bank_account and bank_account.bank
title_width = 45
sender_vcard = sender.vcard
Method new_vat
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_vat
@booking = Booking.new(params[:booking])
increment_booking_code
# Guard to ensure all needed fields are filled in
Method new
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
# Allow pre-seeding some parameters
text = t('letters.debit_invoice.closing')
text += "\n\n" + t('letters.debit_invoice.greetings')
text += "\n" + current_user.person.vcard.full_name
Function formatColumn
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
lib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {
if (!list) return [];
// Build options object from second param (if object) or all params, extending defaults:
var opts = defaults(
Function initializeBehaviours
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeBehaviours() {
// Init settings
initAccounting();
// from cyt.js
Function scrollable
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
scrollable: function (element, index, meta, stack) {
var direction = converter[typeof (meta[3]) === "string" && meta[3].toLowerCase()] || converter.both;
var styles = (document.defaultView && document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(element, null) : element.currentStyle);
var overflow = {
x: scrollValue[styles.overflowX.toLowerCase()] || false,
Method price
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def price
# If a price is set, use it
return self[:price] unless self[:price].blank?
# If a reference_code is given...
- 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 updateLineItemPrice
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function updateLineItemPrice(lineItem) {
var list = lineItem.parent();
var reference_code = lineItem.find(":input[name$='[reference_code]']").val();
var quantity = lineItem.find(":input[name$='[quantity]']").val();
var after_saldo_line_item = lineItem.prev().hasClass('saldo_line_item');
- 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 overdue?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def overdue?
return true if state == 'booked' and due_date < Date.today
return true if state == 'reminded' and (reminder_due_date.nil? or reminder_due_date < Date.today)
return true if state == '2xreminded' and (second_reminder_due_date.nil? or second_reminder_due_date < Date.today)
return true if state == '3xreminded' and (third_reminder_due_date.nil? or third_reminder_due_date < Date.today)
- 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 to_csv
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_csv(options={})
self.class.csv_columns(options).map { |curr_col|
curr_col = curr_col.to_s
#Its a chain of method calls, on intermediary nil, just return 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 xbooking_parameters
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xbooking_parameters(params = {})
# Prepare parameters set by template
booking_params = attributes.reject!{|key, value| !["title", "comments", "credit_account_id", "debit_account_id"].include?(key)}
# Calculate amount
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@booking = Booking.new(params[:booking])
if current_tenant.vat_obligation?
@vat_full_booking = Booking.new(params[:vat_full_booking])
Method to_s
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_s(format = :default)
return "" if (title.blank? or rate_to_s.blank?)
case format
when :long
- 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 xbooking_parameters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def xbooking_parameters(params = {})
# Prepare parameters set by template
booking_params = attributes.reject!{|key, value| !["title", "comments", "credit_account_id", "debit_account_id"].include?(key)}
# Calculate amount
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render(item_container)
if options[:is_subnavigation]
ul_class = "dropdown-menu"
else
ul_class = "nav"
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = User.find(params[:id])
# Don't try to update password if not provided
if params[:user][:password].blank?
- 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"