crewmate/crewmate

View on GitHub

Showing 358 of 358 total issues

Function initialize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initialize : function(field, options) {
    var colorPicker = this;
    Control.colorPickers.push(colorPicker);
    this.field = $(field);
    this.fieldName = this.field.name || this.field.id;
Severity: Major
Found in app/javascripts/colorPicker.js - About 2 hrs to fix

    Method task_classes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def task_classes(task)
        [].tap do |classes|
          classes << 'due_today' if task.due_today?
          classes << 'due_tomorrow' if task.due_tomorrow?
          classes << 'due_week' if task.due_in?(1.weeks)
    Severity: Minor
    Found in app/helpers/tasks_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 api_wrap has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def api_wrap(object, options={})
        objects = if object.respond_to? :each
          object.map{|o| o.to_api_hash(options) }
        else
          object.to_api_hash(options)
    Severity: Minor
    Found in app/controllers/api_v1/api_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 callback has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def callback
        provider = params[:provider]
        begin
          auth_hash = params[:auth] || symbolize_keys(request.env["omniauth.auth"])
          AppLink.find_by_provider_and_app_user_id_and_user_id(provider, auth_hash[:uid], nil).try(:destroy)
    Severity: Minor
    Found in app/controllers/auth_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

    File task_lists_helper.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module TaskListsHelper
    
      def filter_task_lists(project=nil)
        render 'task_lists/filter', :project => project
      end
    Severity: Minor
    Found in app/helpers/task_lists_helper.rb - About 2 hrs to fix

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

          this.next_month_button = header_div.build("a", { innerHTML: "&gt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() + 1 ); return false; }.bindAsEventListener(this), className: "next" });
      public/javascripts/calendar_date_select/calendar_date_select.js on lines 150..150

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

      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

          this.prev_month_button = header_div.build("a", { innerHTML: "&lt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() - 1 ); return false; }.bindAsEventListener(this), className: "prev" });
      public/javascripts/calendar_date_select/calendar_date_select.js on lines 149..149

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

      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

      Hours has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      var Hours = {
        initFromJSON: function(hours_data) {
          Hours.init(hours_data.start)
          Hours.addHours(hours_data.hours)
          Hours.userMap = hours_data.userMap
      Severity: Minor
      Found in app/javascripts/hours.js - About 2 hrs to fix

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

        document.on('click', '#people form a[href="#cancel"]', function(e, link) {
          e.preventDefault()
          var parent = link.up('.person')
          parent.down('.edit_person').hide()
          parent.down('.person_header').show()
        Severity: Major
        Found in app/javascripts/person.js and 1 other location - About 2 hrs to fix
        app/javascripts/person.js on lines 3..8

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

        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', '#people a[href="#edit"]', function(e, link) {
          e.preventDefault()
          var parent = link.up('.person')
          parent.down('.edit_person').forceShow()
          parent.down('.person_header').hide()
        Severity: Major
        Found in app/javascripts/person.js and 1 other location - About 2 hrs to fix
        app/javascripts/person.js on lines 10..15

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

        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 updateSelectedDate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          updateSelectedDate:function(partsOrElement, via_click) {
            var parts = $H(partsOrElement);
            if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
            if (parts.get("day")) {
              var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
        Severity: Minor
        Found in public/javascripts/calendar_date_select/calendar_date_select.js - 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 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            if can? :update, @task
              can? :update, @task
              @task.updating_user = current_user
              success = @task.update_attributes params[:task]
        Severity: Minor
        Found in app/controllers/tasks_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

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

        document.on('ajax:failure', 'form.new_task.app_form', function(e, form) {
          var message = $H(e.memo.responseJSON)
            message.each( function(error) {
                form.down('div.text_field').insertOrUpdate('p.error', error.value)
            })
        Severity: Major
        Found in app/javascripts/task.js and 1 other location - About 2 hrs to fix
        app/javascripts/comment.js on lines 115..120

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

        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('ajax:failure', 'form.new_conversation, .thread form:not(.not-new-comment)', function(e, form) {
          var message = $H(e.memo.responseJSON)
            message.each( function(error) {
                form.down('div.text_area').insertOrUpdate('p.error', error.value)
            })
        Severity: Major
        Found in app/javascripts/comment.js and 1 other location - About 2 hrs to fix
        app/javascripts/task.js on lines 21..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 79.

        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

        File calendars_helper.rb has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module CalendarsHelper
        
          def list_hour_filters(project)
            render 'hours/filter'
          end
        Severity: Minor
        Found in app/helpers/calendars_helper.rb - About 2 hrs to fix

          TaskList has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          var TaskList = {
            in_sort: false,
            
            sortableChange: function(draggable) {
              this.currentDraggable = draggable
          Severity: Minor
          Found in app/javascripts/task_list.js - About 2 hrs to fix

            Class Emailer has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Emailer < ActionMailer::Base
              include ActionView::Helpers::TextHelper
              include Emailer::Incoming
            
              helper :application
            Severity: Minor
            Found in app/models/emailer.rb - About 2 hrs to fix

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

                hideTasks: function(by, filter) {
                  $$("table.task_list div.task" + by).each(function(e){
                    if (filter == null || e.hasClassName(filter))
                      e.hide();
                    else
              Severity: Major
              Found in app/javascripts/filter.js and 1 other location - About 2 hrs to fix
              app/javascripts/filter.js on lines 29..36

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

              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

                showTasks: function(by, filter) {
                  $$(".tasks div.task."+by).each(function(e){
                    if (filter == null || e.hasClassName(filter))
                      e.show();
                    else
              Severity: Major
              Found in app/javascripts/filter.js and 1 other location - About 2 hrs to fix
              app/javascripts/filter.js on lines 42..49

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

              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 (this.showWeekends) {
                    $$('.cal_wd' + this.weekends[0] + ', .cal_wd' + this.weekends[1]).each(function(e) {e.show();})
                    $('calendar').removeClassName('calendar5')
                  } else {
              Severity: Major
              Found in app/javascripts/hours.js and 1 other location - About 2 hrs to fix
              app/javascripts/hours.js on lines 248..251

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

              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