TechLadies/home-web

View on GitHub

Showing 5 of 114 total issues

Class CaseFilePresenter has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class CaseFilePresenter

  include ActionView::Helpers::NumberHelper
  include ActionView::Helpers::TextHelper

Severity: Minor
Found in app/presenters/case_file_presenter.rb - About 4 hrs to fix

    Function sort has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        sort: function(th, direction) {
          var start = new Date(),
            self = this,
            table = this.$table,
            //body = table.find('tbody').length > 0 ? table.find('tbody') : table,
    Severity: Major
    Found in app/assets/javascripts/jquery.tablesort.js - About 2 hrs to fix

      Method case_must_have_client_and_employer_and_agency has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def case_must_have_client_and_employer_and_agency
          errors.add(:case_file, 'must have a client') unless @case_file.client
          errors.add(:case_file, 'must have an employer') unless @case_file.employer
          if @case_file.case_type == 'Domestic'
            errors.add(:case_file, 'must have an agency') unless @case_file.agency
      Severity: Minor
      Found in app/services/close_case_file_service.rb - About 45 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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def save
          if valid?
            case_file.transaction do
               unless involvement.involvable_id
                involvement.involvable = involvable
      Severity: Minor
      Found in app/forms/involvement_form.rb - About 45 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 perform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def perform
          if valid?
            @case_files = CaseFile.where(reported_at: start_date..end_date)
            @case_files = @case_files.where(case_type: case_type) if case_type.present?
            @case_files = @case_files.where(status: status) if status.present?
      Severity: Minor
      Found in app/queries/general_report_query.rb - About 45 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