engagementgamelab/CivicSeed

View on GitHub
client/code/game/game.boss.js

Summary

Maintainability
F
3 days
Test Coverage

File game.boss.js has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'
/* global CivicSeed, ss, Modernizr, $, $game */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Severity: Major
Found in client/code/game/game.boss.js - About 1 day to fix

    _boss has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    var _boss = {
    
      grid: [],
      totalScore: null,
      modeScore: null,
    Severity: Minor
    Found in client/code/game/game.boss.js - About 4 hrs to fix

      Function renderTiles has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        renderTiles: function (position) {
          var topLeftX = position.x - 1
          var topLeftY = position.y - 1
          var squares = []
          var min = 100
      Severity: Minor
      Found in client/code/game/game.boss.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 addContent has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        addContent: function (section) {
          var overlay = document.getElementById('boss-area')
          var speakerEl = overlay.querySelector('.dialog .speaker')
          var messageEl = overlay.querySelector('.dialog .message')
          var speaker = $game.$botanist.name
      Severity: Major
      Found in client/code/game/game.boss.js - About 3 hrs to fix

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

          chooseResumeResponses: function (data) {
            var numberToGet = 4
            var allResponses = _removeCurrentPlayer(data)
            var theChosenOnes = []
        
        
        Severity: Minor
        Found in client/code/game/game.boss.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 renderTiles has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderTiles: function (position) {
            var topLeftX = position.x - 1
            var topLeftY = position.y - 1
            var squares = []
            var min = 100
        Severity: Minor
        Found in client/code/game/game.boss.js - About 1 hr to fix

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

            chooseResumeResponses: function (data) {
              var numberToGet = 4
              var allResponses = _removeCurrentPlayer(data)
              var theChosenOnes = []
          
          
          Severity: Minor
          Found in client/code/game/game.boss.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                        if (_boss.items[itemId].immediate === true) _boss.activateItem(tile)
            Severity: Major
            Found in client/code/game/game.boss.js - About 45 mins to fix

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

                forEachGridTile: function (func) {
                  var gridX = $game.VIEWPORT_WIDTH
                  var gridY = $game.VIEWPORT_HEIGHT
              
                  for (var x = 0; x < gridX; x++) {
              Severity: Minor
              Found in client/code/game/game.boss.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 loadVideo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                loadVideo: function (number) {
                  var videoEl = document.createElement('video')
                  var path = CivicSeed.CLOUD_PATH + '/audio/cutscenes/'
              
                  if (CivicSeed.ENVIRONMENT === 'development') {
              Severity: Minor
              Found in client/code/game/game.boss.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