YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/resources/debugbar/logs.js

Summary

Maintainability
F
1 wk
Test Coverage

File logs.js has 513 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function ($) {
    var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');

    /**
     * Replaces spaces with &nbsp; and line breaks with <br>
Severity: Major
Found in public_html/layouts/resources/debugbar/logs.js - About 1 day to fix

    Function render has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            render: function () {
                this.bindAttr('data', function (data) {
                    // ported from php DataFormatter
                    var formatDuration = function (seconds) {
                        if (seconds < 0.001) return (seconds * 1000000).toFixed() + 'μs';
    Severity: Major
    Found in public_html/layouts/resources/debugbar/logs.js - About 4 hrs to fix

      Function render has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              render: function () {
                  var self = this;
      
                  this.$list = new ListWidget({
                      itemRenderer: function (li, value) {
      Severity: Major
      Found in public_html/layouts/resources/debugbar/logs.js - About 3 hrs to fix

        Function render has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                render: function () {
                    var self = this;
        
                    this.$list = new ListWidget({
                        itemRenderer: function (li, value) {
        Severity: Major
        Found in public_html/layouts/resources/debugbar/logs.js - About 3 hrs to fix

          Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  render: function () {
                      this.$list = new ListWidget({
                          itemRenderer: function (li, e) {
                              $('<span />').addClass(csscls('message')).text(e.message).appendTo(li);
                              if (e.file) {
          Severity: Major
          Found in public_html/layouts/resources/debugbar/logs.js - About 2 hrs to fix

            Function itemRenderer has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            itemRenderer: function (li, e) {
                                $('<span />').addClass(csscls('message')).text(e.message).appendTo(li);
                                if (e.file) {
                                    var header = $('<span />')
                                        .addClass(csscls('filename'))
            Severity: Minor
            Found in public_html/layouts/resources/debugbar/logs.js - About 1 hr to fix

              Function createCodeBlock has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var createCodeBlock = (PhpDebugBar.Widgets.createCodeBlock = function (code, lang, firstLineNumber, highlightedLine) {
                      var pre = $('<pre />').addClass(csscls('code-block'));
                      // Add a newline to prevent <code> element from vertically collapsing too far if the last
                      // code line was empty: that creates problems with the horizontal scrollbar being
                      // incorrectly positioned - most noticeable when line numbers are shown.
              Severity: Minor
              Found in public_html/layouts/resources/debugbar/logs.js - About 1 hr to fix

                Function itemRenderer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                itemRenderer: function (li, value) {
                                    if (value.message_html) {
                                        var val = $('<span />').addClass(csscls('value')).html(value.message_html).appendTo(li);
                                    } else {
                                        var m = value.message;
                Severity: Minor
                Found in public_html/layouts/resources/debugbar/logs.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (typeof measure.params[key] !== 'function') {
                                                      table.append(
                                                          '<tr><td class="' +
                                                              csscls('name') +
                                                              '">' +
                  Severity: Major
                  Found in public_html/layouts/resources/debugbar/logs.js - About 45 mins to fix

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

                                this.bindAttr(['exclude', 'search'], function () {
                                    var data = this.get('data'),
                                        exclude = this.get('exclude'),
                                        search = this.get('search'),
                                        caseless = false,
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 day to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 370..393

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

                    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

                                this.bindAttr(['exclude', 'search'], function () {
                                    var data = this.get('data'),
                                        exclude = this.get('exclude'),
                                        search = this.get('search'),
                                        caseless = false,
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 day to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 681..704

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

                    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

                                this.bindAttr('data', function (data) {
                                    this.set({ exclude: [], search: '' });
                                    this.$toolbar.find(csscls('.filter')).remove();
                    
                                    var filters = [],
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 day to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 348..368

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

                    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

                                this.bindAttr('data', function (data) {
                                    this.set({ exclude: [], search: '' });
                                    this.$toolbar.find(csscls('.filter')).remove();
                    
                                    var filters = [],
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 day to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 659..679

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

                    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

                            onFilterClick: function (el) {
                                $(el).toggleClass(csscls('excluded'));
                    
                                var excludedLabels = [];
                                this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function () {
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 3 hrs to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 396..405

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

                    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

                            onFilterClick: function (el) {
                                $(el).toggleClass(csscls('excluded'));
                    
                                var excludedLabels = [];
                                this.$toolbar.find(csscls('.filter') + csscls('.excluded')).each(function () {
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 3 hrs to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 706..715

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

                    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 (value.label) {
                                            val.addClass(csscls(value.label));
                                            $('<span />').addClass(csscls('label')).text(value.label).prependTo(li);
                                        }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 hr to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 638..641

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

                    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 (value.label) {
                                            val.addClass(csscls(value.label));
                                            $('<span />').addClass(csscls('label')).text(value.label).appendTo(li);
                                        }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 1 other location - About 1 hr to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 330..333

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

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

                                        if (value.collector) {
                                            $('<span />').addClass(csscls('collector')).text(value.collector).appendTo(li);
                                        }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 3 other locations - About 45 mins to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 327..329
                    public_html/layouts/resources/debugbar/logs.js on lines 461..463
                    public_html/layouts/resources/debugbar/logs.js on lines 585..587

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

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

                                        if (e.type) {
                                            $('<span />').addClass(csscls('type')).text(e.type).appendTo(li);
                                        }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 3 other locations - About 45 mins to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 327..329
                    public_html/layouts/resources/debugbar/logs.js on lines 461..463
                    public_html/layouts/resources/debugbar/logs.js on lines 642..644

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

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

                                        if (value.collector) {
                                            $('<span />').addClass(csscls('collector')).text(value.collector).prependTo(li);
                                        }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 3 other locations - About 45 mins to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 461..463
                    public_html/layouts/resources/debugbar/logs.js on lines 585..587
                    public_html/layouts/resources/debugbar/logs.js on lines 642..644

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

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

                                            if (measure.collector) {
                                                $('<span />').addClass(csscls('collector')).text(measure.collector).appendTo(m);
                                            }
                    Severity: Major
                    Found in public_html/layouts/resources/debugbar/logs.js and 3 other locations - About 45 mins to fix
                    public_html/layouts/resources/debugbar/logs.js on lines 327..329
                    public_html/layouts/resources/debugbar/logs.js on lines 585..587
                    public_html/layouts/resources/debugbar/logs.js on lines 642..644

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status