crewmate/crewmate

View on GitHub

Showing 358 of 358 total issues

Function Modernizr has 385 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.Modernizr = (function(window,doc,undefined){
    
    var version = '1.5',
    
    ret = {},
Severity: Major
Found in app/javascripts/modernizr.js - About 1 day to fix

    Function Modernizr has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

    window.Modernizr = (function(window,doc,undefined){
        
        var version = '1.5',
        
        ret = {},
    Severity: Minor
    Found in app/javascripts/modernizr.js - About 1 day 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 unserialize_teambox has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

      def unserialize_teambox(dump, object_maps, opts={})
        ActiveRecord::Base.transaction do
          @object_map = {
            'User' => {},
            'Organization' => {}
    Severity: Minor
    Found in app/models/teambox_data/teambox.rb - About 1 day 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 metadata_basecamp has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

      def metadata_basecamp(with_project_data=false)
        firm_members = []
    
        organization_list = ([data['account']['firm']] + data['account']['clients']).map do |firm|
          firm_members += firm['people']
    Severity: Minor
    Found in app/models/teambox_data/basecamp.rb - About 1 day 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

    Date.parseFormattedString = function (string) {
      var regexp = '([0-9]{4})-(([0-9]{1,2})-(([0-9]{1,2})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
      var d = string.match(new RegExp(regexp, "i"));
      if (d==null) return Date.parse(string); // at least give javascript a crack at it.
      var offset = 0;
    Severity: Major
    Found in public/javascripts/calendar_date_select/format_db.js and 1 other location - About 1 day to fix
    public/javascripts/calendar_date_select/format_italian.js on lines 10..24

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

    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

    Date.parseFormattedString = function (string) {
      var regexp = '([0-9]{1,2})/(([0-9]{1,2})/(([0-9]{4})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
      var d = string.match(new RegExp(regexp, "i"));
      if (d==null) return Date.parse(string); // at least give javascript a crack at it.
      var offset = 0;
    Severity: Major
    Found in public/javascripts/calendar_date_select/format_italian.js and 1 other location - About 1 day to fix
    public/javascripts/calendar_date_select/format_db.js on lines 13..27

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

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

    YAHOO.util.Color = new function() {
      
      // Adapted from http://www.easyrgb.com/math.html
      // hsv values = 0 - 1
      // rgb values 0 - 255
    Severity: Minor
    Found in app/javascripts/yahoo.color.js - About 6 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 calendar_date_select.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // CalendarDateSelect version 1.15 - a prototype based date picker
    // Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
    if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
    if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required.  If using earlier version of prototype, please use calendar_date_select version 1.8.3");
    
    
    Severity: Minor
    Found in public/javascripts/calendar_date_select/calendar_date_select.js - About 5 hrs to fix

      Method unserialize_teambox has 136 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def unserialize_teambox(dump, object_maps, opts={})
          ActiveRecord::Base.transaction do
            @object_map = {
              'User' => {},
              'Organization' => {}
      Severity: Major
      Found in app/models/teambox_data/teambox.rb - About 5 hrs to fix

        File modernizr.js has 387 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * Modernizr JavaScript library 1.5
         * http://www.modernizr.com/
         *
         * Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/
        Severity: Minor
        Found in app/javascripts/modernizr.js - About 5 hrs to fix

          Method metadata_basecamp has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def metadata_basecamp(with_project_data=false)
              firm_members = []
          
              organization_list = ([data['account']['firm']] + data['account']['clients']).map do |firm|
                firm_members += firm['people']
          Severity: Major
          Found in app/models/teambox_data/basecamp.rb - About 5 hrs to fix

            Class User has 35 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class User < ActiveRecord::Base
              include Immortal
              include Metadata
              extend Metadata::Defaults
            
            
            Severity: Minor
            Found in app/models/user.rb - About 4 hrs to fix

              prototype has 34 functions (exceeds 20 allowed). Consider refactoring.
              Open

              CalendarDateSelect.prototype = {
                initialize: function(target_element, options) {
                  this.target_element = $(target_element); // make sure it's an element, not a string
                  if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
                  if (this.target_element.tagName != "INPUT") this.target_element = this.target_element.down("INPUT")
              Severity: Minor
              Found in public/javascripts/calendar_date_select/calendar_date_select.js - About 4 hrs to fix

                File task_list.js has 344 lines of code (exceeds 250 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 4 hrs to fix

                  Method new_slot has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def new_slot(insert_id, insert_before, widget)
                       PageSlot.transaction do
                         # Calculate correct position
                         insert_pos = nil
                  
                  
                  Severity: Minor
                  Found in app/models/page.rb - About 4 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

                  Function Color has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  YAHOO.util.Color = new function() {
                    
                    // Adapted from http://www.easyrgb.com/math.html
                    // hsv values = 0 - 1
                    // rgb values 0 - 255
                  Severity: Major
                  Found in app/javascripts/yahoo.color.js - About 4 hrs to fix

                    Method set_page_title has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def set_page_title
                          location_name = "#{params[:action]}_#{params[:controller]}"
                          translate_location_name = t("page_title.#{location_name}", :default => '')
                    
                          if params.has_key?(:id) && ['show_projects','edit_projects'].include?(location_name)
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 4 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

                    Class Task has 31 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Task < RoleRecord
                      include Immortal
                    
                      include Watchable
                    
                    
                    Severity: Minor
                    Found in app/models/task.rb - About 3 hrs to fix

                      Class ApplicationController has 30 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ApplicationController < ActionController::Base
                        helper :all # include all helpers, all the time
                        protect_from_forgery # See ActionController::RequestForgeryProtection for details
                      
                        include AuthenticatedSystem
                      Severity: Minor
                      Found in app/controllers/application_controller.rb - About 3 hrs to fix

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

                        document.on("click", "a.collapsed_mode", function(e,el) {
                          e.stop();
                          ActivityFeed.collapseAll();
                          $$('a.collapsed_mode')[0].up('.el').toggle();
                          $$('a.expanded_mode')[0].up('.el').toggle();
                        Severity: Major
                        Found in app/javascripts/compact_mode.js and 1 other location - About 3 hrs to fix
                        app/javascripts/compact_mode.js on lines 26..32

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

                        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