christophehurpeau/html-document

View on GitHub

Showing 58 of 58 total issues

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

    insertRow(index = -1) {
        const row = this.ownerDocument.createElement('tr');
        if (index === -1 || index === this.children.length) {
            this.appendChild(row);
        } else if (index < this.children.length) {
Severity: Major
Found in src/HTMLElement/elements/HTMLTableSectionElement.js and 1 other location - About 4 hrs to fix
src/HTMLElement/elements/HTMLTableRowElement.js on lines 161..172

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

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

    insertCell(index = -1) {
        let row = this.ownerDocument.createElement('td');
        if (index === -1 || index === this.children.length) {
            this.appendChild(row);
        } else if (index < this.children.length) {
Severity: Major
Found in src/HTMLElement/elements/HTMLTableRowElement.js and 1 other location - About 4 hrs to fix
src/HTMLElement/elements/HTMLTableSectionElement.js on lines 96..107

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

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

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

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

                  if (newChild.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                      const newChildren = [];
                      let childNode;
          
                      while (childNode = newChild.firstChild) {
          Severity: Major
          Found in src/ParentNode.js and 1 other location - About 2 hrs to fix
          src/ParentNode.js on lines 307..321

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

          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

                  if (child.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                      const children = [];
                      let childNode;
          
                      while (childNode = child.firstChild) {
          Severity: Major
          Found in src/ParentNode.js and 1 other location - About 2 hrs to fix
          src/ParentNode.js on lines 255..269

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

          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

              createTFoot() {
                  let tFoot = this.tFoot;
          
                  if (tFoot !== null) {
                      return tFoot;
          Severity: Major
          Found in src/HTMLElement/elements/HTMLTableElement.js and 2 other locations - About 1 hr to fix
          src/HTMLElement/elements/HTMLTableElement.js on lines 189..199
          src/HTMLElement/elements/HTMLTableElement.js on lines 255..265

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

          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

              createCaption() {
                  let caption = this.caption;
          
                  if (caption !== null) {
                      return caption;
          Severity: Major
          Found in src/HTMLElement/elements/HTMLTableElement.js and 2 other locations - About 1 hr to fix
          src/HTMLElement/elements/HTMLTableElement.js on lines 189..199
          src/HTMLElement/elements/HTMLTableElement.js on lines 223..233

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

          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

              createTHead() {
                  let tHead = this.tHead;
          
                  if (tHead !== null) {
                      return tHead;
          Severity: Major
          Found in src/HTMLElement/elements/HTMLTableElement.js and 2 other locations - About 1 hr to fix
          src/HTMLElement/elements/HTMLTableElement.js on lines 223..233
          src/HTMLElement/elements/HTMLTableElement.js on lines 255..265

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

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

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

                    if (this.tHead !== null) {
                        this.tHead.children.forEach((element) => {
                            if (element.tagName === 'tr') {
                                result.push(element);
                            }
            Severity: Major
            Found in src/HTMLElement/elements/HTMLTableElement.js and 1 other location - About 1 hr to fix
            src/HTMLElement/elements/HTMLTableElement.js on lines 159..165

            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

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

                    if (this.tFoot !== null) {
                        this.tFoot.children.forEach((element) => {
                            if (element.tagName === 'tr') {
                                result.push(element);
                            }
            Severity: Major
            Found in src/HTMLElement/elements/HTMLTableElement.js and 1 other location - About 1 hr to fix
            src/HTMLElement/elements/HTMLTableElement.js on lines 140..146

            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

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

                deleteCell(index) {
                    if (index >= this.children.length || index < 0) {
                        throw new DOMException('IndexSizeError');
                    }
            
            
            Severity: Major
            Found in src/HTMLElement/elements/HTMLTableRowElement.js and 1 other location - About 1 hr to fix
            src/HTMLElement/elements/HTMLTableSectionElement.js on lines 116..122

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

            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

                deleteRow(index) {
                    if (index >= this.children.length || index < 0) {
                        throw new DOMException('IndexSizeError');
                    }
            
            
            Severity: Major
            Found in src/HTMLElement/elements/HTMLTableSectionElement.js and 1 other location - About 1 hr to fix
            src/HTMLElement/elements/HTMLTableRowElement.js on lines 181..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 64.

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

                Severity
                Category
                Status
                Source
                Language