TracksApp/tracks

View on GitHub

Showing 64 of 1,614 total issues

File todos_controller.rb has 1067 lines of code (exceeds 300 allowed). Consider refactoring.
Open

class TodosController < ApplicationController
  skip_before_action :login_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
  prepend_before_action :login_or_feed_token_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
  append_before_action :find_and_activate_ready, :only => [:index, :list_deferred]

Severity: Major
Found in app/controllers/todos_controller.rb - About 2 days to fix

    Class TodosController has 70 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class TodosController < ApplicationController
      skip_before_action :login_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
      prepend_before_action :login_or_feed_token_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
      append_before_action :find_and_activate_ready, :only => [:index, :list_deferred]
    
    
    Severity: Major
    Found in app/controllers/todos_controller.rb - About 1 day to fix

      File todos_helper.rb has 559 lines of code (exceeds 300 allowed). Consider refactoring.
      Open

      require 'staleness'
      
      module TodosHelper
        # === helpers for rendering container
        def empty_message_holder(container_name, show, title_param = nil)
      Severity: Major
      Found in app/helpers/todos_helper.rb - About 1 day to fix

        Class Actions has 41 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Actions
            SECONDS_PER_DAY = 86_400
        
            attr_reader :user
        
        
        Severity: Minor
        Found in app/models/stats/actions.rb - About 5 hrs to fix

          Class Todo has 37 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Todo < ApplicationRecord
            MAX_DESCRIPTION_LENGTH = 300
            MAX_NOTES_LENGTH = 60_000
          
            after_save :save_predecessors
          Severity: Minor
          Found in app/models/todo.rb - About 4 hrs to fix

            Class ApplicationController has 34 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class ApplicationController < ActionController::Base
              # Prevent CSRF attacks by raising an exception.
              # For APIs, you may want to use :null_session instead.
              protect_from_forgery with: :exception
            
            
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 4 hrs to fix

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

                class AbstractRecurrencePattern
                  attr_accessor :attributes
              
                  def initialize(user)
                    @user = user
              Severity: Minor
              Found in app/models/recurring_todos/abstract_recurrence_pattern.rb - About 4 hrs to fix

                Class User has 31 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class User < ApplicationRecord
                  # Virtual attribute for the unencrypted password
                  attr_accessor :password
                
                  cattr_accessor :per_page
                Severity: Minor
                Found in app/models/user.rb - About 3 hrs to fix

                  Class TodoCreateParamsHelper has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class TodoCreateParamsHelper
                      attr_reader :new_project_created, :new_context_created, :attributes
                  
                      def initialize(params, user)
                        set_params(params)
                  Severity: Minor
                  Found in app/controllers/todos/todo_create_params_helper.rb - About 2 hrs to fix

                    Method create has a Cognitive Complexity of 64 (exceeds 50 allowed). Consider refactoring.
                    Open

                      def create
                        @source_view = params['_source_view'] || 'todo'
                        @default_context = current_user.contexts.where(:name => params['default_context_name']).first
                        @default_project = current_user.projects.where(:name => params['default_project_name']).first if params['default_project_name'].present?
                    
                    
                    Severity: Minor
                    Found in app/controllers/todos_controller.rb - About 2 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

                    Consider simplifying this complex logical expression.
                    Open

                        if source_view_is_one_of(:tag, :context, :project)
                          return @remaining_in_context == 0 && (
                            todo_moved_out_of_container                                                       ||
                            (@todo_hidden_state_changed && @todo.hidden?)                                     ||
                            @todo_was_deferred_from_active_state                                              ||
                    Severity: Critical
                    Found in app/helpers/todos_helper.rb - About 2 hrs to fix

                      Class AttributeHandler has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class AttributeHandler
                          attr_reader :attributes
                      
                          def initialize(user, attributes)
                            @user = user
                      Severity: Minor
                      Found in lib/tracks/attribute_handler.rb - About 2 hrs to fix

                        Class AbstractRecurringTodosBuilder has 21 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class AbstractRecurringTodosBuilder
                            attr_reader :mapped_attributes, :pattern
                        
                            def initialize(user, attributes, pattern_class)
                              @user  = user
                        Severity: Minor
                        Found in app/models/recurring_todos/abstract_recurring_todos_builder.rb - About 2 hrs to fix

                          File projects_controller.rb has 304 lines of code (exceeds 300 allowed). Consider refactoring.
                          Open

                          class ProjectsController < ApplicationController
                            helper :application, :todos, :notes
                            before_action :set_source_view
                            before_action :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
                            before_action :default_context_filter, :only => [:create, :update]
                          Severity: Minor
                          Found in app/controllers/projects_controller.rb - About 2 hrs to fix

                            File todo.rb has 304 lines of code (exceeds 300 allowed). Consider refactoring.
                            Open

                            class Todo < ApplicationRecord
                              MAX_DESCRIPTION_LENGTH = 300
                              MAX_NOTES_LENGTH = 60_000
                            
                              after_save :save_predecessors
                            Severity: Minor
                            Found in app/models/todo.rb - About 2 hrs to fix

                              File actions.rb has 301 lines of code (exceeds 300 allowed). Consider refactoring.
                              Open

                              module Stats
                                class Actions
                                  SECONDS_PER_DAY = 86_400
                              
                                  attr_reader :user
                              Severity: Minor
                              Found in app/models/stats/actions.rb - About 2 hrs to fix

                                Method create_multiple has a Cognitive Complexity of 59 (exceeds 50 allowed). Consider refactoring.
                                Open

                                  def create_multiple
                                    p = Todos::TodoCreateParamsHelper.new(params, current_user)
                                    tag_list = p.tag_list
                                
                                    @not_done_todos = []
                                Severity: Minor
                                Found in app/controllers/todos_controller.rb - About 1 hr 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 toggle_check has a Cognitive Complexity of 53 (exceeds 50 allowed). Consider refactoring.
                                Open

                                  def toggle_check
                                    @todo = current_user.todos.find(params['id'])
                                
                                    @source_view = params['_source_view'] || 'todo'
                                
                                
                                Severity: Minor
                                Found in app/controllers/todos_controller.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

                                Consider simplifying this complex logical expression.
                                Open

                                        container_id = "hidden_container-empty-d" if (@remaining_hidden_count == 0 && !@todo.hidden? && @todo_hidden_state_changed) ||
                                          (@remaining_hidden_count == 0 && @todo.completed? && @original_item.hidden?)
                                Severity: Major
                                Found in app/helpers/todos_helper.rb - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                          container_id = "deferred_pending_container-empty-d" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
                                            (@original_item.deferred? && @remaining_deferred_or_pending_count == 0 && (@todo.completed? || @tag_was_removed))
                                  Severity: Major
                                  Found in app/helpers/todos_helper.rb - About 40 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language