JumpstartLab/tracks

View on GitHub

Showing 244 of 244 total issues

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

  def update
    # TODO: write tests for updating
    @recurring_todo.tag_with(params[:edit_recurring_todo_tag_list]) if params[:edit_recurring_todo_tag_list]
    @original_item_context_id = @recurring_todo.context_id
    @original_item_project_id = @recurring_todo.project_id
Severity: Minor
Found in app/controllers/recurring_todos_controller.rb - About 1 hr to fix

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

          $('input[name="date_picker1"]').change(function() {
            var value = $('input[name="date_picker1"]:checked').val();
            $('input[name="prefs[date_format]"]').val(value);
            PreferencesPage.get_date_format('date_format');
          });
    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 653..657

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

    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

          $('input[name="date_picker2"]').change(function() {
            var value = $('input[name="date_picker2"]:checked').val();
            $('input[name="prefs[title_date_format]"]').val(value);
            PreferencesPage.get_date_format('title_date_format');
          });
    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 647..651

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

    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_behavior has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        setup_behavior: function () {
            /* main menu */
            $('ul.sf-menu').superfish({
                delay: 250,
                animation:   {
    Severity: Minor
    Found in app/assets/javascripts/tracks.js - About 1 hr to fix

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

          setup_behavior: function() {
              /* in place edit of context name */
              $('div.context span#context_name').editable(ContextListPage.save_context_name, {
                  style: 'padding:0px',
                  submit: i18n['common.ok'],
      Severity: Minor
      Found in app/assets/javascripts/tracks.js - About 1 hr to fix

        Method create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
            p = RecurringTodoCreateParamsHelper.new(params)
            p.attributes['end_date']=parse_date_per_user_prefs(p.attributes['end_date'])
            p.attributes['start_from']=parse_date_per_user_prefs(p.attributes['start_from'])
        
        
        Severity: Minor
        Found in app/controllers/recurring_todos_controller.rb - About 1 hr to fix

          Method index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              @source_view = params['_source_view'] || 'todo'
              init_data_for_sidebar unless mobile?
              
              @todos = current_user.todos.includes(Todo::DEFAULT_INCLUDES)
          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

          Method authenticate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.authenticate(login, pass)
              return nil if login.blank?
              candidate = where("login = ?", login).first
              return nil if candidate.nil?
          
          
          Severity: Minor
          Found in app/models/user.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 update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              @prefs = current_user.prefs
              @user = current_user
              user_updated = current_user.update_attributes(params['user'])
              prefs_updated = current_user.preference.update_attributes(params['prefs'])
          Severity: Minor
          Found in app/controllers/preferences_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 auto_complete_for_predecessor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def auto_complete_for_predecessor
              unless params['id'].nil?
                get_todo_from_params
                # Begin matching todos in current project, excluding @todo itself
                @items = @todo.project.todos.not_completed.
          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

          Method determine_down_count has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def determine_down_count
              source_view do |from|
                from.todo do
                  @down_count = current_user.todos.active.not_hidden.count
                end
          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

          Method create_todo_from_recurring_todo has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def create_todo_from_recurring_todo(rt, date=nil)
              # create todo and initialize with data from recurring_todo rt
              todo = current_user.todos.build( { :description => rt.description, :notes => rt.notes, :project_id => rt.project_id, :context_id => rt.context_id})
              todo.recurring_todo_id = rt.id
          
          
          Severity: Minor
          Found in app/controllers/application_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 update has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def update
              @todo = current_user.todos.find(params['id'])
              @source_view = params['_source_view'] || 'todo'
              # init_data_for_sidebar unless mobile?
          
          
          Severity: Minor
          Found in app/controllers/todos_controller.rb - About 1 hr to fix

            Method get_stats_projects has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def get_stats_projects
                # get the first 10 projects and their action count (all actions)
                #
                # Went from GROUP BY p.id to p.name for compatibility with postgresql. Since
                # the name is forced to be unique, this should work.
            Severity: Minor
            Found in app/controllers/stats_controller.rb - About 1 hr to fix

              Method update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def update
                  params['context'] ||= {}
                  success_text = if params['field'] == 'name' && params['value']
                    params['context']['id'] = params['id']
                    params['context']['name'] = params['value']
              Severity: Minor
              Found in app/controllers/contexts_controller.rb - About 1 hr to fix

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

                  def validate_monthly
                    case recurrence_selector
                    when 0 # 'monthly_every_x_day'
                      errors[:base] << "The day of the month may not be empty for recurrence setting" if monthly_every_x_day.blank?
                      errors[:base] << "Every other nth month may not be empty for recurrence setting" if monthly_every_x_month.blank?
                Severity: Major
                Found in app/models/recurring_todo.rb and 1 other location - About 1 hr to fix
                app/models/recurring_todo.rb on lines 80..90

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

                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

                  def validate_yearly
                    case recurrence_selector
                    when 0 # 'yearly_every_x_day'
                      errors[:base] << "The month of the year may not be empty for recurrence setting" if yearly_month_of_year.blank?
                      errors[:base] << "The day of the month may not be empty for recurrence setting" if yearly_every_x_day.blank?
                Severity: Major
                Found in app/models/recurring_todo.rb and 1 other location - About 1 hr to fix
                app/models/recurring_todo.rb on lines 66..76

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

                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 from_rich_message has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.from_rich_message(user, default_context_id, description, notes)
                    fields = description.match(/([^>@]*)@?([^>]*)>?(.*)/)
                    description = fields[1].strip
                    context = fields[2].strip
                    project = fields[3].strip
                Severity: Minor
                Found in app/models/todo.rb - About 1 hr to fix

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

                      setup_behavior: function() {
                          /* Add note */
                          $(document).on("click",".add_note_link a", function(){
                              $('#new-note').show();
                              $('textarea#note_body').val('');
                  Severity: Minor
                  Found in app/assets/javascripts/tracks.js - About 1 hr to fix

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

                    var ContextItems = {
                        setup_autocomplete_for_contexts: function(id) {
                            $(id).autocomplete({
                                source: relative_to_root('contexts.autocomplete'),
                                autoFocus: true,
                    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 598..607

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language