JumpstartLab/tracks

View on GitHub

Showing 182 of 244 total issues

Consider simplifying this complex logical expression.
Open

        container_id = "tickler-empty-nd" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
          (@original_item_was_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

    Method update_due_and_show_from_dates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_due_and_show_from_dates
        if params["todo"].has_key?("due")
          begin
            params["todo"]["due"] = parse_date_per_user_prefs(params["todo"]["due"])
          rescue
    Severity: Minor
    Found in app/controllers/todos_controller.rb - About 35 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 clearForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    $.fn.clearForm = function() {
        return this.each(function() {
            var type = this.type, tag = this.tagName.toLowerCase();
            if (tag == 'form')
                return $(':input',this).clearForm();
    Severity: Minor
    Found in app/assets/javascripts/tracks.js - About 35 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 tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def tag
        get_params_for_tag_view
        @page_title = t('todos.tagged_page_title', :tag_name => @tag_title)
        @source_view = params['_source_view'] || 'tag'
    
    
    Severity: Minor
    Found in app/controllers/todos_controller.rb - About 35 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_dependency_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def update_dependency_state
        # assumes @todo.save was called so that the predecessor_list is persistent
        if @original_item_predecessor_list != params[:predecessor_list]
          # Possible state change with new dependencies
          if @todo.uncompleted_predecessors.empty?
    Severity: Minor
    Found in app/controllers/todos_controller.rb - About 35 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 askIfNewContextProvided has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        askIfNewContextProvided: function(source, element_to_block) {
            var givenContextName = $('#'+source+'todo_context_name').val();
            if (givenContextName.length == 0) return true; // do nothing and depend on rails validation error
    
            var contexts = TodoItems.getContextsForAutocomplete(givenContextName, element_to_block);
    Severity: Minor
    Found in app/assets/javascripts/tracks.js - About 35 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 new has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def new
        @auth_types = []
        unless session[:cas_user]
          Tracks::Config.auth_schemes.each {|auth| @auth_types << [auth,auth]}
        else
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 35 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

    Avoid too many return statements within this method.
    Open

          page.todo     { return @context_changed || @todo.hidden? || @todo.deferred? || @todo.pending?}
    Severity: Major
    Found in app/helpers/todos_helper.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return "c#{todo.context_id}empty-nd"
      Severity: Major
      Found in app/helpers/todos_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return (@todo.active? && @todo.project && @todo.project.id == @default_project.id) ||
                  (@todo.project.hidden? && @todo.project_hidden?) ||
                  ( @todo.deferred? && (@todo.project.id == @default_project.id) ) ||
                  @todo.pending?
        Severity: Major
        Found in app/helpers/todos_helper.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return "c#{todo.context_id}empty-nd"
          Severity: Major
          Found in app/helpers/todos_helper.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return true
            Severity: Major
            Found in app/controllers/users_controller.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return false
              Severity: Major
              Found in app/helpers/todos_helper.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return "empty_#{@new_due_id}"
                Severity: Major
                Found in app/helpers/todos_helper.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return
                  Severity: Major
                  Found in app/controllers/users_controller.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          page.stats    { return @todo.completed? }
                    Severity: Major
                    Found in app/helpers/todos_helper.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return "tickler-empty-nd" if
                      Severity: Major
                      Found in app/helpers/todos_helper.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return
                        Severity: Major
                        Found in app/controllers/users_controller.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return "c#{todo.context_id}empty-nd"
                          Severity: Major
                          Found in app/helpers/todos_helper.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return false if params[:user][:password].empty?
                            Severity: Major
                            Found in app/controllers/users_controller.rb - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language