JumpstartLab/tracks

View on GitHub

Showing 182 of 244 total issues

Avoid too many return statements within this method.
Open

      return current_user.todos.not_completed.where('todos.due > ?', due_this_month_date).count
Severity: Major
Found in app/controllers/todos_controller.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 ""
      Severity: Major
      Found in app/helpers/todos_helper.rb - About 30 mins to fix

        Method update_state_from_project has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def update_state_from_project
            if self.project_hidden? && (!self.project.hidden?)
              if self.uncompleted_predecessors.empty?
                self.activate!
              else
        Severity: Minor
        Found in app/models/todo.rb - About 25 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 predecessor_dependencies= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def predecessor_dependencies=(params)
            deps = params[:predecessor]
            return if deps.nil?
        
            # for multiple dependencies, value will be an array of id's, but for a single dependency,
        Severity: Minor
        Found in app/models/todo.rb - About 25 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 get_ids_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_ids_from (actions, week_from, week_to, at_end)
            selected_todo_ids = []
        
            actions.each do |r|
              weeks = difference_in_weeks(@today, r.created_at)
        Severity: Minor
        Found in app/controllers/stats_controller.rb - About 25 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 remote_defer_menu_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def remote_defer_menu_item(days, todo)
            url = {:controller => 'todos', :action => 'defer', :id => todo.id, :days => days,
              :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
            url[:_tag_name] = @tag_name if @source_view == 'tag'
        
        
        Severity: Minor
        Found in app/helpers/todos_helper.rb - About 25 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 get_due_id_for_calendar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_due_id_for_calendar(due)
            return "" if due.nil?
            due_today_date = Time.zone.now
            due_this_week_date = Time.zone.now.end_of_week
            due_next_week_date = due_this_week_date + 7.days
        Severity: Minor
        Found in app/controllers/todos_controller.rb - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            if params[:format] == 'application/xml' && params['exception']
              render_failure "Expected post format is valid xml like so: <project><name>project name</name></project>.", 400
              return
            end
        Severity: Minor
        Found in app/controllers/projects_controller.rb - About 25 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 staleness_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def staleness_class(item)
            if item.due || item.completed?
              return ""
            elsif item.created_at < current_user.time - (prefs.staleness_starts * 3).days
              return " stale_l3"
        Severity: Minor
        Found in app/helpers/todos_helper.rb - About 25 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 setup_autocomplete_for_predecessor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            setup_autocomplete_for_predecessor: function() {
                $('input[name=predecessor_input]:not(.ac_input)')
                .bind( "keydown", function( event ) { // don't navigate away from the field on tab when selecting an item
                    if ( event.keyCode === $.ui.keyCode.TAB &&
                        $( this ).data( "autocomplete" ).menu.active ) {
        Severity: Minor
        Found in app/assets/javascripts/tracks.js - About 25 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 set_recurrence_on_validations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def set_recurrence_on_validations
            # show always or x days before due date. x not null
            case self.target
            when 'show_from_date'
              # no validations
        Severity: Minor
        Found in app/models/recurring_todo.rb - About 25 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 project= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def project=(value)
            if value.is_a? Project
              self.original_project=(value)
            elsif !(value.nil? || value.is_a?(NullProject))
              p = Project.where(:name => value[:name]).first
        Severity: Minor
        Found in app/models/todo.rb - About 25 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 setup_autocomplete_for_tag_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            setup_autocomplete_for_tag_list: function(id) {
                $(id+':not(.ac_input)')
                .bind( "keydown", function( event ) { // don't navigate away from the field on tab when selecting an item
                    if ( event.keyCode === $.ui.keyCode.TAB &&
                        $( this ).data( "autocomplete" ).menu.active ) {
        Severity: Minor
        Found in app/assets/javascripts/tracks.js - About 25 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def index
            @source_view = params['_source_view'] || 'project_list'
            if params[:projects_and_actions]
              projects_and_actions
            else
        Severity: Minor
        Found in app/controllers/projects_controller.rb - About 25 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 is_successor? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def is_successor?(todo)
            if self == todo
              return true
            elsif self.successors.empty?
              return false
        Severity: Minor
        Found in app/models/todo.rb - About 25 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 get_monthly_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_monthly_date(previous)
        
            start = determine_start(previous)
            day = self.every_other1
            n = self.every_other2
        Severity: Minor
        Found in app/models/recurring_todo.rb - About 25 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_expiry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_expiry
            # Gets called by periodically_call_remote to check whether
            # the session has timed out yet
            unless session == nil
              if session
        Severity: Minor
        Found in app/controllers/login_controller.rb - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            if params[:format] == 'application/xml' && params['exception']
              render_failure "Expected post format is valid xml like so: <context><name>context name</name></context>.", 400
              return
            end
        Severity: Minor
        Found in app/controllers/contexts_controller.rb - About 25 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 postProject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def postProject(l, options = {})
              uri = URI.parse(GTD_URI_PROJECTS)
              http = Net::HTTP.new(uri.host, uri.port)
        
              if uri.scheme == "https"  # enable SSL/TLS
        Severity: Minor
        Found in doc/tracks_template_cli.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language