sodabrew/puppet-dashboard

View on GitHub

Showing 290 of 682 total issues

Method inspector_table has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def inspector_table(collection, key=nil, value=nil, options={})
    key, options = nil, key if key.is_a?(Hash)
    unless collection.is_a?(Hash)
      key ||= :name
      value = :description if value.nil?
Severity: Minor
Found in app/helpers/application_helper.rb - About 3 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 destroy_helper has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy_helper(options)
    klass = options[:class]
    owner_klass = options[:owner_class]
    conflict_attribute = options[:conflict_attribute]
    index_redirect = options[:index_redirect]
Severity: Minor
Found in app/helpers/conflict_html.rb - About 3 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 computeHermiteSmoothedData has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function computeHermiteSmoothedData (gd) {
        var smooth = this.renderer.smooth;
        var tension = this.renderer.tension;
        var dim = this.canvas.getWidth();
        var xp = this._xaxis.series_p2u;
Severity: Major
Found in app/assets/javascripts/jquery.jqplot.js - About 3 hrs to fix

    Function drawShadow has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options, plot) {
            var i;
            var opts = (options != undefined) ? options : {};
            var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
            var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
    Severity: Major
    Found in app/assets/javascripts/jqplot.barRenderer.js - About 3 hrs to fix

      Function _create has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            _create: function() {
              var self = this,
                select = this.element.hide(),
                selected = select.children( ":selected" ),
                value = selected.val() ? selected.text() : "";
      Severity: Major
      Found in app/assets/javascripts/jquery.ui.combobox.js - About 3 hrs to fix

        Function computeConstrainedSmoothedData has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function computeConstrainedSmoothedData (gd) {
                var smooth = this.renderer.smooth;
                var dim = this.canvas.getWidth();
                var xp = this._xaxis.series_p2u;
                var yp = this._yaxis.series_p2u; 
        Severity: Major
        Found in app/assets/javascripts/jquery.jqplot.js - About 3 hrs to fix

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

            def create
              ActiveRecord::Base.transaction do
                related_resources = []
                node_ids = node_group_params[:assigned_node_ids]
                unless node_ids.nil?
          Severity: Minor
          Found in app/controllers/node_groups_controller.rb - About 3 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 setGridData has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.jqplot.LineRenderer.prototype.setGridData = function(plot) {
                  // recalculate the grid data
                  var xp = this._xaxis.series_u2p;
                  var yp = this._yaxis.series_u2p;
                  var data = this._plotData;
          Severity: Major
          Found in app/assets/javascripts/jquery.jqplot.js - About 3 hrs to fix

            File jqplot.highlighter.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * jqPlot
             * Pure JavaScript plotting plugin using jQuery
             *
             * Version: 1.0.8
            Severity: Minor
            Found in app/assets/javascripts/jqplot.highlighter.js - About 2 hrs to fix

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

                  $.jqplot.PointLabels.draw = function (sctx, options, plot) {
                      var p = this.plugins.pointLabels;
                      // set labels again in case they have changed.
                      p.setLabels.call(this);
                      // remove any previous labels
              Severity: Major
              Found in app/assets/javascripts/jqplot.pointLabels.js - About 2 hrs to fix

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

                    $.jqplot.ShapeRenderer.prototype.draw = function(ctx, points, options) {
                        ctx.save();
                        var opts = (options != null) ? options : {};
                        var fill = (opts.fill != null) ? opts.fill : this.fill;
                        var closePath = (opts.closePath != null) ? opts.closePath : this.closePath;
                Severity: Major
                Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix

                  Function LinearTickGenerator has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      $.jqplot.LinearTickGenerator = function(axis_min, axis_max, scalefact, numberTicks, keepMin, keepMax) {
                          // Set to preserve EITHER min OR max.
                          // If min is preserved, max must be free.
                          keepMin = (keepMin === null) ? false : keepMin;
                          keepMax = (keepMax === null || keepMin) ? false : keepMax;
                  Severity: Major
                  Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix

                    Class Node has 25 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Node < ApplicationRecord
                      def self.per_page; SETTINGS.nodes_per_page end # Pagination
                    
                      include NodeGroupGraph
                      extend FindFromForm
                    Severity: Minor
                    Found in app/models/node.rb - About 2 hrs to fix

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

                          $.jqplot.TableLegendRenderer.prototype.draw = function() {
                              if (this._elem) {
                                  this._elem.emptyForce();
                                  this._elem = null;
                              }
                      Severity: Major
                      Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix

                        File dashboard.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        var UNRESPONSIVE = '#888';
                        var FAILED       = '#c21';
                        var PENDING      = '#e72';
                        var CHANGED      = '#069';
                        var UNCHANGED    = '#093';
                        Severity: Minor
                        Found in app/assets/javascripts/dashboard.js - About 2 hrs to fix

                          Function makeGridData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              $.jqplot.LineRenderer.prototype.makeGridData = function(data, plot) {
                                  // recalculate the grid data
                                  var xp = this._xaxis.series_u2p;
                                  var yp = this._yaxis.series_u2p;
                                  var gd = [];
                          Severity: Major
                          Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix

                            Function createDate has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                jsDate.createDate = function(date) {
                                    // if passing in multiple arguments, try Date constructor
                                    if (date == null) {
                                        return new Date();
                                    }
                            Severity: Major
                            Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix

                              Function position has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  publicMethod.position = function (speed, loadedCallback) {
                                      var
                                      css,
                                      top = 0,
                                      left = 0,
                              Severity: Major
                              Found in app/assets/javascripts/jquery.colorbox.js - About 2 hrs to fix

                                Method compile_class_parameters has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def compile_class_parameters(class_membership, allow_conflicts=false)
                                    if @compiled_class_parameters.nil?
                                      @compiled_class_parameters = {}
                                    end
                                
                                
                                Severity: Minor
                                Found in lib/node_group_graph.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 quickInit has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        this.quickInit = function () {
                                            // Plot should be visible and have a height and width.
                                            // If plot doesn't have height and width for some
                                            // reason, set it by other means.  Plot must not have
                                            // a display:none attribute, however.
                                Severity: Major
                                Found in app/assets/javascripts/jquery.jqplot.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language