JumpstartLab/tracks

View on GitHub

Showing 244 of 244 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        $(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 ) {
                event.preventDefault();
Severity: Major
Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
app/assets/javascripts/tracks.js on lines 407..413

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        $('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 ) {
                event.preventDefault();
Severity: Major
Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
app/assets/javascripts/tracks.js on lines 196..202

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method postTodo has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def postTodo(l, options = {})
      uri = URI.parse(GTD_URI_TODOS)
      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 1 hr to fix

    Method empty_container_msg_div_id has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def empty_container_msg_div_id(todo = @todo || @successor)
        raise Exception.new, "no @todo or @successor set" if !todo
    
        source_view do |page|
          page.project  {
    Severity: Minor
    Found in app/helpers/todos_helper.rb - About 1 hr to fix

      Method determine_remaining_in_context_count has 45 lines of code (exceeds 25 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 1 hr to fix

        Function setup_behavior has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            setup_behavior: function() {
                /* toggle new todo form for single todo */
                $('#toggle_action_new').click(function(){
                    if ($("#todo_multi_add").is(':visible')) { /* hide multi next action form first */
                        $('#todo_new_action').show();
        Severity: Minor
        Found in app/assets/javascripts/tracks.js - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def new
            @projects = current_user.projects.active
            @contexts = current_user.contexts
            respond_to do |format|
              format.m {
        Severity: Minor
        Found in app/controllers/todos_controller.rb - About 1 hr 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              $(document).on("click","#recurring_period input", function(){
                  RecurringTodosPage.hide_all_recurring();
                  $('#recurring_'+this.id.split('_')[4]).show();
              });
        Severity: Major
        Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/tracks.js on lines 1035..1038

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              $(document).on("click","#recurring_edit_period input", function(){
                  RecurringTodosPage.hide_all_edit_recurring();
                  $('#recurring_edit_'+this.id.split('_')[5]).show();
              });
        Severity: Major
        Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/tracks.js on lines 1002..1005

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 70.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method show_selected_actions_from_chart has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show_selected_actions_from_chart
            @page_title = t('stats.action_selection_title')
            @count = 99
        
            @source_view = 'stats'
        Severity: Minor
        Found in app/controllers/stats_controller.rb - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              set_state_container_visibility: function (state, set_visible) {
                  if (set_visible) {
                      $('#list-'+state+'-projects-container').slideDown("fast");
                  } else {
                      $('#list-'+state+'-projects-container').slideUp("fast");
          Severity: Major
          Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/tracks.js on lines 796..802

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              set_state_container_visibility: function (state, set_visible) {
                  if (set_visible) {
                      $('#list-'+state+'-contexts-container').slideDown("fast");
                  } else {
                      $('#list-'+state+'-contexts-container').slideUp("fast");
          Severity: Major
          Found in app/assets/javascripts/tracks.js and 1 other location - About 1 hr to fix
          app/assets/javascripts/tracks.js on lines 678..684

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 69.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function setup_autocomplete_for_predecessor has 42 lines of code (exceeds 25 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 1 hr to fix

            Function setup_behavior has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                setup_behavior: function() {
                    /* toggle new todo form for single todo */
                    $('#toggle_action_new').click(function(){
                        if ($("#todo_multi_add").is(':visible')) { /* hide multi next action form first */
                            $('#todo_new_action').show();
            Severity: Minor
            Found in app/assets/javascripts/tracks.js - About 1 hr to fix

              Method calendar has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def calendar
                  @source_view = params['_source_view'] || 'calendar'
                  @page_title = t('todos.calendar_page_title')
              
                  @projects = current_user.projects
              Severity: Minor
              Found in app/controllers/todos_controller.rb - About 1 hr to fix

                Method show_selected_actions_from_chart has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  def show_selected_actions_from_chart
                    @page_title = t('stats.action_selection_title')
                    @count = 99
                
                    @source_view = 'stats'
                Severity: Minor
                Found in app/controllers/stats_controller.rb - About 1 hr 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_xth_day_of_month has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_xth_day_of_month(x, weekday, month, year)
                    if x == 5
                      # last -> count backwards. use UTC to avoid strange timezone oddities
                      # where last_day -= 1.day seems to shift tz+0100 to tz+0000
                      last_day = Time.utc(year, month, Time.days_in_month(month))
                Severity: Minor
                Found in app/models/recurring_todo.rb - About 1 hr 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 39 lines of code (exceeds 25 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 1 hr to fix

                  Method show has 39 lines of code (exceeds 25 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 1 hr to fix

                    Method get_stats_tags has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def get_stats_tags
                        # tag cloud code inspired by this article
                        #  http://www.juixe.com/techknow/index.php/2006/07/15/acts-as-taggable-tag-cloud/
                    
                        levels=10
                    Severity: Minor
                    Found in app/controllers/stats_controller.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language