opsforgeio/cabot

View on GitHub

Showing 1,637 of 1,637 total issues

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

    service_set = forms.ModelMultipleChoiceField(
        queryset=Service.objects.all(),
        required=False,
        help_text='Link to service(s).',
        widget=forms.SelectMultiple(
Severity: Major
Found in cabot/cabotapp/views.py and 2 other locations - About 1 hr to fix
cabot/cabotapp/views.py on lines 139..146
cabot/cabotapp/views.py on lines 250..257

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 42.

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 3 locations. Consider refactoring.
Open

    instance_set = forms.ModelMultipleChoiceField(
        queryset=Instance.objects.all(),
        required=False,
        help_text='Link to instance(s).',
        widget=forms.SelectMultiple(
Severity: Major
Found in cabot/cabotapp/views.py and 2 other locations - About 1 hr to fix
cabot/cabotapp/views.py on lines 127..134
cabot/cabotapp/views.py on lines 250..257

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 42.

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 3 locations. Consider refactoring.
Open

        if instance_id:
            try:
                instance = Instance.objects.get(id=instance_id)
                initial['instance_set'] = [instance]
            except Instance.DoesNotExist:
Severity: Major
Found in cabot/cabotapp/views.py and 2 other locations - About 1 hr to fix
cabot/cabotapp/views.py on lines 412..416
cabot/cabotapp/views.py on lines 679..683

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 42.

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 3 locations. Consider refactoring.
Open

        if service_id:
            try:
                service = Service.objects.get(id=service_id)
                initial['service_set'] = [service]
            except Service.DoesNotExist:
Severity: Major
Found in cabot/cabotapp/views.py and 2 other locations - About 1 hr to fix
cabot/cabotapp/views.py on lines 419..423
cabot/cabotapp/views.py on lines 679..683

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 42.

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 _drawPieSlice has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {
            var vpath, startx, starty, endx, endy, stroke, fill, vel;
            if (startAngle === endAngle) {
                return '';  // VML seems to have problem when start angle equals end angle.
            }
Severity: Minor
Found in cabot/static/theme/js/jquery.sparkline.min.js - About 1 hr to fix

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

        AbstractChosen.prototype.keyup_checker = function(evt) {
          var stroke, _ref;
    
          stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
          this.search_field_scale();
    Severity: Minor
    Found in cabot/static/theme/js/chosen.jquery.js - About 1 hr to fix

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

      $.ui.intersect = function(draggable, droppable, toleranceMode) {
      
          if (!droppable.offset) {
              return false;
          }
      Severity: Minor
      Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

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

            _keydown: function( event ) {
                /*jshint maxcomplexity:15*/
                if ( event.altKey || event.ctrlKey ) {
                    return;
                }
        Severity: Minor
        Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

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

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

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

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

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

                  var toHex = function (color) {
                      if (R.vml) {
                          // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/
                          var trim = /^\s+|\s+$/g;
                          var bod;
              Severity: Minor
              Found in cabot/static/arachnys/js/raphael.js - About 1 hr to fix

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

                    Line.createPath = function(coords, smooth, bottom) {
                      var coord, g, grads, i, ix, lg, path, prevCoord, x1, x2, y1, y2, _i, _len;
                      path = "";
                      if (smooth) {
                        grads = Morris.Line.gradients(coords);
                Severity: Minor
                Found in cabot/static/arachnys/js/morris.js - About 1 hr to fix

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

                      albersUsa.stream = function(stream) {
                        var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream);
                        return {
                          point: function(x, y) {
                            lower48Stream.point(x, y);
                  Severity: Minor
                  Found in cabot/static/arachnys/js/d3.js - About 1 hr to fix

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

                      function d3_scale_quantile(domain, range) {
                        var thresholds;
                        function rescale() {
                          var k = 0, q = range.length;
                          thresholds = [];
                    Severity: Minor
                    Found in cabot/static/arachnys/js/d3.js - About 1 hr to fix

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

                        this.addHighlightEvents = function (l) {
                      
                          l.element.addEventListener( 'mouseover', function(e) {
                      
                            if (activeLine) return;
                      Severity: Minor
                      Found in cabot/static/arachnys/js/rickshaw.js - About 1 hr to fix

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

                          initialize: function (data, palette, options) {
                        
                            options = options || {};
                        
                            if (typeof(options.timeInterval) === 'undefined') {
                        Severity: Minor
                        Found in cabot/static/arachnys/js/rickshaw.js - About 1 hr to fix

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

                            Tooltip.prototype.applyPlacement = function(offset, placement) {
                              var replace
                              var $tip   = this.tip()
                              var width  = $tip[0].offsetWidth
                              var height = $tip[0].offsetHeight
                          Severity: Minor
                          Found in cabot/static/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                                MultiPolygon: function(object, listener) {
                                  var coordinates = object.coordinates, i = -1, n = coordinates.length;
                                  while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
                                },
                            Severity: Major
                            Found in cabot/static/arachnys/js/d3.js and 1 other location - About 1 hr to fix
                            cabot/static/arachnys/js/d3.js on lines 2829..2832

                            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 61.

                            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

                                        || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x)
                            Severity: Major
                            Found in cabot/static/arachnys/js/raphael.js and 1 other location - About 1 hr to fix
                            cabot/static/arachnys/js/raphael.js on lines 1087..1087

                            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 61.

                            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

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

                                setTimeout(function () {
                                  state == 'loadingText' ?
                                    $el.addClass(d).attr(d, d) :
                                    $el.removeClass(d).removeAttr(d)
                                }, 0)
                            Severity: Major
                            Found in cabot/static/theme/js/bootstrap.js and 1 other location - About 1 hr to fix
                            cabot/static/bootstrap/js/bootstrap.js on lines 147..151

                            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 61.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language