crewmate/crewmate

View on GitHub
app/controllers/task_lists_controller.rb

Summary

Maintainability
B
4 hrs
Test Coverage

File task_lists_controller.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class TaskListsController < ApplicationController
  around_filter :set_time_zone, :only => [:index, :show, :gantt_view]
  before_filter :load_task_list, :only => [:edit,:update,:show,:destroy,:watch,:unwatch,:archive,:unarchive]
  before_filter :load_task_lists, :only => [:index, :reorder]
  before_filter :set_page_title
Severity: Minor
Found in app/controllers/task_lists_controller.rb - About 2 hrs to fix

    Method archive has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def archive
        authorize! :update, @task_list
        calc_onindex
    
        if !@task_list.archived
    Severity: Minor
    Found in app/controllers/task_lists_controller.rb - About 1 hr to fix

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

        def archive
          authorize! :update, @task_list
          calc_onindex
      
          if !@task_list.archived
      Severity: Minor
      Found in app/controllers/task_lists_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

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

          def load_task_lists
            if @current_project
              @task_lists = @current_project.task_lists(:include => [:project])
            else
              @projects = current_user.projects.unarchived
      Severity: Minor
      Found in app/controllers/task_lists_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

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

          def load_gantt_events
            @chart_task_lists = []
            if @current_project
              @task_lists = (@task_lists || @current_project.task_lists.unarchived)
              conditions = ["project_id = :project_id AND status IN (:status) AND due_on IS NOT NULL", {
      Severity: Minor
      Found in app/controllers/task_lists_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

      There are no issues that match your filters.

      Category
      Status