estimancy/projestimate

View on GitHub

Showing 836 of 1,675 total issues

Function inputToRGB has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function inputToRGB(color) {

        var rgb = { r: 0, g: 0, b: 0 };
        var a = 1;
        var ok = false;
Severity: Minor
Found in app/assets/javascripts/spectrum.js - About 1 hr to fix

    Function drawScale has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function drawScale() {
    
                //X axis line                                                          
    
                ctx.lineWidth = config.scaleLineWidth;
    Severity: Minor
    Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

      Function saveCanvas has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function saveCanvas(ctx,data,config,tpgraph) {
              cvSave = ctx.getImageData(0,0,ctx.canvas.width, ctx.canvas.height);
      
              var saveCanvasConfig = {
                savePng : false,
      Severity: Minor
      Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

        Function drawScale has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function drawScale() {
        
                    //X axis line                                                          
        
                    ctx.lineWidth = config.scaleLineWidth;
        Severity: Minor
        Found in app/assets/javascripts/ChartNew.js - About 1 hr to fix

          Method import_user has 40 lines of code (exceeds 25 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 1 hr to fix

            Method create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                authorize! :manage, User
            
                set_page_title 'New user'
            
            
            Severity: Minor
            Found in app/controllers/users_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 update_selected_attributes has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_selected_attributes
                authorize! :manage_master_data, :all
            
                @pemodule = Pemodule.find(params[:module_id])
            
            
            Severity: Minor
            Found in app/controllers/pemodules_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 display_balancing_output has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def display_balancing_output(module_project)
                #pbs_project_element = @pbs_project_element || @project.root_component
                pbs_project_element = current_component
            
                res = String.new
            Severity: Minor
            Found in app/helpers/projects_helper.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 create_inactive_user has a Cognitive Complexity of 13 (exceeds 5 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

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

              def session_expired?
                unless load_admin_setting('session_maximum_lifetime')=='unset'
                  setting_session_maximum_lifetime = load_admin_setting('session_maximum_lifetime').to_i*60*60*24
                  unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= setting_session_maximum_lifetime)
                    return true
            Severity: Minor
            Found in app/controllers/application_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

            Function bindSearch has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    bindSearch: function(table, $el, internal) {
                        table = $(table)[0];
                        $el = $($el); // allow passing a selector string
                        if (!$el.length) { return; }
                        var c = table.config,
            Severity: Minor
            Found in app/assets/javascripts/tablesorter.min.js - About 1 hr to fix

              Function onPlaceLabel has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    onPlaceLabel: function(domElement, node) {
                      if(!node.getData('prev')) return;
                      var labels = nodeLabels[node.id],
                          wrapperStyle = labels.wrapper.style,
                          labelStyle = labels.label.style,
              Severity: Minor
              Found in app/assets/javascripts/jit-2.0.1.js - About 1 hr to fix

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

                        format: function(table, c, wo) {
                            var $tbody, tbodyIndex, $rows, rows, $row, $cells, remove, indx,
                                $table = c.$table,
                                $tbodies = c.$tbodies,
                                sortList = c.sortList,
                Severity: Minor
                Found in app/assets/javascripts/tablesorter.min.js - About 1 hr to fix

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

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

                    Function paint has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            _super.renderer.paint = function(style, anchor, extents) {
                                
                                var segments = self.getSegments(), p = "", offset = [0,0];            
                                if (extents.xmin < 0) offset[0] = -extents.xmin;
                                if (extents.ymin < 0) offset[1] = -extents.ymin;            
                    Severity: Minor
                    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                      Function paint has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              this.paint = function(params) {
                                  params = params || {};
                                  var timestamp = params.timestamp, recalc = !(params.recalc === false);                                
                                  if (!timestamp || self.timestamp !== timestamp) {                        
                                      var info = _jsPlumb.updateOffset({ elId:_elementId, timestamp:timestamp, recalc:recalc });
                      Severity: Minor
                      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                        Function EventGenerator has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                EventGenerator : function() {
                                    var _listeners = {}, self = this, eventsSuspended = false;
                                    
                                    // this is a list of events that should re-throw any errors that occur during their dispatch. as of 1.3.0 this is private to
                                    // jsPlumb, but it seems feasible that people might want to manipulate this list.  the thinking is that we don't want event
                        Severity: Minor
                        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 1 hr to fix

                          Function appendToTable has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      function appendToTable(table, init) {
                                          var c = table.config,
                                              b = table.tBodies,
                                              rows = [],
                                              c2 = c.cache,
                          Severity: Minor
                          Found in app/assets/javascripts/pager.js - About 1 hr to fix

                            Function applyWidget has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        ts.applyWidget = function(table, init) {
                                            table = $(table)[0]; // in case this is called externally
                                            var c = table.config,
                                                wo = c.widgetOptions,
                                                widgets = [],
                            Severity: Minor
                            Found in app/assets/javascripts/pager.js - About 1 hr to fix

                              Function _traversing_widgets has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  fn._traversing_widgets = function(type, direction, col, row, callback) {
                                      var ga = this.gridmap;
                                      if (!ga[col]) { return; }
                              
                                      var cr, max;
                              Severity: Minor
                              Found in app/assets/javascripts/jquery.gridster.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language