enclose-io/compiler

View on GitHub
lts/deps/v8/tools/turbolizer/src/text-view.ts

Summary

Maintainability
F
1 wk
Test Coverage

Function processLine has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  processLine(line) {
    const view = this;
    const result = [];
    let patternSet = 0;
    while (true) {
Severity: Minor
Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 6 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 constructor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(id, broker) {
    super(id);
    const view = this;
    view.textListNode = view.divNode.getElementsByTagName('ul')[0];
    view.patterns = null;
Severity: Major
Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 2 hrs to fix

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

      updateSelection(scrollIntoView: boolean = false) {
        if (this.divNode.parentNode == null) return;
        const mkVisible = new ViewElements(this.divNode.parentNode as HTMLElement);
        const view = this;
        const elementsToSelect = view.divNode.querySelectorAll(`[data-pc-offset]`);
    Severity: Minor
    Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - 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 createFragment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      createFragment(text, style) {
        const fragment = document.createElement("SPAN");
    
        if (typeof style.associateData == 'function') {
          if (style.associateData(text, fragment) === false) {
    Severity: Minor
    Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - 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 processLine has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      processLine(line) {
        const view = this;
        const result = [];
        let patternSet = 0;
        while (true) {
    Severity: Minor
    Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 1 hr to fix

      Function updateSelection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        updateSelection(scrollIntoView: boolean = false) {
          if (this.divNode.parentNode == null) return;
          const mkVisible = new ViewElements(this.divNode.parentNode as HTMLElement);
          const view = this;
          const elementsToSelect = view.divNode.querySelectorAll(`[data-pc-offset]`);
      Severity: Minor
      Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                    if (text != '') {
                      const fragment = view.createFragment(matches[0], style);
                      if (fragment !== null) result.push(fragment);
                    }
        Severity: Major
        Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if (nextPatternSet != -1) {
                        throw ("illegal parsing state in text-view in patternSet" + patternSet);
                      }
          Severity: Major
          Found in lts/deps/v8/tools/turbolizer/src/text-view.ts - About 45 mins to fix

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

              constructor(id, broker) {
                super(id);
                const view = this;
                view.textListNode = view.divNode.getElementsByTagName('ul')[0];
                view.patterns = null;
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 4 days to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 26..91

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

            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

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

              updateSelection(scrollIntoView: boolean = false) {
                if (this.divNode.parentNode == null) return;
                const mkVisible = new ViewElements(this.divNode.parentNode as HTMLElement);
                const view = this;
                const elementsToSelect = view.divNode.querySelectorAll(`[data-pc-offset]`);
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 2 days to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 128..157

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

            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

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

              processLine(line) {
                const view = this;
                const result = [];
                let patternSet = 0;
                while (true) {
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 1 day to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 189..225

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

            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

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

              createFragment(text, style) {
                const fragment = document.createElement("SPAN");
            
                if (typeof style.associateData == 'function') {
                  if (style.associateData(text, fragment) === false) {
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 6 hrs to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 169..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 157.

            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

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

              processText(text) {
                const view = this;
                const textLines = text.split(/[\n]/);
                let lineNo = 0;
                for (const line of textLines) {
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 5 hrs to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 227..241

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

            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

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

              addNodeIdToBlockId(anyNodeId, anyBlockId) {
                const blockId = anyToString(anyBlockId);
                if (!this.blockIdtoNodeIds.has(blockId)) {
                  this.blockIdtoNodeIds.set(blockId, []);
                }
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 3 hrs to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 109..116

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

            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

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

              addHtmlElementForNodeId(anyNodeId: any, htmlElement: HTMLElement) {
                const nodeId = anyToString(anyNodeId);
                if (!this.nodeIdToHtmlElementsMap.has(nodeId)) {
                  this.nodeIdToHtmlElementsMap.set(nodeId, []);
                }
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 2 hrs to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 93..99

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

            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

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

              addHtmlElementForBlockId(anyBlockId, htmlElement) {
                const blockId = anyToString(anyBlockId);
                if (!this.blockIdToHtmlElementsMap.has(blockId)) {
                  this.blockIdToHtmlElementsMap.set(blockId, []);
                }
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 2 hrs to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 101..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 82.

            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

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

              blockIdsForNodeIds(nodeIds) {
                const blockIds = [];
                for (const nodeId of nodeIds) {
                  const blockId = this.nodeIdToBlockId[nodeId];
                  if (blockId == undefined) continue;
            Severity: Major
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 1 hr to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 118..126

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

            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

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

              clearText() {
                while (this.textListNode.firstChild) {
                  this.textListNode.removeChild(this.textListNode.firstChild);
                }
              }
            Severity: Minor
            Found in lts/deps/v8/tools/turbolizer/src/text-view.ts and 1 other location - About 35 mins to fix
            current/deps/v8/tools/turbolizer/src/text-view.ts on lines 163..167

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

            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

            There are no issues that match your filters.

            Category
            Status