tamaloa/direktkreditverwaltung

View on GitHub

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?)

Severity: Minor
Found in app/models/import.rb - About 1 day 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 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
Severity: Major
Found in app/pdfs/pdf_interest_letter.rb - About 4 hrs to fix

    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
    Severity: Minor
    Found in app/pdfs/pdf_interest_letter.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 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?)
    
    
    Severity: Minor
    Found in app/models/import.rb - About 2 hrs to fix

      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
      Severity: Minor
      Found in app/pdfs/pdf_interest_thanks.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in app/pdfs/pdf_interest_overview.rb - About 1 hr to fix

          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
          
          
          Severity: Minor
          Found in app/pdfs/pdf_year_closing_statement.rb - About 1 hr to fix

            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)
            Severity: Minor
            Found in app/pdfs/pdf_year_closing_statement.rb - About 1 hr to fix

              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]]
              Severity: Minor
              Found in app/controllers/contracts_controller.rb - About 55 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

              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 = {})
              Severity: Minor
              Found in app/models/contract.rb - About 35 mins to fix

                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
                Severity: Minor
                Found in app/helpers/application_helper.rb - About 35 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

                Avoid too many return statements within this method.
                Open

                    return "Auszahlung" if movement[:type] == :movement && movement[:amount] < 0.0
                Severity: Major
                Found in app/helpers/application_helper.rb - About 30 mins to fix

                  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?
                  Severity: Minor
                  Found in app/helpers/contracts_helper.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

                  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
                  Severity: Minor
                  Found in app/pdfs/pdf_interest_thanks.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

                  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|
                  Severity: Minor
                  Found in app/models/interest_calculation.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

                  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?
                  Severity: Minor
                  Found in app/helpers/contacts_helper.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

                  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]
                  Severity: Minor
                  Found in app/controllers/accounting_entries_controller.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

                  Severity
                  Category
                  Status
                  Source
                  Language