tamaloa/direktkreditverwaltung

View on GitHub

Showing 37 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def create
                @contract = Contract.find(params[:contract_id])
                @accounting_entry = @contract.accounting_entries.create(accounting_entry_params)
            
                respond_to do |format|
            Severity: Major
            Found in app/controllers/accounting_entries_controller.rb and 1 other location - About 1 hr to fix
            app/controllers/contract_versions_controller.rb on lines 45..55

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              def create
                @contract = Contract.find(params[:contract_id])
                @contract_version = @contract.contract_versions.create(contract_version_params)
            
                respond_to do |format|
            Severity: Major
            Found in app/controllers/contract_versions_controller.rb and 1 other location - About 1 hr to fix
            app/controllers/accounting_entries_controller.rb on lines 62..72

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 57.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                def create
                  @contact = Contact.new(contact_params)
              
                  respond_to do |format|
                    if @contact.save
              Severity: Major
              Found in app/controllers/contacts_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/companies_controller.rb on lines 42..51

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                def create
                  @company = Company.new(company_params)
              
                  respond_to do |format|
                    if @company.save
              Severity: Major
              Found in app/controllers/companies_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/contacts_controller.rb on lines 42..51

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      text company.name, size: 10
                      text "Projekt im Mietshäuser Syndikat", size: 8, style: :italic
                      move_down 10
                      text company.street, size: 8
                      text "#{company.zip_code} #{company.city}", size: 8
              Severity: Major
              Found in app/pdfs/pdf_interest_letter.rb and 1 other location - About 1 hr to fix
              app/pdfs/pdf_year_closing_statement.rb on lines 73..81

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 48.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                    text company.name, size: 10
                    text "Projekt im Mietshäuser Syndikat", size: 8, style: :italic
                    move_down 10
                    text company.street, size: 8
                    text "#{company.zip_code} #{company.city}", size: 8
              Severity: Major
              Found in app/pdfs/pdf_year_closing_statement.rb and 1 other location - About 1 hr to fix
              app/pdfs/pdf_interest_letter.rb on lines 32..40

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 48.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                def update
                  @accounting_entry = AccountingEntry.find(params[:id])
              
                  respond_to do |format|
                    if @accounting_entry.update_attributes(accounting_entry_params)
              Severity: Major
              Found in app/controllers/accounting_entries_controller.rb and 4 other locations - About 1 hr to fix
              app/controllers/companies_controller.rb on lines 58..67
              app/controllers/contacts_controller.rb on lines 58..67
              app/controllers/contract_versions_controller.rb on lines 62..71
              app/controllers/contracts_controller.rb on lines 62..71

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                def update
                  @company = Company.find(params[:id])
              
                  respond_to do |format|
                    if @company.update_attributes(company_params)
              Severity: Major
              Found in app/controllers/companies_controller.rb and 4 other locations - About 1 hr to fix
              app/controllers/accounting_entries_controller.rb on lines 79..88
              app/controllers/contacts_controller.rb on lines 58..67
              app/controllers/contract_versions_controller.rb on lines 62..71
              app/controllers/contracts_controller.rb on lines 62..71

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                def update
                  @contract = Contract.find(params[:id])
              
                  respond_to do |format|
                    if @contract.update_attributes(contract_params)
              Severity: Major
              Found in app/controllers/contracts_controller.rb and 4 other locations - About 1 hr to fix
              app/controllers/accounting_entries_controller.rb on lines 79..88
              app/controllers/companies_controller.rb on lines 58..67
              app/controllers/contacts_controller.rb on lines 58..67
              app/controllers/contract_versions_controller.rb on lines 62..71

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                def update
                  @contact = Contact.find(params[:id])
              
                  respond_to do |format|
                    if @contact.update_attributes(contact_params)
              Severity: Major
              Found in app/controllers/contacts_controller.rb and 4 other locations - About 1 hr to fix
              app/controllers/accounting_entries_controller.rb on lines 79..88
              app/controllers/companies_controller.rb on lines 58..67
              app/controllers/contract_versions_controller.rb on lines 62..71
              app/controllers/contracts_controller.rb on lines 62..71

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                def update
                  @contract_version = ContractVersion.find(params[:id])
              
                  respond_to do |format|
                    if @contract_version.update_attributes(contract_version_params)
              Severity: Major
              Found in app/controllers/contract_versions_controller.rb and 4 other locations - About 1 hr to fix
              app/controllers/accounting_entries_controller.rb on lines 79..88
              app/controllers/companies_controller.rb on lines 58..67
              app/controllers/contacts_controller.rb on lines 58..67
              app/controllers/contracts_controller.rb on lines 62..71

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Severity
              Category
              Status
              Source
              Language