JumpstartLab/tracks

View on GitHub

Showing 244 of 244 total issues

Method postTodo has a Cognitive Complexity of 24 (exceeds 5 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 3 hrs 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

File projects_controller.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ProjectsController < ApplicationController

  helper :application, :todos, :notes
  before_filter :set_source_view
  before_filter :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
Severity: Minor
Found in app/controllers/projects_controller.rb - About 3 hrs to fix

    Method from_rich_message has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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 23 (exceeds 5 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 3 hrs 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

        if(defaultTags[$(this).val()] !== undefined) {
            var tag_list = $(this).parents('form').find('input[name=tag_list]');
            if(tag_list.attr('edited') === undefined){
                tag_list.val(defaultTags[$(this).val()]);
            }
    Severity: Major
    Found in app/assets/javascripts/tracks.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/tracks.js on lines 1247..1252

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

    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

            if(defaultContexts[$(this).val()] !== undefined) {
                var context_name = $(this).parents('form').find('input[name=context_name]');
                if(context_name.attr('edited') === undefined){
                    context_name.val(defaultContexts[$(this).val()]);
                }
    Severity: Major
    Found in app/assets/javascripts/tracks.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/tracks.js on lines 1254..1259

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

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

      def create_multiple
        if project_specified_by_name(params[:project_name])
          project = current_user.projects.where(:name => params[:project_name]).first_or_create
          @new_project_created = project.new_record_before_save?
          @project_id = project.id
    Severity: Major
    Found in app/controllers/todos_controller.rb - About 3 hrs to fix

      Method yaml_import has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def yaml_import
          @errmessage = ''
          @inarray = YAML::load(params['import']['yaml'])
          # arrays to handle id translations
      
      
      Severity: Major
      Found in app/controllers/data_controller.rb - About 3 hrs to fix

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

            setup_behavior: function() {
              /* add new recurring todo plus-button in sidebar */
              $(document).on("click","#add-new-recurring-todo", function(){
                $( "#new-recurring-todo" ).dialog( "open" );
              });
        Severity: Major
        Found in app/assets/javascripts/tracks.js - About 2 hrs to fix

          Method run has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def run(args)
                @parser.parse!(args)
                # lines = STDIN.read
                gtd = API.new
          
          
          Severity: Major
          Found in doc/tracks_template_cli.rb - About 2 hrs to fix

            Method project_and_context_links has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def project_and_context_links(todo, parent_container_type, opts = {})
                str = ''
                if todo.completed?
                  str += todo.context.name unless opts[:suppress_context]
                  should_suppress_project = opts[:suppress_project] || todo.project.nil?
            Severity: Minor
            Found in app/helpers/todos_helper.rb - About 2 hrs 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 destroy has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def destroy
                @source_view = params['_source_view'] || 'todo'
                @todo = current_user.todos.find(params['id'])
                @original_item_due = @todo.due
                @context_id = @todo.context_id
            Severity: Minor
            Found in app/controllers/todos_controller.rb - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                template = ""
            
                params['project'] ||= {}
                if params['project']['state']
            Severity: Minor
            Found in app/controllers/projects_controller.rb - About 2 hrs 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 included has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.included(klass)
                klass.class_eval do
            
                  # Add tags associations
                  has_many :taggings, :as => :taggable
            Severity: Major
            Found in lib/is_taggable.rb - About 2 hrs to fix

              Method update has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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_for_next_todo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def check_for_next_todo(todo)
                  # check if this todo has a related recurring_todo. If so, create next todo
                  new_recurring_todo = nil
                  recurring_todo = nil
                  if todo.from_recurring_todo?
              Severity: Minor
              Found in app/controllers/todos_controller.rb - About 2 hrs 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 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create
                  if params['exception']
                    render_failure "Expected post format is valid xml like so: <user><login>username</login><password>abc123</password></user>."
                    return
                  end
              Severity: Major
              Found in app/controllers/users_controller.rb - About 2 hrs to fix

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

                        $(document).on("click",'a.delete_project_button', function(evt){
                            var confirm_message = $(this).attr("x_confirm_message")
                            if(confirm(confirm_message)){
                                delete_with_ajax_and_block_element(this.href, $(this).parents('.project'));
                            }
                Severity: Major
                Found in app/assets/javascripts/tracks.js and 3 other locations - About 2 hrs to fix
                app/assets/javascripts/tracks.js on lines 543..549
                app/assets/javascripts/tracks.js on lines 707..713
                app/assets/javascripts/tracks.js on lines 823..829

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

                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 4 locations. Consider refactoring.
                Open

                        $(document).on("click",'.alphabetize_link', function(evt) {
                            var confirm_message = $(this).attr("x_confirm_message")
                            if(confirm(confirm_message)){
                                post_with_ajax_and_block_element(this.href, $(this).parents('.alpha_sort'));
                            }
                Severity: Major
                Found in app/assets/javascripts/tracks.js and 3 other locations - About 2 hrs to fix
                app/assets/javascripts/tracks.js on lines 543..549
                app/assets/javascripts/tracks.js on lines 725..731
                app/assets/javascripts/tracks.js on lines 823..829

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

                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 4 locations. Consider refactoring.
                Open

                        $(document).on("click",'a.delete_context_button', function(evt){
                            var confirm_message = $(this).attr("x_confirm_message")
                            if(confirm(confirm_message)){
                                delete_with_ajax_and_block_element(this.href, $(this).parents('.context'));
                            }
                Severity: Major
                Found in app/assets/javascripts/tracks.js and 3 other locations - About 2 hrs to fix
                app/assets/javascripts/tracks.js on lines 543..549
                app/assets/javascripts/tracks.js on lines 707..713
                app/assets/javascripts/tracks.js on lines 725..731

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

                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