JumpstartLab/tracks

View on GitHub

Showing 182 of 244 total issues

File todos_controller.rb has 1197 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class TodosController < ApplicationController

  skip_before_filter :login_required, :only => [:index, :calendar, :tag]
  prepend_before_filter :login_or_feed_token_required, :only => [:index, :calendar, :tag]
  append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
Severity: Major
Found in app/controllers/todos_controller.rb - About 3 days to fix

    File tracks.js has 1081 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var TracksForm = {
        toggle: function(toggleLinkId, formContainerId, formId, hideLinkText,
            hideLinkTitle, showLinkText, showLinkTitle) {
            var form=$('#'+formContainerId)
            form.toggle();
    Severity: Major
    Found in app/assets/javascripts/tracks.js - About 2 days to fix

      Method create has a Cognitive Complexity of 99 (exceeds 5 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 unless params['default_project_name'].blank?
      
      
      Severity: Minor
      Found in app/controllers/todos_controller.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

      Class RecurringTodo has 80 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class RecurringTodo < ActiveRecord::Base
        attr_protected :user
      
        belongs_to :context
        belongs_to :project
      Severity: Major
      Found in app/models/recurring_todo.rb - About 1 day to fix

        Method create_multiple has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
        Open

          def create_multiple
            if project_specified_by_name(params[:project_name])
              project = current_user.projects.where(:name => params[:project_name]).first_or_create
              @new_project_created = project.new_record_before_save?
              @project_id = project.id
        Severity: Minor
        Found in app/controllers/todos_controller.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

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

        class TodosController < ApplicationController
        
          skip_before_filter :login_required, :only => [:index, :calendar, :tag]
          prepend_before_filter :login_or_feed_token_required, :only => [:index, :calendar, :tag]
          append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
        Severity: Major
        Found in app/controllers/todos_controller.rb - About 1 day to fix

          File recurring_todo.rb has 516 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class RecurringTodo < ActiveRecord::Base
            attr_protected :user
          
            belongs_to :context
            belongs_to :project
          Severity: Major
          Found in app/models/recurring_todo.rb - About 1 day to fix

            Method toggle_check has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
            Open

              def toggle_check
                @todo = current_user.todos.find(params['id'])
                @source_view = params['_source_view'] || 'todo'
                @original_item_due = @todo.due
                @original_item_was_deferred = @todo.deferred?
            Severity: Minor
            Found in app/controllers/todos_controller.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 create has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                if params['exception']
                  render_failure "Expected post format is valid xml like so: <user><login>username</login><password>abc123</password></user>."
                  return
                end
            Severity: Minor
            Found in app/controllers/users_controller.rb - About 7 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 run has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(args)
                  @parser.parse!(args)
                  # lines = STDIN.read
                  gtd = API.new
            
            
            Severity: Minor
            Found in doc/tracks_template_cli.rb - About 7 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

            File stats_controller.rb has 466 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class StatsController < ApplicationController
            
              SECONDS_PER_DAY = 86400;
            
              helper :todos, :projects, :recurring_todos
            Severity: Minor
            Found in app/controllers/stats_controller.rb - About 7 hrs to fix

              Method show_empty_message_in_source_container has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
              Open

                def show_empty_message_in_source_container
                  container_id = ""
                  source_view do |page|
                    page.project  {
                      container_id = "p#{@original_item_project_id}empty-nd" if @remaining_in_context == 0
              Severity: Minor
              Found in app/helpers/todos_helper.rb - About 6 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

              File todos_helper.rb has 410 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module TodosHelper
              
                def remote_star_icon(todo=@todo)
                  link_to( image_tag_for_star(todo),
                    toggle_star_todo_path(todo),
              Severity: Minor
              Found in app/helpers/todos_helper.rb - About 5 hrs to fix

                Class StatsController has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class StatsController < ApplicationController
                
                  SECONDS_PER_DAY = 86400;
                
                  helper :todos, :projects, :recurring_todos
                Severity: Minor
                Found in app/controllers/stats_controller.rb - About 5 hrs to fix

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

                  class Todo < ActiveRecord::Base
                  
                    before_save :render_note
                    after_save :save_predecessors
                  
                  
                  Severity: Minor
                  Found in app/models/todo.rb - About 4 hrs to fix

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

                    class User < ActiveRecord::Base
                      # Virtual attribute for the unencrypted password
                      attr_accessor :password
                      attr_protected :is_admin # don't allow mass-assignment for this
                      
                    Severity: Minor
                    Found in app/models/user.rb - About 4 hrs to fix

                      Method determine_remaining_in_context_count has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def determine_remaining_in_context_count(context_id = @todo.context_id)
                          source_view do |from|
                            from.deferred {
                              # force reload to todos to get correct count and not a cached one
                              @remaining_in_context = current_user.contexts.find(context_id).todos.deferred_or_blocked.count
                      Severity: Minor
                      Found in app/controllers/todos_controller.rb - About 4 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

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

                      class ApplicationController < ActionController::Base
                      
                        protect_from_forgery
                      
                        include LoginSystem
                      Severity: Minor
                      Found in app/controllers/application_controller.rb - About 4 hrs to fix

                        File todo.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class Todo < ActiveRecord::Base
                        
                          before_save :render_note
                          after_save :save_predecessors
                        
                        
                        Severity: Minor
                        Found in app/models/todo.rb - About 3 hrs to fix

                          Method create has 87 lines of code (exceeds 25 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 unless params['default_project_name'].blank?
                          
                          
                          Severity: Major
                          Found in app/controllers/todos_controller.rb - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language