estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

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

  def create
    authorize! :manage_estimation_widgets, @project

    # Add the position_x and position_y to params
    @view_id = params[:views_widget][:view_id]
Severity: Major
Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

    Function placeLabel has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        placeLabel: function(tag, node, controller) {
            var pos = node.pos.getc(true), 
                config = this.viz.config, 
                dim = config.Node, 
                canvas = this.viz.canvas,
    Severity: Major
    Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

      Function buildRow has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              buildRow: function(table, c, wo) {
                  var col, column, $header, buildSelect, disabled, name, ffxn,
                  // c.columns defined in computeThIndexes()
                      columns = c.columns,
                      arry = $.isArray(wo.filter_cellFilter),
      Severity: Major
      Found in app/assets/javascripts/tablesorter.min.js - About 2 hrs to fix

        Function getFilters has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ts.getFilters = function(table, getRaw, setFilters, skipFirst) {
                var i, $filters, $column, cols,
                    filters = false,
                    c = table ? $(table)[0].config : '',
                    wo = c ? c.widgetOptions : '';
        Severity: Major
        Found in app/assets/javascripts/tablesorter.min.js - About 2 hrs to fix

          Function stringInputToObject has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function stringInputToObject(color) {
          
                  color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
                  var named = false;
                  if (names[color]) {
          Severity: Major
          Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

            Function _buildEvents has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _buildEvents: function(){
                        if (this.isInput) { // single input
                            this._events = [
                                [this.element, {
                                    focus: $.proxy(this.show, this),
            Severity: Major
            Found in app/assets/javascripts/bootstrap-datepicker.js - About 2 hrs to fix

              Function getOptionSource has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      getOptionSource: function(table, column, onlyAvail) {
                          var cts,
                              c = table.config,
                              wo = c.widgetOptions,
                              parsed = [],
              Severity: Minor
              Found in app/assets/javascripts/tablesorter.min.js - About 2 hrs to fix

                Function sum has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    sum: function(json, opt) {
                        var viz = this.viz;
                        var options = $.merge(this.options, viz.controller, opt), root = viz.root;
                        var graph;
                        viz.root = opt.id || viz.root;
                Severity: Minor
                Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                  ;(function(f){f.extend({tablesorterPager:new function(){this.defaults={container:null,ajaxUrl:null,customAjaxUrl:function(b,a){return a},ajaxObject:{dataType:"json"},ajaxProcessing:function(){return[0,[],null]},output:"{startRow} to {endRow} of {totalRows} rows",updateArrows:!0,page:0,size:10,fixedHeight:!1,removeRows:!1,cssFirst:".first",cssPrev:".prev",cssNext:".next",cssLast:".last",cssGoto:".gotoPage",cssPageDisplay:".pagedisplay",cssPageSize:".pagesize",cssErrorRow:"tablesorter-errorRow",cssDisabled:"disabled", totalRows:0,totalPages:0,filteredRows:0,filteredPages:0};var t=this,u=function(b,a){var d=b.cssDisabled,e=!!a,c=Math.min(b.totalPages,b.filteredPages);b.updateArrows&&(b.$container.find(b.cssFirst+","+b.cssPrev)[e||0===b.page?"addClass":"removeClass"](d),b.$container.find(b.cssNext+","+b.cssLast)[e||b.page===c-1?"addClass":"removeClass"](d))},q=function(b,a,d){var e,c,g;e=b.config;c=f(b).hasClass("hasFilters")&&!a.ajaxUrl;a.totalPages=Math.ceil(a.totalRows/a.size);a.filteredRows=c?e.$tbodies.eq(0).children("tr:not(."+ (e.widgetOptions&&e.widgetOptions.filter_filteredRow||"filtered")+","+e.selectorRemove+")").length:a.totalRows;a.filteredPages=c?Math.ceil(a.filteredRows/a.size)||1:a.totalPages;if(0<=Math.min(a.totalPages,a.filteredPages)&&(g=a.size*a.page>a.filteredRows,a.startRow=g?1:0===a.filteredRows?0:a.size*a.page+1,a.page=g?0:a.page,a.endRow=Math.min(a.filteredRows,a.totalRows,a.size*(a.page+1)),c=a.$container.find(a.cssPageDisplay),e=a.output.replace(/\{(page|filteredRows|filteredPages|totalPages|startRow|endRow|totalRows)\}/gi, function(b){return{"{page}":a.page+1,"{filteredRows}":a.filteredRows,"{filteredPages}":a.filteredPages,"{totalPages}":a.totalPages,"{startRow}":a.startRow,"{endRow}":a.endRow,"{totalRows}":a.totalRows}[b]}),c.length&&(c["INPUT"===c[0].tagName?"val":"html"](e),a.$goto.length))){g="";c=Math.min(a.totalPages,a.filteredPages);for(e=1;e<=c;e++)g+="<option>"+e+"</option>";a.$goto.html(g).val(a.page+1)}u(a);a.initialized&&!1!==d&&f(b).trigger("pagerComplete",a)},r=function(b,a){var d,e=b.config.$tbodies.eq(0); if(a.fixedHeight&&(e.find("tr.pagerSavedHeightSpacer").remove(),d=f.data(b,"pagerSavedHeight")))d-=e.height(),5<d&&(f.data(b,"pagerLastSize")===a.size&&e.children("tr:visible").length<a.size)&&e.append('<tr class="pagerSavedHeightSpacer '+b.config.selectorRemove.replace(/(tr)?\./g,"")+'" style="height:'+d+'px;"></tr>')},x=function(b,a){var d=b.config.$tbodies.eq(0);d.find("tr.pagerSavedHeightSpacer").remove();f.data(b,"pagerSavedHeight",d.height());r(b,a);f.data(b,"pagerLastSize",a.size)},s=function(b, a){if(!a.ajaxUrl){var d;d=b.config;var e=d.$tbodies.eq(0).children("tr:not(."+d.cssChildRow+")"),c=e.length,f=a.page*a.size,p=f+a.size,k=d.widgetOptions&&d.widgetOptions.filter_filteredRow||"filtered",h=0;for(d=0;d<c;d++)e[d].className.match(k)||(e[d].style.display=h>=f&&h<p?"":"none",h++)}},y=function(b,a){a.size=parseInt(a.$size.val(),10)||a.size;f.data(b,"pagerLastSize",a.size);u(a);a.removeRows||(s(b,a),f(b).bind("sortEnd.pager filterEnd.pager",function(){s(b,a)}))},A=function(b,a,d,e,c){if("function"=== typeof d.ajaxProcessing){var g,p,k,h,l,m=f(a),n=a.config,z=m.find("thead th").length,j="";b=d.ajaxProcessing(b,a)||[0,[]];g=isNaN(b[0])&&!isNaN(b[1]);m.find("thead tr."+d.cssErrorRow).remove();if(c)f('<tr class="'+d.cssErrorRow+'"><td style="text-align:center;" colspan="'+z+'">'+(0===e.status?"Not connected, verify Network":404===e.status?"Requested page not found [404]":500===e.status?"Internal Server Error [500]":"parsererror"===c?"Requested JSON parse failed":"timeout"===c?"Time out error":"abort"=== c?"Ajax Request aborted":"Uncaught error: "+e.statusText+" ["+e.status+"]")+"</td></tr>").click(function(){f(this).remove()}).appendTo(m.find("thead:first")),n.$tbodies.eq(0).empty();else{d.totalRows=b[g?1:0]||d.totalRows||0;e=b[g?0:1]||[];c=e.length;l=b[2];if(e instanceof jQuery)n.$tbodies.eq(0).empty().append(e);else if(e.length){if(0<c)for(b=0;b<c;b++){j+="<tr>";for(g=0;g<e[b].length;g++)j+="<td>"+e[b][g]+"</td>";j+="</tr>"}n.$tbodies.eq(0).html(j)}l&&l.length===z&&(h=(p=m.hasClass("hasStickyHeaders"))? n.$sticky.children("thead:first").children().children():"",k=m.find("tfoot tr:first").children(),m.find("th."+n.cssHeader).each(function(a){var b=f(this),c;b.find("."+n.cssIcon).length?(c=b.find("."+n.cssIcon).clone(!0),b.find(".tablesorter-header-inner").html(l[a]).append(c),p&&h.length&&(c=h.eq(a).find("."+n.cssIcon).clone(!0),h.eq(a).find(".tablesorter-header-inner").html(l[a]).append(c))):(b.find(".tablesorter-header-inner").html(l[a]),p&&h.length&&h.eq(a).find(".tablesorter-header-inner").html(l[a])); k.eq(a).html(l[a])}))}n.showProcessing&&f.tablesorter.isProcessing(a);m.trigger("update");d.totalPages=Math.ceil(d.totalRows/d.size);q(a,d);r(a,d);d.initialized&&m.trigger("pagerChange",d)}d.initialized||(d.initialized=!0,f(a).trigger("pagerInitialized",d))},v=function(b,a,d){d.isDisabled=!1;var e,c,g,j,k=a.length;e=d.page*d.size;var h=e+d.size;if(!(1>k)){d.initialized&&f(b).trigger("pagerChange",d);if(d.removeRows){h>a.length&&(h=a.length);f.tablesorter.clearTableBody(b);for(j=f.tablesorter.processTbody(b, b.config.$tbodies.eq(0),!0);e<h;e++){g=a[e];k=g.length;for(c=0;c<k;c++)j.appendChild(g[c])}f.tablesorter.processTbody(b,j,!1)}else s(b,d);d.page>=d.totalPages&&B(b,d);q(b,d);d.isDisabled||r(b,d);f(b).trigger("applyWidgets")}},C=function(b,a){a.ajax?u(a,!0):(a.isDisabled=!0,f.data(b,"pagerLastPage",a.page),f.data(b,"pagerLastSize",a.size),a.page=0,a.size=a.totalRows,a.totalPages=1,f(b).find("tr.pagerSavedHeightSpacer").remove(),v(b,b.config.rowsCopy,a));a.$size.add(a.$goto).each(function(){f(this).addClass(a.cssDisabled)[0].disabled= !0})},j=function(b,a,d){if(!a.isDisabled){var e=Math.min(a.totalPages,a.filteredPages);0>a.page&&(a.page=0);a.page>e-1&&0!==e&&(a.page=e-1);if(a.ajax){var c,e=a.ajaxUrl?a.ajaxUrl.replace(/\{page([\-+]\d+)?\}/,function(b,c){return a.page+(c?parseInt(c,10):0)}).replace(/\{size\}/g,a.size):"",g=b.config.sortList,j=a.currentFilters||[],k=e.match(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/),h=e.match(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/),l=[];k&&(k=k[1],f.each(g,function(a,b){l.push(k+"["+b[0]+"]="+b[1])}), e=e.replace(/\{\s*sort(?:List)?\s*:\s*(\w*)\s*\}/g,l.length?l.join("&"):k),l=[]);h&&(h=h[1],f.each(j,function(a,b){b&&l.push(h+"["+a+"]="+encodeURIComponent(b))}),e=e.replace(/\{\s*filter(?:List)?\s*:\s*(\w*)\s*\}/g,l.length?l.join("&"):h));"function"===typeof a.customAjaxUrl&&(e=a.customAjaxUrl(b,e));c=e;var m=f(document),e=b.config;""!==c&&(e.showProcessing&&f.tablesorter.isProcessing(b,!0),m.bind("ajaxError.pager",function(d,e,f,g){c.match(f.url)&&(A(null,b,a,e,g),m.unbind("ajaxError.pager"))}), a.ajaxObject.url=c,a.ajaxObject.success=function(c){A(c,b,a);m.unbind("ajaxError.pager");"function"===typeof a.oldAjaxSuccess&&a.oldAjaxSuccess(c)},f.ajax(a.ajaxObject))}else a.ajax||v(b,b.config.rowsCopy,a);f.data(b,"pagerLastPage",a.page);f.data(b,"pagerUpdateTriggered",!0);a.initialized&&!1!==d&&f(b).trigger("pageMoved",a)}},w=function(b,a,d){d.size=a;d.$size.val(a);f.data(b,"pagerLastPage",d.page);f.data(b,"pagerLastSize",d.size);d.totalPages=Math.ceil(d.totalRows/d.size);j(b,d)},E=function(b, a){a.page=0;j(b,a)},B=function(b,a){a.page=Math.min(a.totalPages,a.filteredPages)-1;j(b,a)},F=function(b,a){a.page++;a.page>=Math.min(a.totalPages,a.filteredPages)-1&&(a.page=Math.min(a.totalPages,a.filteredPages)-1);j(b,a)},G=function(b,a){a.page--;0>=a.page&&(a.page=0);j(b,a)},D=function(b,a,d){var e=a.$size.removeClass(a.cssDisabled).removeAttr("disabled");a.$goto.removeClass(a.cssDisabled).removeAttr("disabled");a.isDisabled=!1;a.page=f.data(b,"pagerLastPage")||a.page||0;a.size=f.data(b,"pagerLastSize")|| parseInt(e.find("option[selected]").val(),10)||a.size;e.val(a.size);a.totalPages=Math.ceil(Math.min(a.totalPages,a.filteredPages)/a.size);d&&(f(b).trigger("update"),w(b,a.size,a),y(b,a),r(b,a))};t.appender=function(b,a){var d=b.config.pager;d.ajax||(b.config.rowsCopy=a,d.totalRows=a.length,d.size=f.data(b,"pagerLastSize")||d.size,d.totalPages=Math.ceil(d.totalRows/d.size),v(b,a,d))};t.construct=function(b){return this.each(function(){if(this.config&&this.hasInitialized){var a,d,e=this.config,c=e.pager= f.extend({},f.tablesorterPager.defaults,b),g=this,p=g.config,k=f(g),h=c.$container=f(c.container).addClass("tablesorter-pager").show();c.oldAjaxSuccess=c.oldAjaxSuccess||c.ajaxObject.success;e.appender=t.appender;k.unbind("filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager").bind("filterStart.pager",function(a,b){f.data(g,"pagerUpdateTriggered",!1);c.currentFilters=b}).bind("filterEnd.pager sortEnd.pager",function(){f.data(g,"pagerUpdateTriggered")? f.data(g,"pagerUpdateTriggered",!1):(j(g,c,!1),q(g,c,!1),r(g,c))}).bind("disable.pager",function(a){a.stopPropagation();C(g,c)}).bind("enable.pager",function(a){a.stopPropagation();D(g,c,!0)}).bind("destroy.pager",function(a){a.stopPropagation();C(g,c);c.$container.hide();g.config.appender=null;f(g).unbind("destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager")}).bind("update.pager",function(a){a.stopPropagation();s(g,c)}).bind("pageSize.pager",function(a,b){a.stopPropagation(); w(g,parseInt(b,10)||10,c);s(g,c);q(g,c,!1);c.$size.length&&c.$size.val(c.size)}).bind("pageSet.pager",function(a,b){a.stopPropagation();c.page=(parseInt(b,10)||1)-1;c.$goto.length&&c.$goto.val(c.size);j(g,c);q(g,c,!1)});a=[c.cssFirst,c.cssPrev,c.cssNext,c.cssLast];d=[E,G,F,B];h.find(a.join(",")).unbind("click.pager").bind("click.pager",function(){var b,e=f(this),h=a.length;if(!e.hasClass(c.cssDisabled))for(b=0;b<h;b++)if(e.is(a[b])){d[b](g,c);break}return!1});c.$goto=h.find(c.cssGoto);c.$goto.length&& (c.$goto.unbind("change").bind("change",function(){c.page=f(this).val()-1;j(g,c)}),q(g,c,!1));c.$size=h.find(c.cssPageSize);c.$size.length&&c.$size.unbind("change.pager").bind("change.pager",function(){c.$size.val(f(this).val());f(this).hasClass(c.cssDisabled)||(w(g,parseInt(f(this).val(),10),c),x(g,c));return!1});c.initialized=!1;k.trigger("pagerBeforeInitialized",c);D(g,c,!1);"string"===typeof c.ajaxUrl?(c.ajax=!0,p.widgetOptions.filter_serversideFiltering=!0,p.serverSideSorting=!0,j(g,c)):(c.ajax= !1,f(this).trigger("appendCache",!0),y(g,c));x(g,c);c.ajax||(c.initialized=!0,f(g).trigger("pagerInitialized",c))}})}}});f.fn.extend({tablesorterPager:f.tablesorterPager.construct})})(jQuery);
                  Severity: Critical
                  Found in app/assets/javascripts/pager.js - About 2 hrs to fix

                    Function format has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            format: function(table, c, wo){
                                var $tb, $tr, $td, $t, time, last, rmv, i, k, l,
                                    $tbl = c.$table,
                                    b = c.$tbodies,
                                    list = c.sortList,
                    Severity: Minor
                    Found in app/assets/javascripts/pager.js - About 2 hrs to fix

                      Method send_feedback has 16 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def send_feedback(user, type, feedback_message, latest_repo_update, projestimate_version, ruby_version, rails_version, environment, database_adapter, browser, version_browser, platform, os, server_name, root_url, status)
                      Severity: Major
                      Found in app/mailers/user_mailer.rb - About 2 hrs to fix

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

                          initialize: function(controller) {
                            var $Sunburst = $jit.Sunburst;
                        
                            var config = {
                              interpolation: 'linear',
                        Severity: Minor
                        Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                          Function computePositionStep has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            computePositionStep: function(property, opt) {
                              var graph = this.graph;
                              var min = Math.min, max = Math.max;
                              var dpos = $C(0, 0);
                              //calculate repulsive forces
                          Severity: Minor
                          Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                            Function loadJSON has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              loadJSON: function(json) {
                                var prefix = $.time(), 
                                    ch = [], 
                                    delegate = this.delegate,
                                    name = $.splat(json.label), 
                            Severity: Minor
                            Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                              Function perpendicular has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                                  perpendicular : function(axis, ss, oss, es, oes) {
                                                      with (paintInfo) {
                                                          var sis = {
                                                              x:[ [ [ 1,2,3,4 ], null, [ 2,1,4,3 ] ], null, [ [ 4,3,2,1 ], null, [ 3,4,1,2 ] ] ],
                                                              y:[ [ [ 3,2,1,4 ], null, [ 2,3,4,1 ] ], null, [ [ 4,1,2,3 ], null, [ 1,4,3,2 ] ] ]
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                                Function buildCache has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            function buildCache(table) {
                                                var b = table.tBodies,
                                                    tc = table.config,
                                                    totalRows,
                                                    totalCells,
                                Severity: Minor
                                Found in app/assets/javascripts/pager.js - About 1 hr to fix

                                  Method display_inputs_without_activities has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def display_inputs_without_activities(module_project)
                                      pbs_project_element = current_component
                                      res = String.new
                                  
                                      if module_project.compatible_with(current_component.work_element_type.alias) || current_component
                                  Severity: Minor
                                  Found in app/helpers/projects_helper.rb - About 1 hr to fix

                                    Function loadJSON has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      loadJSON: function(json) {
                                        var prefix = $.time(), 
                                            ch = [], 
                                            delegate = this.delegate,
                                            name = $.splat(json.label),
                                    Severity: Minor
                                    Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

                                      Function Anchor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          jsPlumb.Anchor = function(params) {
                                              var self = this;
                                              this.x = params.x || 0;
                                              this.y = params.y || 0;
                                              this.elementId = params.elementId;        
                                      Severity: Minor
                                      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                                        Function _process_options has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                _process_options: function(opts){
                                                    // Store raw options for reference
                                                    this._o = $.extend({}, this._o, opts);
                                                    // Processed options
                                                    var o = this.o = $.extend({}, this._o);
                                        Severity: Minor
                                        Found in app/assets/javascripts/bootstrap-datepicker.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language