FanaHOVA/blazer

View on GitHub

Showing 544 of 841 total issues

Consider simplifying this complex logical expression.
Open

                if (dsMeta.bar && this.chart.isDatasetVisible(j) &&
                    (yScale.options.stacked === false ||
                    (yScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) ||
                    (yScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) {
                    stacks.push(dsMeta.stack);
Severity: Critical
Found in app/assets/javascripts/blazer/Chart.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

          if (e.type && e.type.toLowerCase() === 'keydown') {
            keyCode = e.keyCode;
            printable = (
              (keyCode >= 97 && keyCode <= 122) || // a-z
              (keyCode >= 65 && keyCode <= 90)  || // A-Z
    Severity: Critical
    Found in app/assets/javascripts/blazer/selectize.js - About 1 hr to fix

      Function mergeOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function mergeOptions (
        parent,
        child,
        vm
      ) {
      Severity: Minor
      Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

        Function parseEndTag has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function parseEndTag (tag, tagName, start, end) {
            var pos;
            if (start == null) { start = index; }
            if (end == null) { end = index; }
        
        
        Severity: Minor
        Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

          Function exports has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(Chart) {
          
              var defaultConfig = {
                  hover: {
                      mode: 'single'
          Severity: Minor
          Found in app/assets/javascripts/blazer/Chart.js - About 1 hr to fix

            Function Watcher has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Watcher = function Watcher (
              vm,
              expOrFn,
              cb,
              options
            Severity: Minor
            Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

              Function monthOrYearChanged has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      monthOrYearChanged: function(e) {
                          var isLeft = $(e.target).closest('.calendar').hasClass('left'),
                              leftOrRight = isLeft ? 'left' : 'right',
                              cal = this.container.find('.calendar.'+leftOrRight);
              
              
              Severity: Minor
              Found in app/assets/javascripts/blazer/daterangepicker.js - About 1 hr to fix

                Function jsOptionsFunc has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
                    return function (chart, opts, chartOptions) {
                      var series = chart.data;
                      var options = merge({}, defaultOptions);
                      options = merge(options, chartOptions || {});
                Severity: Minor
                Found in app/assets/javascripts/blazer/chartkick.js - About 1 hr to fix

                  Function addClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    addClass: function( value ) {
                      var classes, elem, cur, clazz, j, finalValue,
                        i = 0,
                        len = this.length,
                        proceed = typeof value === "string" && value;
                  Severity: Minor
                  Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                    Function fixCloneNodeIssues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function fixCloneNodeIssues( src, dest ) {
                      var nodeName, e, data;
                    
                      // We do not need to do anything for non-Elements
                      if ( dest.nodeType !== 1 ) {
                    Severity: Minor
                    Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                      Function load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      jQuery.fn.load = function( url, params, callback ) {
                        if ( typeof url !== "string" && _load ) {
                          return _load.apply( this, arguments );
                        }
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                        Function removeClass has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          removeClass: function( value ) {
                            var classes, elem, cur, clazz, j, finalValue,
                              i = 0,
                              len = this.length,
                              proceed = arguments.length === 0 || typeof value === "string" && value;
                        Severity: Minor
                        Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                          Function data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            data: function( key, value ) {
                              var i, name, data,
                                elem = this[0],
                                attrs = elem && elem.attributes;
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                            Function normalizeChildren has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function normalizeChildren (
                              children,
                              ns,
                              nestedIndex
                            ) {
                            Severity: Minor
                            Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

                              Function stateMixin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function stateMixin (Vue) {
                                // flow somehow has problems with directly declared definition object
                                // when using Object.defineProperty, so we have to procedurally build up
                                // the object here.
                                var dataDef = {};
                              Severity: Minor
                              Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

                                Function initCanvas has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function initCanvas(canvas, config) {
                                        var style = canvas.style;
                                
                                        // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
                                        // returns null or '' if no explicit value has been set to the canvas attribute.
                                Severity: Minor
                                Found in app/assets/javascripts/blazer/Chart.js - About 1 hr to fix

                                  Method anomaly? has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def anomaly?(series)
                                        series = series.reject { |v| v[0].nil? }.sort_by { |v| v[0] }
                                  
                                        csv_str =
                                          CSV.generate do |csv|
                                  Severity: Minor
                                  Found in lib/blazer/result.rb - About 1 hr to fix

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

                                        render: function(templateName, data) {
                                          var value, id, label;
                                          var html = '';
                                          var cache = false;
                                          var self = this;
                                    Severity: Minor
                                    Found in app/assets/javascripts/blazer/selectize.js - About 1 hr to fix

                                      Method home has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def home
                                            if params[:filter] == "dashboards"
                                              @queries = []
                                            else
                                              set_queries(1000)
                                      Severity: Minor
                                      Found in app/controllers/blazer/queries_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_dashboard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                            def update_dashboard(dashboard)
                                              dashboard.assign_attributes(dashboard_params)
                                              Blazer::Dashboard.transaction do
                                                if params[:query_ids].is_a?(Array)
                                                  query_ids = params[:query_ids].map(&:to_i)
                                      Severity: Minor
                                      Found in app/controllers/blazer/dashboards_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