estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Method column_value has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def column_value(column, project, value)
    case column.name
      when :product_name
        content_tag('td class="text_field_text_overflow exportable"', project.root_component)
      when :title
Severity: Minor
Found in app/helpers/organizations_helper.rb - About 1 hr to fix

    Function _findControlPoint has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        _findControlPoint = function(midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

      Function dispCrossText has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function dispCrossText(ctx, config, posX, posY, borderX, borderY, overlay, data, animPC) {
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

        Function getNodesToHide has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getNodesToHide(node) {
              node = node || this.clickedNode;
              if(!this.config.constrained) {
                return [];
              }
        Severity: Minor
        Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

          Function computeArcThroughTwoPoints has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function computeArcThroughTwoPoints(p1, p2){
                  var aDen = (p1.x * p2.y - p1.y * p2.x), bDen = aDen;
                  var sq1 = p1.squaredNorm(), sq2 = p2.squaredNorm();
                  // Fall back to a straight line
                  if (aDen == 0)
          Severity: Minor
          Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

            Function compute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              compute: function(graph, prop, opt) {
                this.initializeLabel(opt);
                var label = this.label, style = label.style;
                graph.eachNode(function(n) {
                  var autoWidth  = n.getData('autoWidth'),
            Severity: Minor
            Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

              Function preprocessSum has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  preprocessSum: function(graph) {
                      var viz = this.viz;
                      graph.eachNode(function(elem) {
                          if(!viz.graph.hasNode(elem.id)) {
                              viz.graph.addNode(elem);
              Severity: Minor
              Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

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

                        this.draw = function(component, currentConnectionPaintStyle) {
                            var td = _getDimensions();
                            if (td != null && td.length == 2) {
                                var cxy = {x:0,y:0};
                                if (component.pointOnPath) {
                Severity: Minor
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                  Function SvgEndpoint has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var SvgEndpoint = window.SvgEndpoint = function(params) {
                          var self = this,
                              _super = SvgComponent.apply(this, [ {
                                  cssClass:params["_jsPlumb"].endpointClass, 
                                  originalArgs:arguments, 
                  Severity: Minor
                  Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                    Function get_offset has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        fn.get_offset = function(e) {
                            e.preventDefault();
                            var mouse_actual_pos = this.get_mouse_pos(e);
                            var diff_x = Math.round(
                                mouse_actual_pos.left - this.mouse_init_pos.left);
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix

                      Function buildSelect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                          buildSelect = function(i, updating, onlyavail){
                                              var o, t, arry = [], currentVal;
                                              i = parseInt(i, 10);
                                              t = $ths.filter('[data-column="' + i + '"]:last');
                                              // t.data('placeholder') won't work in jQuery older than 1.4.3
                      Severity: Minor
                      Found in app/assets/javascripts/pager.js - About 1 hr to fix

                        Function CanvasRenderingContext2D_ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function CanvasRenderingContext2D_(canvasElement) {
                            this.m_ = createMatrixIdentity();
                        
                            this.mStack_ = [];
                            this.aStack_ = [];
                        Severity: Minor
                        Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 1 hr to fix

                          Method create_inactive_user has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def create_inactive_user
                              #No authorize required since everyone can ask for new account which will be validated by an Admin
                          
                              unless (params[:email].blank? || params[:first_name].blank? || params[:last_name].blank? || params[:login_name].blank?)
                                user = User.where('login_name = ? OR email = ?', params[:login_name], params[:email]).first
                          Severity: Minor
                          Found in app/controllers/users_controller.rb - About 1 hr to fix

                            Method set_technology_size_type_abacus has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def set_technology_size_type_abacus
                                authorize! :edit_organizations, Organization
                            
                                @organization = Organization.find(params[:organization])
                                @technologies = @organization.organization_technologies
                            Severity: Minor
                            Found in app/controllers/organizations_controller.rb - About 1 hr to fix

                              Method pemodule_input has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def pemodule_input(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
                              
                                  est_val_pe_attribute = est_val.pe_attribute
                                  if est_val_pe_attribute.attr_type == 'integer' or est_val_pe_attribute.attr_type == 'float'
                              
                              
                              Severity: Minor
                              Found in app/helpers/projects_helper.rb - About 1 hr to fix

                                Method update_views_and_widgets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def update_views_and_widgets(new_prj, old_mp, new_mp)
                                    #For initialization module level
                                    if old_mp.pemodule.alias == Projestimate::Application::INITIALIZATION
                                      #Copy the views and widgets for the new project
                                      new_view = View.create(organization_id: new_prj.organization_id, name: "#{new_prj.to_s} : view for #{new_mp.to_s}", description: "Please rename the view's name and description if needed.")
                                Severity: Minor
                                Found in app/controllers/projects_controller.rb - About 1 hr to fix

                                  Method destroy has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def destroy
                                      @project = Project.find(params[:id])
                                      authorize! :delete_project, @project
                                  
                                      is_model = @project.is_model
                                  Severity: Minor
                                  Found in app/controllers/projects_controller.rb - About 1 hr to fix

                                    Method customize_admin_setting_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def customize_admin_setting_value
                                        case key
                                          when 'session_maximum_lifetime'
                                            I18n.t('datetime.distance_in_words.x_days', :count => value.to_i)
                                          when 'session_inactivity_timeout'
                                    Severity: Minor
                                    Found in app/models/admin_setting.rb - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def update
                                        self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
                                        prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
                                    
                                        resource_updated = update_resource(resource, account_update_params.merge(password_changed: true))
                                    Severity: Minor
                                    Found in app/controllers/registrations_controller.rb - About 1 hr 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 duplicate_wbs_activity has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def duplicate_wbs_activity
                                        #Update ancestry depth caching
                                        WbsActivityElement.rebuild_depth_cache!
                                    
                                        begin
                                    Severity: Minor
                                    Found in app/controllers/wbs_activities_controller.rb - About 1 hr 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language