FanaHOVA/blazer

View on GitHub

Showing 544 of 841 total issues

Function rgb2hsl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function rgb2hsl(rgb) {
  var r = rgb[0]/255,
      g = rgb[1]/255,
      b = rgb[2]/255,
      min = Math.min(r, g, b),
Severity: Minor
Found in app/assets/javascripts/blazer/Chart.js - About 1 hr to fix

    Function updateAttrs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updateAttrs (oldVnode, vnode) {
      if (!oldVnode.data.attrs && !vnode.data.attrs) {
        return
      }
      var key, cur, old;
    Severity: Minor
    Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

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

      module.exports = function(Chart) {
      
          var helpers = Chart.helpers;
      
          Chart.scaleService = {
      Severity: Minor
      Found in app/assets/javascripts/blazer/Chart.js - About 1 hr to fix

        Function renderScatterChart has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                this.renderScatterChart = function (chart) {
                  var options = jsOptions(chart, chart.options);
        
                  var colors = chart.options.colors || defaultColors;
        
        
        Severity: Minor
        Found in app/assets/javascripts/blazer/chartkick.js - About 1 hr to fix

          Function refresh has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            ScrollSpy.prototype.refresh = function () {
              var that          = this
              var offsetMethod  = 'offset'
              var offsetBase    = 0
          
          
          Severity: Minor
          Found in app/assets/javascripts/blazer/bootstrap.js - About 1 hr to fix

            Function next has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function next() {
                  $active
                    .removeClass('active')
                    .find('> .dropdown-menu > .active')
                      .removeClass('active')
            Severity: Minor
            Found in app/assets/javascripts/blazer/bootstrap.js - About 1 hr to fix

              Function preventBackspaceNav has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function preventBackspaceNav() {
                $(document).keydown(function (e) {
                  var preventKeyPress
                  if (e.keyCode == 8) {
                    var d = e.srcElement || e.target
              Severity: Minor
              Found in app/assets/javascripts/blazer/application.js - About 1 hr to fix

                Function hide has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Collapse.prototype.hide = function () {
                    if (this.transitioning || !this.$element.hasClass('in')) return
                
                    var startEvent = $.Event('hide.bs.collapse')
                    this.$element.trigger(startEvent)
                Severity: Minor
                Found in app/assets/javascripts/blazer/bootstrap.js - About 1 hr to fix

                  Function search has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    Sifter.prototype.search = function(query, options) {
                      var self = this, value, score, search, calculateScore;
                      var fn_sort;
                      var fn_score;
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/blazer/selectize.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
                            support.getById && context.nodeType === 9 && documentIsHTML &&
                            Expr.relative[ tokens[1].type ] ) {
                    
                          context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
                    Severity: Major
                    Found in app/assets/javascripts/blazer/jquery.js - About 1 hr to fix

                      Function VNode has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        tag,
                        data,
                        children,
                        text,
                        elm,
                      Severity: Major
                      Found in app/assets/javascripts/blazer/vue.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    else if (floating) {
                                      after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
                                    } else {
                                      after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
                                    }
                        Severity: Major
                        Found in app/assets/javascripts/blazer/Sortable.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if (
                                    (tag === '>*' && el.parentNode === ctx) || (
                                      (tag === '' || el.nodeName.toUpperCase() == tag) &&
                                      (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
                                    )
                          Severity: Major
                          Found in app/assets/javascripts/blazer/Sortable.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                            if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month &&
                                                (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
                                                &&
                                                (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM'))
                                                ) {
                            Severity: Major
                            Found in app/assets/javascripts/blazer/daterangepicker.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if (m._isValid == null) {
                                          m._isValid = !isNaN(m._d.getTime()) &&
                                              m._pf.overflow < 0 &&
                                              !m._pf.empty &&
                                              !m._pf.invalidMonth &&
                              Severity: Major
                              Found in app/assets/javascripts/blazer/moment.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (!HighchartsAdapter && "Highcharts" in window) {
                                      HighchartsAdapter = new function () {
                                        var Highcharts = window.Highcharts;
                                
                                        this.name = "highcharts";
                                Severity: Major
                                Found in app/assets/javascripts/blazer/chartkick.js - About 1 hr to fix

                                  Function jsOptionsFunc has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    function jsOptionsFunc(defaultOptions, hideLegend, setTitle, setMin, setMax, setStacked, setXtitle, setYtitle) {
                                  Severity: Major
                                  Found in app/assets/javascripts/blazer/chartkick.js - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                if (detectType) {
                                                  value = new Date(toFloat(i));
                                                  // TODO make this efficient
                                                  day = day && isDay(value);
                                                  if (!dayOfWeek) {
                                    Severity: Major
                                    Found in app/assets/javascripts/blazer/chartkick.js - About 1 hr to fix

                                      Function fuzzysearch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function fuzzysearch (needle, haystack) {
                                        var hlen = haystack.length;
                                        var nlen = needle.length;
                                        if (nlen > hlen) {
                                          return false;
                                      Severity: Minor
                                      Found in app/assets/javascripts/blazer/fuzzysearch.js - About 55 mins 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 blazer_format_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def blazer_format_value(key, value)
                                            if value.is_a?(Integer) && !key.to_s.end_with?("id") && !key.to_s.start_with?("id")
                                              number_with_delimiter(value)
                                            elsif value =~ BLAZER_URL_REGEX
                                              # see if image or link
                                      Severity: Minor
                                      Found in app/helpers/blazer/base_helper.rb - About 55 mins 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