robotcoral/coral-app

View on GitHub

Showing 95 of 111 total issues

Function export has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

static export(world: World, robot: Robot, data: AdditionalWorldData) {
const worldData: WorldData = {
dimensions: world.getWorldSize(),
starting_position: robot.getCurrentCoordinates(),
starting_rotation: robot.getCardinal(),
Severity: Minor
Found in src/app/gameboard/utils/world.import.export.ts - About 2 hrs to fix

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

onModeMenu() {
this.modeExpanded = !this.modeExpanded;
if (this.modeExpanded)
this.document.addEventListener('click', this.modeCallback);
else this.document.removeEventListener('click', this.modeCallback);
src/app/gameboard/gameboard-controls/gameboard-controls.component.ts on lines 64..69

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

onColorMenu() {
this.colorExpanded = !this.colorExpanded;
if (this.colorExpanded)
this.document.addEventListener('click', this.colorCallback);
else this.document.removeEventListener('click', this.colorCallback);
src/app/gameboard/gameboard-controls/gameboard-controls.component.ts on lines 76..81

Function export has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

static export(world: World, robot: Robot, data: AdditionalWorldData) {
const worldData: WorldData = {
dimensions: world.getWorldSize(),
starting_position: robot.getCurrentCoordinates(),
starting_rotation: robot.getCardinal(),
Severity: Minor
Found in src/app/gameboard/utils/world.import.export.ts - About 1 hr to fix

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

    raiseSpeed() {
    if (this.settings.settings.globalSettings.executionSpeed < 5)
    this.settings.setSpeed(
    this.settings.settings.globalSettings.executionSpeed + 1
    );
    Severity: Major
    Found in src/app/common/karol.interpreter.ts and 1 other location - About 1 hr to fix
    src/app/common/karol.interpreter.ts on lines 155..160

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

    lowerSpeed() {
    if (this.settings.settings.globalSettings.executionSpeed > 1)
    this.settings.setSpeed(
    this.settings.settings.globalSettings.executionSpeed - 1
    );
    Severity: Major
    Found in src/app/common/karol.interpreter.ts and 1 other location - About 1 hr to fix
    src/app/common/karol.interpreter.ts on lines 148..153

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

    colorCallback = ((e) => {
    if (!this.document.getElementById('colorMenu').contains(e.target)) {
    this.onColorMenu();
    }
    }).bind(this);
    src/app/gameboard/gameboard-controls/gameboard-controls.component.ts on lines 45..49

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

    modeCallback = ((e) => {
    if (!this.document.getElementById('modeMenu').contains(e.target)) {
    this.onModeMenu();
    }
    }).bind(this);
    src/app/gameboard/gameboard-controls/gameboard-controls.component.ts on lines 32..36

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

    zoomOut() {
    const fontSize = this.settingsService.settings.globalSettings.fontSize - 2;
    this.settingsService.saveEditorSettings({ fontSize });
    }
    Severity: Major
    Found in src/app/common/editor.controller.ts and 1 other location - About 1 hr to fix
    src/app/common/editor.controller.ts on lines 29..32

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

    zoomIn() {
    const fontSize = this.settingsService.settings.globalSettings.fontSize + 2;
    this.settingsService.saveEditorSettings({ fontSize });
    }
    Severity: Major
    Found in src/app/common/editor.controller.ts and 1 other location - About 1 hr to fix
    src/app/common/editor.controller.ts on lines 34..37

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

    if (touchUIActive != this.settings.globalSettings.touchUIActive) {
    this.settings.globalSettings.touchUIActive = touchUIActive;
    this.applyTouchUI();
    }
    Severity: Minor
    Found in src/app/common/settings.service.ts and 1 other location - About 50 mins to fix
    src/app/common/settings.service.ts on lines 282..285

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

    if (language != this.settings.globalSettings.language) {
    this.settings.globalSettings.language = language;
    this.applyLanguage();
    }
    Severity: Minor
    Found in src/app/common/settings.service.ts and 1 other location - About 50 mins to fix
    src/app/common/settings.service.ts on lines 286..289

    Avoid deeply nested control flow statements.
    Open

    for (let z = 0; z < (world.objects[x][y] as Slab[]).length; z++)
    worldData.objects.push({
    position: { x, y, z },
    type: WORLDOBJECTTYPES.SLAB,
    data: {
    Severity: Major
    Found in src/app/gameboard/utils/world.import.export.ts - About 45 mins to fix

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

      repairInvalidSettings() {
      if (
      !Object.values(THEMES || 'auto').includes(
      this.settings.globalSettings.theme
      )
      Severity: Minor
      Found in src/app/common/settings.service.ts - About 25 mins to fix

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

      pickUp(mode: WORLDOBJECTTYPES = WORLDOBJECTTYPES.SLAB) {
      try {
      const coo = this.model.robot.getMoveCoordinates();
      if (mode == WORLDOBJECTTYPES.SLAB) {
      this.model.world.pickUpSlab(coo);
      Severity: Minor
      Found in src/app/gameboard/utils/gameboard.controller.ts - About 25 mins to fix

      Properties should be ordered background-color, box-shadow, color, scale
      Open

      scale: 1.02;

      0.35 should be written without a leading zero as .35
      Open

      box-shadow: 0px 2px 6px hsla(0, 0%, 0%, 0.35);

      0px should be written without units as 0
      Open

      box-shadow: 0px 0px 4px grey;

      Properties should be ordered background-color, border, color, width
      Open

      width: 100%;

      Syntax Error: Invalid CSS after " @include themes": expected "}", was ".bg-color-trans..."
      Open

      @include themes.bg-color-transition;
      Severity
      Category
      Status
      Source
      Language