JumpstartLab/tracks

View on GitHub

Showing 182 of 244 total issues

Method results has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def results
    @source_view = params['_source_view'] || 'search'
    @page_title = "TRACKS::Search Results for #{params[:search]}"
    terms = "%#{params[:search]}%"

Severity: Minor
Found in app/controllers/search_controller.rb - About 1 hr to fix

    Method get_daily_date has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_daily_date(previous)
        # previous is the due date of the previous todo or it is the completed_at
        # date when the completed_at date is after due_date (i.e. you did not make
        # the due date in time)
        #
    Severity: Minor
    Found in app/models/recurring_todo.rb - About 55 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 starts_and_ends_on_validations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def starts_and_ends_on_validations
        errors[:base] << "The start date needs to be filled in" if start_from.blank?
        case self.ends_on
        when 'ends_on_number_of_times'
          errors[:base] << "The number of recurrences needs to be filled in for 'Ends on'" if number_of_occurences.blank?
    Severity: Minor
    Found in app/models/recurring_todo.rb - About 55 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 add_predecessor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_predecessor
        @source_view = params['_source_view'] || 'todo'
        @predecessor = current_user.todos.find(params['predecessor'])
        @predecessors = @predecessor.predecessors
        @todo = current_user.todos.includes(Todo::DEFAULT_INCLUDES).find(params['successor'])
    Severity: Minor
    Found in app/controllers/todos_controller.rb - About 55 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 update_project has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_project
        @project_changed = false;
        if params['todo']['project_id'].blank? && !params['project_name'].nil?
          if params['project_name'] == 'None'
            project = Project.null_object
    Severity: Minor
    Found in app/controllers/todos_controller.rb - About 55 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 monthly_recurrence_pattern has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def monthly_recurrence_pattern
        return "invalid repeat pattern" if every_other2.nil?
        if self.recurrence_selector == 0
          on_day = " #{I18n.t('todos.recurrence.pattern.on_day_n', :n => self.every_other1)}"
          if self.every_other2>1
    Severity: Minor
    Found in app/models/recurring_todo.rb - About 55 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

    Function toggle has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        toggle: function(toggleLinkId, formContainerId, formId, hideLinkText,
            hideLinkTitle, showLinkText, showLinkTitle) {
    Severity: Major
    Found in app/assets/javascripts/tracks.js - About 50 mins to fix

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

          def initialize(params, prefs)
            @params = params['request'] || params
            @prefs = prefs
            @attributes = params['request'] && params['request']['todo']  || params['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

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

        def find_todos_with_tag_expr(tag_expr)
          # optimize for the common case: selecting only one tag
          if @single_tag
            tag = Tag.where(:name => @tag_name).first
            tag_id = tag.nil? ? -1 : tag.id
      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

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

        def check_create_user_params
          return false unless params.has_key?(:user)
          return false unless params[:user].has_key?(:login)
          return false if params[:user][:login].empty?
          return false unless params[:user].has_key?(:password)
      Severity: Minor
      Found in app/controllers/users_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

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

        def item_container_id (todo)
          return "hiddenitems"              if source_view_is(:tag) && todo.hidden?
          return "c#{todo.context_id}items" if source_view_is :deferred
          return @new_due_id                if source_view_is :calendar
          return "tickleritems"             if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
      Severity: Minor
      Found in app/helpers/todos_helper.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

      Function enable_dependency_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          enable_dependency_delete: function() {
              $(document).on("click", 'a[class=icon_delete_dep]', function() {
                  var form = $(this).parents('form').get(0);
                  var predecessor_list = $(form).find('input[name=predecessor_list]');
                  var id_list = split( predecessor_list.val() );
      Severity: Minor
      Found in app/assets/javascripts/tracks.js - 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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def show
          @max_completed = current_user.prefs.show_number_completed
          init_data_for_sidebar unless mobile?
          @page_title = t('projects.page_title', :project => @project.name)
      
      
      Severity: Minor
      Found in app/controllers/projects_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

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

        def add_predecessor_list(predecessor_list)
          return unless predecessor_list.kind_of? String
      
          @predecessor_array=predecessor_list.split(",").inject([]) do |list, todo_id|
            predecessor = self.user.todos.find( todo_id.to_i ) unless todo_id.blank?
      Severity: Minor
      Found in app/models/todo.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 feed_content_for_todo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def feed_content_for_todo(todo)
          item_notes = todo.notes ? todo.rendered_notes : ''
          due = todo.due ? content_tag(:div, t('todos.feeds.due', :date => format_date(todo.due))) : ''
          done = todo.completed? ? content_tag(:div, t('todos.feeds.completed', :date => format_date(todo.completed_at))) : ''
          context_link = link_to(context_url(todo.context), todo.context.name)
      Severity: Minor
      Found in app/helpers/todos_helper.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

              return "tickler-empty-nd" if
                @todo_was_deferred_from_active_state ||
                @todo_was_blocked_from_active_state ||
                @todo_was_destroyed_from_deferred_state ||
                @todo_was_created_deferred ||
      Severity: Major
      Found in app/helpers/todos_helper.rb - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

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

          Consider simplifying this complex logical expression.
          Open

                  return "tickler-empty-nd" if
                    @todo_was_deferred_from_active_state ||
                    @todo_was_blocked_from_active_state ||
                    @todo_was_destroyed_from_deferred_state ||
                    @todo_was_created_deferred ||
          Severity: Major
          Found in app/helpers/todos_helper.rb - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    return "tickler-empty-nd" if
                      @todo_was_deferred_from_active_state ||
                      @todo_was_blocked_from_active_state ||
                      @todo_was_destroyed_from_deferred_state ||
                      @todo_was_created_deferred ||
            Severity: Major
            Found in app/helpers/todos_helper.rb - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      return "tickler-empty-nd" if
                        @todo_was_deferred_from_active_state ||
                        @todo_was_blocked_from_active_state ||
                        @todo_was_destroyed_from_deferred_state ||
                        @todo_was_created_deferred ||
              Severity: Major
              Found in app/helpers/todos_helper.rb - About 40 mins to fix
                Severity
                Category
                Status
                Source
                Language