webpro/DOMtastic

View on GitHub

Showing 18 of 22 total issues

Function css has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const css = function(key, value) {

  let styleProps, prop, val;

  if(typeof key === 'string') {
Severity: Minor
Found in src/css.js - 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 append has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const append = function(element) {
  if(this instanceof Node) {
    if(typeof element === 'string') {
      this.insertAdjacentHTML('beforeend', element);
    } else {
Severity: Minor
Found in src/dom/index.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

Function after has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const after = function(element) {
  if(this instanceof Node) {
    if(typeof element === 'string') {
      this.insertAdjacentHTML('afterend', element);
    } else {
Severity: Minor
Found in src/dom/index.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

Function before has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const before = function(element) {
  if(this instanceof Node) {
    if(typeof element === 'string') {
      this.insertAdjacentHTML('beforebegin', element);
    } else {
Severity: Minor
Found in src/dom/index.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

Function domtastic has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const domtastic = function domtastic(selector, context = document) {

  let collection;

  if(!selector) {
Severity: Minor
Found in src/selector/index.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

Function prepend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const prepend = function(element) {
  if(this instanceof Node) {
    if(typeof element === 'string') {
      this.insertAdjacentHTML('afterbegin', element);
    } else {
Severity: Minor
Found in src/dom/index.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

Function on has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const on = function(eventNames, selector, handler, useCapture, once) {

  if(typeof selector === 'function') {
    handler = selector;
    selector = null;
Severity: Minor
Found in src/event/index.js - About 1 hr to fix

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

    export const off = function(eventNames = '', selector, handler, useCapture) {
    
      if(typeof selector === 'function') {
        handler = selector;
        selector = null;
    Severity: Minor
    Found in src/event/index.js - About 1 hr to fix

      Function querySelector has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      const querySelector = (selector, context) => {
      
        const isSimpleSelector = reSimpleSelector.test(selector);
      
        if(isSimpleSelector) {
      Severity: Minor
      Found in src/selector/index.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

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

      export const css = function(key, value) {
      
        let styleProps, prop, val;
      
        if(typeof key === 'string') {
      Severity: Minor
      Found in src/css.js - About 1 hr to fix

        Function closest has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const closest = (() => {
        
          const closest = function(selector, context) {
            const nodes = [];
            each(this, node => {
        Severity: Minor
        Found in src/selector/closest.js - About 1 hr to fix

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

          export const on = function(eventNames, selector, handler, useCapture, once) {
          Severity: Minor
          Found in src/event/index.js - About 35 mins to fix

            Function delegateHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const delegateHandler = function(selector, handler, event) {
              const eventTarget = event._target || event.target;
              const currentTarget = closest.call([eventTarget], selector, this)[0];
              if(currentTarget && currentTarget !== this) {
                if(currentTarget === eventTarget || !(event.isPropagationStopped && event.isPropagationStopped())) {
            Severity: Minor
            Found in src/event/index.js - About 25 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 getEventConstructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const getEventConstructor = type => isSupportsOtherEventConstructors ? (reMouseEvent.test(type) ? MouseEvent : (reKeyEvent.test(type) ? KeyboardEvent : CustomEvent)) : CustomEvent;
            Severity: Minor
            Found in src/event/trigger.js - About 25 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 augmentEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const augmentEvent = event => {
              if(!event.isDefaultPrevented || event.stopImmediatePropagation || event.stopPropagation) {
                for(const methodName in eventMethods) {
                  (function(methodName, testMethodName, originalMethod) {
                    event[methodName] = function() {
            Severity: Minor
            Found in src/event/index.js - About 25 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 attr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const attr = function(key, value) {
            
              if(typeof key === 'string' && typeof value === 'undefined') {
                const element = this.nodeType ? this : this[0];
                return element ? element.getAttribute(key) : undefined;
            Severity: Minor
            Found in src/dom/attr.js - About 25 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 data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const data = function(key, value) {
            
              if(typeof key === 'string' && typeof value === 'undefined') {
                const element = this.nodeType ? this : this[0];
                return element && DATAKEYPROP in element ? element[DATAKEYPROP][camelize(key)] : undefined;
            Severity: Minor
            Found in src/dom/data.js - About 25 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 toggleClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const toggleClass = function(value, state) {
              if(value && value.length) {
                const action = typeof state === 'boolean' ? state ? 'add' : 'remove' : 'toggle';
                each(value.split(' '), _each.bind(this, action));
              }
            Severity: Minor
            Found in src/dom/class.js - About 25 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

            Severity
            Category
            Status
            Source
            Language