christophehurpeau/html-document

View on GitHub

Showing 22 of 58 total issues

HTMLSelectElement has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class HTMLSelectElement extends HTMLElement {
    /**
     * Is a Boolean that reflects the autofocus HTML attribute,
     * which indicates whether the control should have input focus when the page loads,
     * unless the user overrides it, for example by typing in a different control.
Severity: Minor
Found in src/HTMLElement/elements/HTMLSelectElement.js - About 4 hrs to fix

    ParentNode has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class ParentNode extends Node {
        constructor() {
            super();
            this._childNodes = [];
            this._childCollections = [];
    Severity: Minor
    Found in src/ParentNode.js - About 2 hrs to fix

      Url has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class Url {
          /**
           * Creates object using given value as start url.
           *
           * @param {string} url - url to parse.
      Severity: Minor
      Found in src/utils/Url.js - About 2 hrs to fix

        HTMLFormElement has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class HTMLFormElement extends HTMLElement {
            /**
             * Gets or sets value of acceptCharset. Is a DOMString that reflects the accept-charset HTML attribute,
             * containing a list of character encodings that the server accepts.
             *
        Severity: Minor
        Found in src/HTMLElement/elements/HTMLFormElement.js - About 2 hrs to fix

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

          function matchRule(element, rule) {
              if (rule.hasOwnProperty('tagName') && element.tagName !== rule.tagName) {
                  return false;
              }
          
          
          Severity: Minor
          Found in src/utils/querySelectorHelper.js - About 1 hr to fix

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

                dispatchEvent(event) {
                    event.target = this;
            
                    // Capturing phase
                    const capturingPhase = function (event) { // eslint-disable-line space-before-function-paren
            Severity: Minor
            Found in src/Node.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 rowIndex has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                get rowIndex() {
                    if (this.parentNode === null) {
                        return -1;
                    }
            
            
            Severity: Minor
            Found in src/HTMLElement/elements/HTMLTableRowElement.js - About 1 hr to fix

              Function dispatchEvent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  dispatchEvent(event) {
                      event.target = this;
              
                      // Capturing phase
                      const capturingPhase = function (event) { // eslint-disable-line space-before-function-paren
              Severity: Minor
              Found in src/Node.js - About 1 hr to fix

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

                function* processSelectors(element, selectors) {
                    for (let selector of selectors) {
                        const rule = selector.rule;
                
                        if (!matchRule(element, rule)) {
                Severity: Minor
                Found in src/utils/querySelectorHelper.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 constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    constructor(type, mouseEventInit) {
                        mouseEventInit = extend(true, {
                            screenX: 0,
                            screenY: 0,
                            clientX: 0,
                Severity: Minor
                Found in src/MouseEvent.js - About 1 hr to fix

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

                  function* processSelectors(element, selectors) {
                      for (let selector of selectors) {
                          const rule = selector.rule;
                  
                          if (!matchRule(element, rule)) {
                  Severity: Minor
                  Found in src/utils/querySelectorHelper.js - About 1 hr to fix

                    Function rows has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        get rows() {
                            const result = [];
                            if (this.tHead !== null) {
                                this.tHead.children.forEach((element) => {
                                    if (element.tagName === 'tr') {
                    Severity: Minor
                    Found in src/HTMLElement/elements/HTMLTableElement.js - About 1 hr to fix

                      Function rowIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          get rowIndex() {
                              if (this.parentNode === null) {
                                  return -1;
                              }
                      
                      
                      Severity: Minor
                      Found in src/HTMLElement/elements/HTMLTableRowElement.js - About 45 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 matchRule has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function matchRule(element, rule) {
                          if (rule.hasOwnProperty('tagName') && element.tagName !== rule.tagName) {
                              return false;
                          }
                      
                      
                      Severity: Minor
                      Found in src/utils/querySelectorHelper.js - About 45 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 selected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          set selected(selected) {
                              if (selected) {
                                  let selectElement = this._select;
                                  if (!selectElement.multiple) {
                                      let selectedOption = selectElement.selectedOption;
                      Severity: Minor
                      Found in src/HTMLElement/elements/HTMLOptionElement.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 -1;
                      Severity: Major
                      Found in src/HTMLElement/elements/HTMLTableRowElement.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return index + inSection;
                        Severity: Major
                        Found in src/HTMLElement/elements/HTMLTableRowElement.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return true;
                          Severity: Major
                          Found in src/utils/querySelectorHelper.js - About 30 mins to fix

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

                                appendChild(child) {
                                    if (!(child instanceof Node)) {
                                        throw new Error('Trying to add non node element');
                                    }
                            
                            
                            Severity: Minor
                            Found in src/ParentNode.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 replaceChild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                replaceChild(newChild, oldChild) {
                                    const index = this._childNodes.indexOf(oldChild);
                                    if (index === -1) {
                                        throw new Error('Node was not found');
                                    }
                            Severity: Minor
                            Found in src/ParentNode.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