estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

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

    initialize: function(viz, opt) {
      this.viz = viz;
      this.opt = this.config = opt;
      var id = $.type(opt.injectInto) == 'string'? 
          opt.injectInto:opt.injectInto.id,
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

    Function Bar has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.Bar = function (data, options) {
            chart.Bar.defaults = {
                      inGraphDataShow: false,
                      inGraphDataPaddingX: 0,
                      inGraphDataPaddingY: 3,
    Severity: Major
    Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

      Function mouseDownListener has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          var mouseDownListener = function(e) {
      
                              // if disabled, return.
                              if (!_sourcesEnabled[idToRegisterAgainst]) return;
                              
      Severity: Major
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

        Function HorizontalStackedBar has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.HorizontalStackedBar = function (data, options) {
        
                chart.HorizontalStackedBar.defaults = {
                          inGraphDataShow: false,
                          inGraphDataPaddingX: -3,
        Severity: Major
        Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

          Function HorizontalBar has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.HorizontalBar = function (data, options) {
                  chart.HorizontalBar.defaults = {
                            inGraphDataShow: false,
                            inGraphDataPaddingX: 3,
                            inGraphDataPaddingY: 0,
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

            Function StackedBar has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.StackedBar = function (data, options) {
            
                    chart.StackedBar.defaults = {
                              inGraphDataShow: false,
                              inGraphDataPaddingX: 0,
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

              Method update has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def update
                  authorize! :manage_estimation_widgets, @project
              
                  @views_widget = ViewsWidget.find(params[:id])
                  @view_id = @views_widget.view_id
              Severity: Major
              Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

                Function render has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    'render': function(from, to, r, canvas){
                      var ctx = canvas.getCtx();  
                      var centerOfCircle = computeArcThroughTwoPoints(from, to);
                      if (centerOfCircle.a > 1000 || centerOfCircle.b > 1000
                          || centerOfCircle.ratio < 0) {
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

                  Function draw has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          this.draw = function(component, currentConnectionPaintStyle) {
                  
                              var hxy, mid, txy, tail, cxy;
                              if (component.pointAlongPathFrom) {
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

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

                            format: function(table, c, wo){
                                var time, klass, $el, $tar,
                                    t = ts.themes,
                                    $t = c.$table,
                                    theme = c.theme !== 'default' ? c.theme : wo.uitheme || 'jui',
                    Severity: Major
                    Found in app/assets/javascripts/pager.js - About 2 hrs to fix

                      Function calculateDrawingSizes has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              function calculateDrawingSizes() {
                                  var midX, mxlb,maxL,maxR,iter,nbiter,prevMaxSize,prevMidX;                        
                      
                                  var rotationDegree = (2 * Math.PI) / data.datasets[0].data.length;
                                  var rotateAngle=config.startAngle*Math.PI/180;
                      Severity: Major
                      Found in app/assets/javascripts/ChartNew.js - About 2 hrs to fix

                        File users_controller.rb has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        class UsersController < ApplicationController
                          require 'securerandom'
                        
                          #before_filter :verify_authentication, :except => [:show, :create_inactive_user]
                          before_filter :load_data, :only => [:update, :edit, :new, :create, :create_inactive_user]
                        Severity: Minor
                        Found in app/controllers/users_controller.rb - About 2 hrs to fix

                          Method import has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def self.import(file, sep, encoding)
                              sep = "#{sep.blank? ? I18n.t(:general_csv_separator) : sep}"
                              error_count = 0
                              CSV.open(file.path, 'r', :quote_char => "\"", :row_sep => :auto, :col_sep => sep, :encoding => "#{encoding}:utf-8") do |csv|
                                csv.each_with_index do |row, i|
                          Severity: Minor
                          Found in app/models/wbs_activity_ratio.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 can_do_action_on_estimation? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def can_do_action_on_estimation?(estimation, project_permission_action_alias)
                              can_do_something = false
                          
                              # SuperAdmin user or those who has all permissions has all rights
                              if current_user.super_admin? || can?(:manage, :all)
                          Severity: Minor
                          Found in app/helpers/projects_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 import_user has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def import_user
                              sep = "#{params[:separator].blank? ? I18n.t(:general_csv_separator) : params[:separator]}"
                              error_count = 0
                              file = params[:file]
                              encoding = params[:encoding]
                          Severity: Minor
                          Found in app/controllers/organizations_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 compute_component_estimation_value has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def compute_component_estimation_value(component, pe_attribute_id, level_estimation_value, wbs_project_elt_root=nil)
                              #No authorize required since this method is private and won't be call from any route
                              component_children_results_array = Array.new
                              new_effort_person_hour = Hash.new
                              pe_attribute = PeAttribute.find(pe_attribute_id)
                          Severity: Minor
                          Found in app/workers/estimations_worker.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

                          Function computePositions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            computePositions : function(property, getLength) {
                              var propArray = property;
                              var graph = this.graph;
                              var root = graph.getNode(this.root);
                              var parent = this.parent;
                          Severity: Major
                          Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

                            Function svg has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                var SvgConnector = jsPlumb.ConnectorRenderers.svg = function(params) {
                                    var self = this,
                                        _super = SvgComponent.apply(this, [ { 
                                            cssClass:params["_jsPlumb"].connectorClass, 
                                            originalArgs:arguments, 
                            Severity: Major
                            Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

                              Function updateUI has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function updateUI() {
                              
                                          textInput.removeClass("sp-validation-error");
                              
                                          updateHelperLocations();
                              Severity: Major
                              Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

                                Function construct has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                            ts.construct = function(settings) {
                                                return this.each(function() {
                                                    // if no thead or tbody, or tablesorter is already present, quit
                                                    if (!this.tHead || this.tBodies.length === 0 || this.hasInitialized === true) {
                                                        return (this.config && this.config.debug) ? log('stopping initialization! No thead, tbody or tablesorter has already been initialized') : '';
                                Severity: Major
                                Found in app/assets/javascripts/pager.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language