TracksApp/tracks

View on GitHub

Showing 2,926 of 2,932 total issues

Block has too many lines. [52/25]
Open

    respond_to do |format|
      format.html do
        unless User.no_users_yet? || (@user && @user.is_admin?) || SITE_CONFIG['open_signups']
          @page_title = t('users.no_signups_title')
          @admin_email = SITE_CONFIG['admin_email']
Severity: Minor
Found in app/controllers/users_controller.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Complex method TodosController#update_context (46.3)
Open

  def update_context
    @context_changed = false
    if params['todo']['context_id'].blank? && params['context_name'].present?
      @context = current_user.contexts.where(:name => params['context_name'].strip).first
      if @context.nil?
Severity: Minor
Found in app/controllers/todos_controller.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method TodosController#determine_completed_count (45.5)
Open

  def determine_completed_count
    todos = nil

    source_view do |from|
      from.todo    { todos = current_user.todos.not_hidden.completed }
Severity: Minor
Found in app/controllers/todos_controller.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method TodosController#determine_changes_by_this_update (45.1)
Open

  def determine_changes_by_this_update
    @todo_was_activated_from_deferred_state = @todo.active? && @original_item.deferred?
    @todo_was_activated_from_pending_state = @todo.active? && @original_item.pending?
    @todo_was_deferred_from_active_state = @todo.deferred? && !@original_item.deferred?
    @todo_was_blocked_from_active_state = @todo.pending? && !@original_item.pending?
Severity: Minor
Found in app/controllers/todos_controller.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Block has too many lines. [50/25]
Open

    source_view do |from|
      from.deferred do
        todos_in_container, todos_in_target_container = find_todos_in_container_and_target_container(todo, @todo)
        @remaining_in_context = todos_in_container.deferred_or_blocked.count
        @target_context_count = todos_in_target_container.deferred_or_blocked.count
Severity: Minor
Found in app/controllers/todos_controller.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

      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

        Block has too many lines. [47/25]
        Open

          has_many(:projects, -> { order 'projects.position ASC' }, dependent: :delete_all) do
                      def find_by_params(params)
                        find(params['id'] || params['project_id'])
                      end
        
        
        Severity: Minor
        Found in app/models/user.rb by rubocop

        This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

        Complex method TodosController#check_for_next_todo (41.9)
        Open

          def check_for_next_todo(todo)
            # check if this todo has a related recurring_todo. If so, create next todo
            new_recurring_todo = nil
            recurring_todo = nil
            if todo.from_recurring_todo?
        Severity: Minor
        Found in app/controllers/todos_controller.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method DataController#xml_export (41.9)
        Open

          def xml_export
            todo_tag_ids = Tag.find_by_sql([
                "SELECT DISTINCT tags.id
                 FROM tags, taggings, todos
                 WHERE todos.user_id = ?
        Severity: Minor
        Found in app/controllers/data_controller.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method ConsoleOptions#initialize (41.9)
        Open

          def initialize
            @options = {}
        
            @parser = OptionParser.new do |cmd|
              cmd.banner = "Ruby Gtd CLI - takes todos input from STDIN"
        Severity: Minor
        Found in doc/tracks_cli_client.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method TodosController#get_params_for_tag_view (41.7)
        Open

          def get_params_for_tag_view
            filter_format_for_tag_view
        
            # Don't use sanitize here because these are only used for a DB query.
            @tag_expr = []
        Severity: Minor
        Found in app/controllers/todos_controller.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method CalendarController#show (41.6)
        Open

          def show
            @source_view = 'calendar'
            @page_title = t('todos.calendar_page_title')
        
            @calendar = Todos::Calendar.new(current_user)
        Severity: Minor
        Found in app/controllers/calendar_controller.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method TodosHelper#replace_with_updated_todo (41.3)
        Open

          def replace_with_updated_todo
            source_view do |page|
              page.context  { return !update_needs_to_remove_todo_from_container }
              page.project  { return !update_needs_to_remove_todo_from_container }
              page.deferred { return !todo_moved_out_of_container && (@todo.deferred? || @todo.pending?) }
        Severity: Minor
        Found in app/helpers/todos_helper.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method ContextsController#update (41.2)
        Open

          def update
            process_params_for_update
        
            @context.attributes = context_params
            @saved = @context.save
        Severity: Minor
        Found in app/controllers/contexts_controller.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

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

              Complex method namespace(tracks)::task#password (40.1)
              Open

                task :password => :environment do
                  require "io/console"
              
                  user = User.find_by_login(ENV['USER'])
                  if user.nil?
              Severity: Minor
              Found in lib/tasks/tracks.rake by flog

              Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

              You can read more about ABC metrics or the flog tool

              Severity
              Category
              Status
              Source
              Language