opsforgeio/cabot

View on GitHub

Showing 1,637 of 1,637 total issues

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

  function d3_time_parseWeekNumberMonday(date, string, i) {
    d3_time_numberRe.lastIndex = 0;
    var n = d3_time_numberRe.exec(string.substring(i));
    return n ? (date.W = +n[0], i + n[0].length) : -1;
  }
Severity: Major
Found in cabot/static/arachnys/js/d3.js and 1 other location - About 2 hrs to fix
cabot/static/arachnys/js/d3.js on lines 2659..2663

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

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

@login_required
def remove_acknowledgement(request, pk):
    service = Service.objects.get(pk=pk)
    service.remove_acknowledgement(user=request.user)
    return HttpResponseRedirect(reverse('service', kwargs={'pk': pk}))
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 2 hrs to fix
cabot/cabotapp/views.py on lines 689..693

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

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

        self.snapshot = ServiceStatusSnapshot(
            service=self,
            num_checks_active=self.active_status_checks().count(),
            num_checks_passing=self.active_status_checks(
            ).count() - status_checks_failed_count,
Severity: Major
Found in cabot/cabotapp/models.py and 1 other location - About 2 hrs to fix
cabot/cabotapp/models.py on lines 317..324

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

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

@login_required
def acknowledge_alert(request, pk):
    service = Service.objects.get(pk=pk)
    service.acknowledge_alert(user=request.user)
    return HttpResponseRedirect(reverse('service', kwargs={'pk': pk}))
Severity: Major
Found in cabot/cabotapp/views.py and 1 other location - About 2 hrs to fix
cabot/cabotapp/views.py on lines 696..700

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

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

        self.snapshot = InstanceStatusSnapshot(
            instance=self,
            num_checks_active=self.active_status_checks().count(),
            num_checks_passing=self.active_status_checks(
            ).count() - status_checks_failed_count,
Severity: Major
Found in cabot/cabotapp/models.py and 1 other location - About 2 hrs to fix
cabot/cabotapp/models.py on lines 268..275

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

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

        getCurrentRegionTooltip: function () {
            var options = this.options,
                header = '',
                entries = [],
                fields, formats, formatlen, fclass, text, i,
Severity: Major
Found in cabot/static/theme/js/jquery.sparkline.min.js - About 2 hrs to fix

    Function d3_layout_packSiblings has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function d3_layout_packSiblings(node) {
        if (!(nodes = node.children) || !(n = nodes.length)) return;
        var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
        function bound(node) {
          xMin = Math.min(node.x - node.r, xMin);
    Severity: Major
    Found in cabot/static/arachnys/js/d3.js - About 2 hrs to fix

      Function _showDatepicker has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _showDatepicker: function(input) {
              input = input.target || input;
              if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
                  input = $("input", input.parentNode)[0];
              }
      Severity: Major
      Found in cabot/static/theme/js/jquery-ui.js - About 2 hrs to fix

        Function nest has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          d3.nest = function() {
            var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
            function map(mapType, array, depth) {
              if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
              var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
        Severity: Major
        Found in cabot/static/arachnys/js/d3.js - About 2 hrs to fix

          Function _run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def _run(self):
                  result = StatusCheckResult(check=self)
                  try:
                      status = get_job_status(self.name)
                      active = status['active']
          Severity: Minor
          Found in cabot/cabotapp/models.py - 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 drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              drag: function(event, ui) {
          
                  var ts, bs, ls, rs, l, r, t, b, i, first,
                      inst = $(this).data("ui-draggable"),
                      o = inst.options,
          Severity: Major
          Found in cabot/static/theme/js/jquery-ui.js - About 2 hrs to fix

            Function drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                drag: function(event, ui) {
            
                    var inst = $(this).data("ui-draggable"), that = this;
            
                    $.each(inst.sortables, function() {
            Severity: Major
            Found in cabot/static/theme/js/jquery-ui.js - About 2 hrs to fix

              Function _fnDrawHead has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function _fnDrawHead( oSettings, aoSource, bIncludeHidden )
                  {
                    var i, iLen, j, jLen, k, kLen, n, nLocalTr;
                    var aoLocal = [];
                    var aApplied = [];
              Severity: Major
              Found in cabot/static/theme/js/jquery.dataTables.min.js - About 2 hrs to fix

                Function _fnFeatureHtmlLength has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function _fnFeatureHtmlLength ( oSettings )
                    {
                      if ( oSettings.oScroll.bInfinite )
                      {
                        return null;
                Severity: Major
                Found in cabot/static/theme/js/jquery.dataTables.min.js - About 2 hrs to fix

                  Function attr has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      elproto.attr = function (name, value) {
                          if (this.removed) {
                              return this;
                          }
                          if (name == null) {
                  Severity: Major
                  Found in cabot/static/arachnys/js/raphael.js - About 2 hrs to fix

                    Function Deferred has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Deferred: function( func ) {
                        var tuples = [
                            // action, add listener, listener list, final state
                            [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                            [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
                    Severity: Major
                    Found in cabot/static/bootstrap/js/jquery-1.10.2.js - About 2 hrs to fix

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

                            return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor);
                      Severity: Major
                      Found in cabot/static/arachnys/js/morris.js and 2 other locations - About 2 hrs to fix
                      cabot/static/arachnys/js/morris.js on lines 504..504
                      cabot/static/arachnys/js/morris.js on lines 1500..1500

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

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

                            return label = this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor);
                      Severity: Major
                      Found in cabot/static/arachnys/js/morris.js and 2 other locations - About 2 hrs to fix
                      cabot/static/arachnys/js/morris.js on lines 504..504
                      cabot/static/arachnys/js/morris.js on lines 1029..1029

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

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

                            return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor).attr('text-anchor', 'end');
                      Severity: Major
                      Found in cabot/static/arachnys/js/morris.js and 2 other locations - About 2 hrs to fix
                      cabot/static/arachnys/js/morris.js on lines 1029..1029
                      cabot/static/arachnys/js/morris.js on lines 1500..1500

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

                      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

                                  if (!event.metaKey && !event.ctrlKey) {
                                      selectee.$element.removeClass("ui-selected");
                                      selectee.selected = false;
                                      selectee.$element.addClass("ui-unselecting");
                                      selectee.unselecting = true;
                      Severity: Major
                      Found in cabot/static/theme/js/jquery-ui.js and 1 other location - About 2 hrs to fix
                      cabot/static/theme/js/jquery-ui.js on lines 3450..3460

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

                      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