app/models/list_export.rb
Method processed_data
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
def processed_data
if preset.to_s.in?(['birthday_list', 'address_list', 'dpag_internetmarke', 'phone_list']) && @data.kind_of?(Group)
# To be able to generate lists from Groups as well as search results, these presets expect
# an Array of Users as data. If a Group is given instead, just take the group members as data.
#
- 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 processed_data
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def processed_data
if preset.to_s.in?(['birthday_list', 'address_list', 'dpag_internetmarke', 'phone_list']) && @data.kind_of?(Group)
# To be able to generate lists from Groups as well as search results, these presets expect
# an Array of Users as data. If a Group is given instead, just take the group members as data.
#
Class ListExportUser
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ListExportUser < User
def personal_title_and_name
"#{personal_title} #{name}".strip
end
File list_export.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'csv'
# This class helps to export data to CSV, XLS and possibly others.
#
# Example:
Method to_csv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_csv
CSV.generate(csv_options) do |csv|
csv << headers
data.each do |row|
csv << columns.collect do |column_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"