opsforgeio/cabot

View on GitHub

Showing 1,637 of 1,637 total issues

Function Annotate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

Rickshaw.Graph.Annotate = function(args) {

  var graph = this.graph = args.graph;
  this.elements = { timeline: args.element };

Severity: Minor
Found in cabot/static/arachnys/js/rickshaw.js - 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 forwards has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def forwards(self, orm):
        """
        Plugin Data migrations are done in 0010. This will test that the
        migrations passed correctly.
        """
Severity: Minor
Found in cabot/cabotapp/migrations/0011_plugin_data_migration_tests.py - 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if self.request.GET.get('service'):
            return reverse('service', kwargs={'pk': self.request.GET.get('service')})
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 1 hr to fix
cabot/cabotapp/views.py on lines 431..432

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 39.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if self.request.GET.get('instance'):
            return reverse('instance', kwargs={'pk': self.request.GET.get('instance')})
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 1 hr to fix
cabot/cabotapp/views.py on lines 429..430

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 39.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function updatePosition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        updatePosition: function (x, y) {
            if (x === undefined) {
                if (this.mousex === undefined) {
                    return;
                }
Severity: Minor
Found in cabot/static/theme/js/jquery.sparkline.min.js - About 1 hr to fix

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

        refresh: function() {
            //See #8237 & #8828
            var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
    
            if ( isDisabled !== this.options.disabled ) {
    Severity: Minor
    Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

      Function stop has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          stop: function( event ) {
              var that = $(this).data("ui-resizable"),
                  o = that.options,
                  pr = that._proportionallyResizeElements,
                  ista = pr.length && (/textarea/i).test(pr[0].nodeName),
      Severity: Minor
      Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

        Function _updateVirtualBoundaries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _updateVirtualBoundaries: function(forceAspectRatio) {
                var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
                    o = this.options;
        
                b = {
        Severity: Minor
        Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

          Function left has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  left: function( position, data ) {
                      var within = data.within,
                          withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                          outerWidth = within.width,
                          collisionPosLeft = position.left - data.collisionPosition.marginLeft,
          Severity: Minor
          Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

            Function _setupHeightStyle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _setupHeightStyle: function( heightStyle ) {
                    var maxHeight,
                        parent = this.element.parent();
            
                    if ( heightStyle === "fill" ) {
            Severity: Minor
            Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

              Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getDimensions( elem ) {
                  var raw = elem[0];
                  if ( raw.nodeType === 9 ) {
                      return {
                          width: elem.width(),
              Severity: Minor
              Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                Function _fnGetCellData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function _fnGetCellData( oSettings, iRow, iCol, sSpecific )
                    {
                      var sData;
                      var oCol = oSettings.aoColumns[iCol];
                      var oData = oSettings.aoData[iRow]._aData;
                Severity: Minor
                Found in cabot/static/theme/js/jquery.dataTables.min.js - About 1 hr to fix

                  Function top has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          top: function( position, data ) {
                              var within = data.within,
                                  withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
                                  outerHeight = data.within.height,
                                  collisionPosTop = position.top - data.collisionPosition.marginTop,
                  Severity: Minor
                  Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                    Function setData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            var setData = function (data, val, src) {
                              var a = src.split('.'), b;
                              var arrayNotation, o, innerSrc;
                    
                              for ( var i=0, iLen=a.length-1 ; i<iLen ; i++ )
                    Severity: Minor
                    Found in cabot/static/theme/js/jquery.dataTables.min.js - About 1 hr to fix

                      Function getDimensions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getDimensions( elem ) {
                          var raw = elem[0];
                          if ( raw.nodeType === 9 ) {
                              return {
                                  width: elem.width(),
                      Severity: Minor
                      Found in cabot/static/theme/js/jquery.ui.position.js - About 1 hr to fix

                        Function top has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                top: function( position, data ) {
                                    var within = data.within,
                                        withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
                                        outerHeight = data.within.height,
                                        collisionPosTop = position.top - data.collisionPosition.marginTop,
                        Severity: Minor
                        Found in cabot/static/theme/js/jquery.ui.position.js - About 1 hr to fix

                          Function _getContainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              R._getContainer = function (x, y, w, h) {
                                  var container;
                                  container = h == null && !R.is(x, "object") ? g.doc.getElementById(x) : x;
                                  if (container == null) {
                                      return;
                          Severity: Minor
                          Found in cabot/static/arachnys/js/raphael.js - About 1 hr to fix

                            Function left has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    left: function( position, data ) {
                                        var within = data.within,
                                            withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                                            outerWidth = within.width,
                                            collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                            Severity: Minor
                            Found in cabot/static/theme/js/jquery.ui.position.js - About 1 hr to fix

                              Function d3_geom_voronoi has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function d3_geom_voronoi(sites, bbox) {
                                  var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;
                                  d3_geom_voronoiEdges = [];
                                  d3_geom_voronoiCells = new Array(sites.length);
                                  d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();
                              Severity: Minor
                              Found in cabot/static/arachnys/js/d3.js - About 1 hr to fix

                                Function drawXAxis has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    Bar.prototype.drawXAxis = function() {
                                      var i, label, labelBox, margin, offset, prevAngleMargin, prevLabelMargin, row, textBox, ypos, _i, _ref, _results;
                                      ypos = this.bottom + this.options.padding / 2;
                                      prevLabelMargin = null;
                                      prevAngleMargin = null;
                                Severity: Minor
                                Found in cabot/static/arachnys/js/morris.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language