TooAngel/screeps

View on GitHub
src/visualizer.js

Summary

Maintainability
D
2 days
Test Coverage

Function showSearch has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  showSearch(search) {
    if (search) {
      const rv = {};
      const getRV = (pos) => {
        if (!rv[pos.roomName]) {
Severity: Minor
Found in src/visualizer.js - About 4 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 showCreeps has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  showCreeps() {
    for (const room of _.values(Game.rooms)) {
      if (!room.isMy()) {
        continue;
      }
Severity: Minor
Found in src/visualizer.js - About 3 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 showCostMatrix has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  showCostMatrix(roomName, costMatrixCallback) {
    const rv = new RoomVisual(roomName);
    const cm = costMatrixCallback(roomName);
    if (cm) {
      for (let x = 0; x < 50; ++x) {
Severity: Minor
Found in src/visualizer.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 showStructures has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  showStructures() {
    for (const room of _.values(Game.rooms)) {
      if (!room.isMy()) {
        continue;
      }
Severity: Minor
Found in src/visualizer.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 showBlockers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  showBlockers() {
    for (const room of _.values(Game.rooms)) {
      if (!room.isMy()) {
        continue;
      }
Severity: Minor
Found in src/visualizer.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 showBlockers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  showBlockers() {
    for (const room of _.values(Game.rooms)) {
      if (!room.isMy()) {
        continue;
      }
Severity: Minor
Found in src/visualizer.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                if (target.structureType) {
                  text = target.structureType.substr(0, 1);
                } else {
                  text = 's'; // source
                }
    Severity: Major
    Found in src/visualizer.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (creep) {
                    this.drawPosition(rv, creep, text, 'yellow');
                  }
      Severity: Major
      Found in src/visualizer.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (!structure) {
                      continue;
                    }
        Severity: Major
        Found in src/visualizer.js - About 45 mins to fix

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

            render() {
              if (config.visualizer.showCostMatrices) {
                this.showCostMatrices();
              }
              if (config.visualizer.showRoomPaths) {
          Severity: Minor
          Found in src/visualizer.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

          There are no issues that match your filters.

          Category
          Status