Showing 17 of 37 total issues
Method contracts
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def self.contracts(file)
CSV.foreach(file, :headers => true) do |row|
data = cleaned_row(row)
next if data.values.all?(&: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"
Further reading
Method initialize
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(contracts, year, view)
super(page_size: 'A4', top_margin: 30, left_margin: 55)
@contracts = contracts
@year = year
@view = view
Method initialize
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def initialize(contracts, year, view)
super(page_size: 'A4', top_margin: 30, left_margin: 55)
@contracts = contracts
@year = year
@view = view
- 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 contracts
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.contracts(file)
CSV.foreach(file, :headers => true) do |row|
data = cleaned_row(row)
next if data.values.all?(&:blank?)
Method initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(contracts, year, view)
super(page_size: 'A4', page_layout: :landscape, top_margin: 35)
@contracts = contracts
@year = year
@view = view
Method initialize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(contracts, year, view)
super(page_size: 'A4', top_margin: 60, left_margin: 55)
@contracts = contracts
@year = year
@view = view
Method postal_address_and_header
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def postal_address_and_header
image_width = 180
image_heigth = 52
address_y_pos = 110
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(statement)
@statement = statement
@contract = statement.contract
@year = statement.year
super(page_size: 'A4', top_margin: 30, left_margin: 55)
Method interest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def interest
params[:year] ||= DateTime.now.year
@contracts = []
if params[:contract]
@contracts = [params[:contract]]
- 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 create_with_balance!
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create_with_balance!(number, balance, interest, start_time = Date.current, params = {})
Method name_for_movement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def name_for_movement(movement)
return "Saldo" if movement[:type] == :initial_balance
return "Zinsen" if movement[:type] == :interest_entry
return "End-Saldo" if movement[:type] == :final_balance
return "Einzahlung" if movement[:type] == :movement && movement[:amount] > 0.0
- 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
Avoid too many return
statements within this method. Open
return "Auszahlung" if movement[:type] == :movement && movement[:amount] < 0.0
Method run_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_time(contract)
months = contract.last_version.duration_months
years = contract.last_version.duration_years
end_date = contract.last_version.end_date
return "#{months} months" unless months.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"
Further reading
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(contracts, year, view)
super(page_size: 'A4', page_layout: :landscape, top_margin: 35)
@contracts = contracts
@year = year
@view = view
- 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 interest_rates_and_dates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def interest_rates_and_dates
versions = contract_versions_valid_in_set_time_range
rates_and_dates = []
versions.each_with_index do |version, index|
- 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 contact_long
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def contact_long(contact)
contact_line = contact_short(contact)
return contact_line unless contact
contact_line << " | #{contact.email}" unless contact.email.blank?
contact_line << " | #{contact.address}" unless contact.address.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"
Further reading
Method index
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def index
@start_date = 1.year.ago.beginning_of_year.to_date
@end_date = Date.current
if params[:year]
- 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"