opsforgeio/cabot

View on GitHub

Showing 1,637 of 1,637 total issues

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

class ServiceUpdateView(LoginRequiredMixin, UpdateView):
    model = Service
    form_class = ServiceForm

    def get_success_url(self):
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 1 hr to fix
cabot/cabotapp/views.py on lines 713..718

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

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

    for alert in service.alerts.all():
        try:
            alert.send_alert(service, users, duty_officers)
        except Exception as e:
            logging.exception('Could not send %s alert: %s' % (alert.name, e))
Severity: Major
Found in cabot/cabotapp/alert.py and 1 other location - About 1 hr to fix
cabot/cabotapp/alert.py on lines 48..52

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

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 hasattr(alert, 'send_alert_update'):
            try:
                alert.send_alert_update(service, users, duty_officers)
            except Exception as e:
                logger.exception('Could not send %s alert update: %s' % (alert.name, e))
Severity: Major
Found in cabot/cabotapp/alert.py and 1 other location - About 1 hr to fix
cabot/cabotapp/alert.py on lines 38..42

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

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

class InstanceUpdateView(LoginRequiredMixin, UpdateView):
    model = Instance
    form_class = InstanceForm

    def get_success_url(self):
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 1 hr to fix
cabot/cabotapp/views.py on lines 721..726

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

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

    transition: function( other, distance ) {
        var end = color( other ),
            spaceName = end._space(),
            space = spaces[ spaceName ],
            startColor = this.alpha() === 0 ? color( "transparent" ) : this,
Severity: Minor
Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

    Function _drop has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _drop: function(event,custom) {
    
            var draggable = custom || $.ui.ddmanager.current,
                childrenIntersection = false;
    
    
    Severity: Minor
    Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

      Function _updateDatepicker has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _updateDatepicker: function(inst) {
              this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
              instActive = inst; // for delegate hover events
              inst.dpDiv.empty().append(this._generateHTML(inst));
              this._attachHandlers(inst);
      Severity: Minor
      Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

        Function getTagSetting has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                getTagSetting: function (key) {
                    var prefix = this.tagOptionsPrefix,
                        val, i, pairs, keyval;
                    if (prefix === false || prefix === undefined) {
                        return UNSET_OPTION;
        Severity: Minor
        Found in cabot/static/theme/js/jquery.sparkline.min.js - About 1 hr to fix

          Function _destroy has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _destroy: function() {
                  // Destroy (sub)menus
                  this.element
                      .removeAttr( "aria-activedescendant" )
                      .find( ".ui-menu" ).addBack()
          Severity: Minor
          Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

            Function _setOption has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _setOption: function( key, value ) {
                    if ( key === "culture" || key === "numberFormat" ) {
                        var prevValue = this._parse( this.element.val() );
                        this.options[ key ] = value;
                        this.element.val( this._format( prevValue ) );
            Severity: Minor
            Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

              Function complete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      complete: function() {
                          if ( el.to.opacity === 0 ) {
                              el.css( "opacity", el.from.opacity );
                          }
                          if( mode === "hide" ) {
              Severity: Minor
              Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                Function _createRange has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _createRange: function() {
                        var options = this.options,
                            classes = "";
                
                        if ( options.range ) {
                Severity: Minor
                Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                  Function _fnFilterComplete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function _fnFilterComplete ( oSettings, oInput, iForce )
                      {
                        var oPrevSearch = oSettings.oPreviousSearch;
                        var aoPrevSearch = oSettings.aoPreSearchCols;
                        var fnSaveFilter = function ( oFilter ) {
                  Severity: Minor
                  Found in cabot/static/theme/js/jquery.dataTables.min.js - About 1 hr to fix

                    Function _refresh has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _refresh: function() {
                            this._setupDisabled( this.options.disabled );
                            this._setupEvents( this.options.event );
                            this._setupHeightStyle( this.options.heightStyle );
                    
                    
                    Severity: Minor
                    Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                      Function _refreshValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _refreshValue: function() {
                              var value = this.options.value,
                                  percentage = this._percentage();
                      
                              this.valueDiv
                      Severity: Minor
                      Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                        Function _initialActive has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _initialActive: function() {
                                var active = this.options.active,
                                    collapsible = this.options.collapsible,
                                    locationHash = location.hash.substring( 1 );
                        
                        
                        Severity: Minor
                        Found in cabot/static/theme/js/jquery-ui.js - About 1 hr to fix

                          Function setViewBox has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              R._engine.setViewBox = function (x, y, w, h, fit) {
                                  eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]);
                                  var size = mmax(w / this.width, h / this.height),
                                      top = this.top,
                                      aspectRatio = fit ? "meet" : "xMinYMin",
                          Severity: Minor
                          Found in cabot/static/arachnys/js/raphael.js - About 1 hr to fix

                            Function listeners has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                eve.listeners = function (name) {
                                    var names = name.split(separator),
                                        e = events,
                                        item,
                                        items,
                            Severity: Minor
                            Found in cabot/static/arachnys/js/raphael.js - About 1 hr to fix

                              Function d3_scale_quantize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function d3_scale_quantize(x0, x1, range) {
                                  var kx, i;
                                  function scale(x) {
                                    return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
                                  }
                              Severity: Minor
                              Found in cabot/static/arachnys/js/d3.js - About 1 hr to fix

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

                                  removeClass: function( value ) {
                                    var classes, elem, cur, clazz, j,
                                      i = 0,
                                      len = this.length,
                                      proceed = arguments.length === 0 || typeof value === "string" && value;
                                Severity: Minor
                                Found in cabot/static/bootstrap/js/jquery-1.10.2.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language