fiedl/your_platform

View on GitHub
app/models/list_export.rb

Summary

Maintainability
C
1 day
Test Coverage

Method processed_data has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
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.
      #
Severity: Minor
Found in app/models/list_export.rb - About 3 hrs to fix

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

  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.
      #
Severity: Major
Found in app/models/list_export.rb - About 3 hrs to fix

    Class ListExportUser has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ListExportUser < User
    
      def personal_title_and_name
        "#{personal_title} #{name}".strip
      end
    Severity: Minor
    Found in app/models/list_export.rb - About 2 hrs to fix

      File list_export.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'csv'
      
      # This class helps to export data to CSV, XLS and possibly others.
      #
      # Example:
      Severity: Minor
      Found in app/models/list_export.rb - About 2 hrs to fix

        Method to_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def to_csv
            CSV.generate(csv_options) do |csv|
              csv << headers
              data.each do |row|
                csv << columns.collect do |column_name|
        Severity: Minor
        Found in app/models/list_export.rb - About 25 mins to fix

        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

        There are no issues that match your filters.

        Category
        Status