Showing 132 of 132 total issues

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

function Events$init() {
    ComponentFacet.prototype.init.apply(this, arguments);

    var domEventsSource = new DOMEventsSource(this, undefined, undefined, this.owner);
    this._setMessageSource(domEventsSource);
Severity: Major
Found in lib/components/c_facets/Events.js and 1 other location - About 1 hr to fix
lib/components/c_facets/Frame.js on lines 88..95

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

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

function request(url, opts, callback) {
    var abort;

    opts.url = url;
    opts.contentType = opts.contentType || 'application/json;charset=UTF-8';
Severity: Minor
Found in lib/util/request.js - About 1 hr to fix

    Function _onReady has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function _onReady(eventType, req, callback, resolve, reject) {
        if (req.readyState != 4) return;
        if (req[config.request.completedKey]) return;
    
        _.spliceItem(_pendingRequests, req);
    Severity: Minor
    Found in lib/util/request.js - About 1 hr to fix

      Function Drop$isDropAllowed has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Drop$isDropAllowed(dt, originalDropComponent) {
          var allow = this.config.allow;
      
          if (dt.isComponent()) {
              var allowComps = allow && allow.components
      Severity: Minor
      Found in lib/components/c_facets/Drop.js - About 1 hr to fix

        Function send has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        function send(data) {
            var self = this;
            this.data = data;
            var url = this.url;
            var methodRoutes = _mock_routes && _mock_routes[this.method.toUpperCase()] || {};
        Severity: Minor
        Found in mocks/xmlhttprequest.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

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

        _.extend(request, {
            get: request$get,
            post: request$post,
            put: request$put,
            delete: request$delete,
        Severity: Major
        Found in lib/util/request.js and 2 other locations - About 1 hr to fix
        lib/command/transaction_history.js on lines 25..37
        lib/components/c_facets/Container.js on lines 33..45

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

        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

        _.extendProto(TransactionHistory, {
            storeCommand: TransactionHistory$storeCommand,
            endTransaction: TransactionHistory$endTransaction,
            storeTransaction: TransactionHistory$storeTransaction,
            deleteLastTransaction: TransactionHistory$deleteLastTransaction,
        Severity: Major
        Found in lib/command/transaction_history.js and 2 other locations - About 1 hr to fix
        lib/components/c_facets/Container.js on lines 33..45
        lib/util/request.js on lines 176..187

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

        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

        _.extendProto(Container, {
            start: Container$start,
            path: Container$path,
            getState: Container$getState,
            setState: Container$setState,
        Severity: Major
        Found in lib/components/c_facets/Container.js and 2 other locations - About 1 hr to fix
        lib/command/transaction_history.js on lines 25..37
        lib/util/request.js on lines 176..187

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

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

        module.exports = function(config) {
          config.set({
        
            // base path, that will be used to resolve files and exclude
            basePath: '',
        Severity: Minor
        Found in karma.conf.js - About 1 hr to fix

          Function setSelection has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function setSelection(fromNode, startOffset, toNode, endOffset) {
              var doc = fromNode.ownerDocument;
              if (! doc) return logger('setCaretPosition: element has no document');
              var backward = _getDirection(fromNode, startOffset, toNode, endOffset) == -1;
              var range = doc.createRange();
          Severity: Minor
          Found in lib/util/dom.js - About 1 hr to fix

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

            function insertAtTreePath(rootEl, treePath, el, nearest) {
                var toNormalize = el.nodeType == Node.TEXT_NODE;
                if (rootEl.contains(el))
                    removeElement(el); // can't use removeChild as rootEl here is not an immediate parent
            
            
            Severity: Minor
            Found in lib/util/dom.js - About 1 hr to fix

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

              function Decoder() {
                  var skip = 0; // how many bits we have from the previous character
                  var byte = 0; // current byte we're producing
              
                  this.output = '';
              Severity: Minor
              Found in lib/util/base32.js - About 1 hr to fix

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

                    it('should template class names', function(done) {
                        runTests.call(this, done, [
                            test('.modelPath4', 'dog', ['dog-class']), // Add
                            test('.modelPath4', 'cat', ['cat-class']), // Replace
                            test('.modelPath4', null, [])
                Severity: Major
                Found in test_browser/components/c_facets/Css_test.js and 1 other location - About 1 hr to fix
                test_browser/components/c_facets/Css_test.js on lines 123..129

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

                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

                function lastTextNode(node) {
                    if (node.nodeType == Node.TEXT_NODE) return node;
                    var treeWalker = createTreeWalker(node, NodeFilter.SHOW_TEXT);
                    return treeWalker.lastChild();
                }
                Severity: Major
                Found in lib/util/dom.js and 1 other location - About 1 hr to fix
                lib/util/dom.js on lines 299..303

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

                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

                function firstTextNode(node) {
                    if (node.nodeType == Node.TEXT_NODE) return node;
                    var treeWalker = createTreeWalker(node, NodeFilter.SHOW_TEXT);
                    return treeWalker.firstChild();
                }
                Severity: Major
                Found in lib/util/dom.js and 1 other location - About 1 hr to fix
                lib/util/dom.js on lines 312..316

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

                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

                    it('should apply classes based on the result of function calls', function(done) {
                        runTests.call(this, done, [
                            test('.modelPath3', 'apple', ['apple-class']), // Add
                            test('.modelPath3', 'banana', ['banana-class']), // Replace
                            test('.modelPath3', null, []), // Remove
                Severity: Major
                Found in test_browser/components/c_facets/Css_test.js and 1 other location - About 1 hr to fix
                test_browser/components/c_facets/Css_test.js on lines 131..137

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

                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 ComponentFacet$onConfigMessages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function ComponentFacet$onConfigMessages(messageSubscribers) {
                    var notYetRegisteredMap = _.mapKeys(messageSubscribers, function(subscriber, messages) {
                        var subscriberType = typeof subscriber;
                        if (subscriberType == 'function')
                            return this.on(messages, subscriber);
                Severity: Minor
                Found in lib/components/c_facet.js - About 1 hr to fix

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

                      while (nextNode && !isText) {
                          isText = nextNode ? !nextNode.nodeValue.trim() == '' : false;
                          nextNode = treeWalker.nextNode();
                      }
                  Severity: Major
                  Found in lib/components/c_facets/Dom.js and 1 other location - About 1 hr to fix
                  lib/components/c_facets/Dom.js on lines 312..315

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

                  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

                      while (prevNode && !isText) {
                          isText = prevNode ? !prevNode.nodeValue.trim() == '' : false;
                          prevNode = treeWalker.previousNode();
                      }
                  Severity: Major
                  Found in lib/components/c_facets/Dom.js and 1 other location - About 1 hr to fix
                  lib/components/c_facets/Dom.js on lines 335..338

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

                  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

                      beforeEach(function() {
                          var element = document.createElement('div');
                          element.innerHTML = testHtml;
                  
                          // Bind the element
                  Severity: Major
                  Found in test_browser/components/c_facets/Data_test.js and 1 other location - About 1 hr to fix
                  test_browser/components/c_facets/List_test.js on lines 23..29

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

                  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