chirashijs/chirashi

View on GitHub

Showing 13 of 13 total issues

Function createElement has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export default function createElement (string) {
  regex.lastIndex = 0

  if (string.indexOf('<') !== 0) {
    let core = null
Severity: Minor
Found in lib/dom/createElement.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 createElement has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function createElement (string) {
  regex.lastIndex = 0

  if (string.indexOf('<') !== 0) {
    let core = null
Severity: Minor
Found in lib/dom/createElement.js - About 1 hr to fix

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

    export default function closest (element, tested, limit = document) {
      element = getElement(element)
    
      if (!element || (typeof limit === 'string' ? element.matches(limit) : element === limit)) {
        return false
    Severity: Minor
    Found in lib/dom/closest.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 _getElements has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function _getElements (from, selector) {
      if (selector.search(reg) === 0) {
        switch (selector[0]) {
          case '.':
            return _nodelistToArray(from.getElementsByClassName(selector.slice(1)))
    Severity: Minor
    Found in lib/_internals/_getElements.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 _wrapOptions has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function _wrapOptions (selector, target, eventsObj, events, options) {
    Severity: Minor
    Found in lib/events/delegate.js - About 35 mins to fix

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

      function _transformFromObj (values, transformation, name, defaultVal, axe) {
      Severity: Minor
      Found in lib/styles/transform.js - About 35 mins to fix

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

        function _setEvent (method, callback, options, event, element) {
        Severity: Minor
        Found in lib/_internals/_setEvents.js - About 35 mins to fix

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

          function _getValues (transformation, axes, name, defaultVal, defaultAxes) {
          Severity: Minor
          Found in lib/styles/transform.js - About 35 mins to fix

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

            function _setEventOnEach (elements, method, callback, options, event) {
            Severity: Minor
            Found in lib/_internals/_setEvents.js - About 35 mins to fix

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

              export default function getElements (input) {
                if (typeof input === 'string') {
                  return _getElements(document, input)
                }
              
              
              Severity: Minor
              Found in lib/core/getElements.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 _chirasizeArray(isDomElement(input) ? [input] : [])
              Severity: Major
              Found in lib/core/getElements.js - About 30 mins to fix

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

                export default function getElement (input) {
                  if (typeof input === 'string') {
                    return _getElement(document, input)
                  }
                
                
                Severity: Minor
                Found in lib/core/getElement.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 _getElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function _getElement (from, selector) {
                  if (selector.search(reg) === 0) {
                    switch (selector[0]) {
                      case '.':
                        return from.getElementsByClassName(selector.slice(1))[0]
                Severity: Minor
                Found in lib/_internals/_getElement.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