JumpstartLab/tracks

View on GitHub

Showing 244 of 244 total issues

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 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 'context'
      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 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/controllers/users_controller.rb - About 30 mins to fix

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

                      format.xml {
                        if @saved
                          render :xml => @project.to_xml( :except => :user_id )
                        else
                          render :text => "Error on update: #{@project.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409
                Severity: Minor
                Found in app/controllers/projects_controller.rb and 1 other location - About 30 mins to fix
                app/controllers/contexts_controller.rb on lines 123..128

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

                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

                        format.xml {
                          if @saved
                            render :xml => @context.to_xml( :except => :user_id )
                          else
                            render :text => "Error on update: #{@context.errors.full_messages.inject("") {|v, e| v + e + " " }}", :status => 409
                Severity: Minor
                Found in app/controllers/contexts_controller.rb and 1 other location - About 30 mins to fix
                app/controllers/projects_controller.rb on lines 250..255

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

                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 link_to_delete_context(context, descriptor = sanitize(context.name))
                    link_to(descriptor,
                      context_path(context, :format => 'js'),
                      {
                        :id => "delete_context_#{context.id}",
                Severity: Minor
                Found in app/helpers/contexts_helper.rb and 1 other location - About 25 mins to fix
                app/helpers/projects_helper.rb on lines 18..26

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

                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 link_to_delete_project(project, descriptor = sanitize(project.name))
                    link_to(
                      descriptor,
                      project_path(project, :format => 'js'),
                      {
                Severity: Minor
                Found in app/helpers/projects_helper.rb and 1 other location - About 25 mins to fix
                app/helpers/contexts_helper.rb on lines 3..10

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

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

                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_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 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

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

                Severity
                Category
                Status
                Source
                Language