Showing 69 of 132 total issues

Function deprecate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function deprecate(fn, message) {
    var warned;
    switch (typeof fn) {
        case 'object':
            return _.mapKeys(fn, function(f) { return deprecate(f, message); });
Severity: Minor
Found in lib/util/deprecate.js - About 55 mins 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 getRangeSiblings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function getRangeSiblings(range) {
    var containerNode = range.commonAncestorContainer
        , startNode = range.startContainer
        , endNode = range.endContainer;

Severity: Minor
Found in lib/util/fragment.js - About 55 mins 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 DOMStorage$setItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function DOMStorage$setItem(key, value) {
    var pKey = this._storageKey(key);
    var dataType = _setKeyDataType.call(this, pKey, value);
    var valueStr = _serializeData(value, dataType);
    try {
Severity: Minor
Found in lib/util/storage/index.js - About 55 mins 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 Container$path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function Container$path(path) {
    path = path.split('.');
    var len = path.length;
    if (path[0] || len < 2) throwInvalidPath();
    var comp = this.owner;
Severity: Minor
Found in lib/components/c_facets/Container.js - About 55 mins 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 _setDrop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function _setDrop(opts) {
    this.eventType = 'drop';
    this.target = opts.target;
    if (opts.clientX === undefined || opts.clientY === undefined) return;

Severity: Minor
Found in mocks/dragdropevent.js - About 55 mins 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 _onReady has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function _onReady(eventType, req, callback, resolve, reject) {
Severity: Minor
Found in lib/util/request.js - About 35 mins to fix

    Function TextSelection$$createStateObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function TextSelection$$createStateObject(rootEl, startContainer, startOffset, endContainer, endOffset) {
    Severity: Minor
    Found in lib/util/selection/index.js - About 35 mins to fix

      Function createBinderScope has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function createBinderScope(scopeEl, scopeObjectFactory, rootScope, bindRootElement, throwOnErrors) {
      Severity: Minor
      Found in lib/binder.js - About 35 mins to fix

        Function hasTextBeforeSelection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function hasTextBeforeSelection() {
            var selection = window.getSelection();
            if (! selection.isCollapsed) return true;
        
            var text = selection.focusNode && selection.focusNode.textContent;
        Severity: Minor
        Found in lib/components/c_facets/Dom.js - About 35 mins 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 createFacetClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function createFacetClass(config) {
            check(config, {
                className: String,
                superClassName: Match.Optional(String),
                require: Match.Optional(Array),
        Severity: Minor
        Found in lib/util/create_facet_class.js - About 35 mins 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 _getDirection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function _getDirection(fromNode, startOffset, toNode, endOffset){
            var docPosition = fromNode.compareDocumentPosition(toNode);
            if (docPosition & Node.DOCUMENT_POSITION_FOLLOWING){
                return 1;
            }
        Severity: Minor
        Found in lib/util/dom.js - About 35 mins 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 setSelection has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 _getContainingComponent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function _getContainingComponent(el, returnCurrent, conditionFunc) {
            // Where the current element is a component it should be returned
            // if returnCurrent is true or undefined
            if (returnCurrent !== false) {
                var comp = getComponent(el);
        Severity: Minor
        Found in lib/components/c_utils.js - About 35 mins 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 filterSourceMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function filterSourceMessage(sourceMessage, message, data) { // data is DOM event object
            var ok = true;
        
            if (sourceMessage == 'dragenter' && message == 'dragin') {
                this._currentTarget = data.target;
        Severity: Minor
        Found in lib/components/msg_api/drop.js - About 35 mins 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 _attachCssClasses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function _attachCssClasses(el, methodName, cssClasses, enforce) {
            var classList = el.classList
                , doToggle = methodName == 'toggle';
        
            if (Array.isArray(cssClasses))
        Severity: Minor
        Found in lib/components/c_facets/Dom.js - About 35 mins 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 _response_ready has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function _response_ready(response) {
            var self = this;
            var handler, eventType;
            if (!setHandler('loadend'))
                if (!setHandler('readystatechange'))
        Severity: Minor
        Found in mocks/xmlhttprequest.js - About 35 mins 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 WSMessageSource$trigger has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function WSMessageSource$trigger (msg, data, callback) {
            if (!this._ws) return logger.error('websocket is not created');
        
            data = data || {};
            data.type = msg;
        Severity: Minor
        Found in lib/util/websocket/msg_src.js - About 35 mins 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

        Avoid too many return statements within this function.
        Open

                    return 0;
        Severity: Major
        Found in lib/util/dom.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              if (! data) return;
          Severity: Major
          Found in lib/util/storage/msg_src.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return true;
            Severity: Major
            Found in lib/util/dom.js - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language