Showing 258 of 421 total issues
Function drawSeed
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawSeed: function (pos) {
if (_seeds.draw > 0) {
var drawLocal = false
if ($player.seedMode === 'draw') {
var currentTile = $game.$map.currentTiles[pos.x][pos.y]
Function dropSeed
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
dropSeed: function (options) {
if (options.x !== undefined && options.x >= 0) {
options.mX = $game.$map.currentTiles[options.x][options.y].x
options.mY = $game.$map.currentTiles[options.x][options.y].y
}
Function sendSeedBomb
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
sendSeedBomb: function (data) {
var waitingEl = document.getElementById('waiting-for-seed')
// set a waiting boolean so we don't plant more until receive data back from rpc
$game.flags.set('awaiting-seed')
Function onload
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
_tilesheets[filename].onload = function () {
var next = num + 1
// If last image, go load skins?
if (num === _render.images.length - 1) {
Function moveStraight
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
moveStraight: function (direction) {
var location
var targetPosition
var x, y
Function calculateNext
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
calculateNext: function (x, y) {
var getThisManyX
var getThisManyY
var getThisX
var getThisY
Function template
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
_.template = function(text, data, settings) {
var render;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
Function updateTiles
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateTiles: function (oldPosition, newPosition, callback) {
// update new tile, make sure we can change it
if ((oldPosition.x === newPosition.x) && (oldPosition.y === newPosition.y)) {
callback()
} else {
Function loadResponses
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadResponses: function (resource) {
var el = document.getElementById('resource-area').querySelector('.resource-responses')
var playerResource = $game.$player.getAnswer(resource.id)
var playerPublic = false
var playerHTML = ''
Function move
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Player.prototype.move = function () {
// if the steps between the tiles has finished,
// update the master location, and reset steps to go on to next move
if (this.currentStep >= this.numSteps) {
this.currentStep = 0
Function checkState
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
checkState: function () {
// Prevent check from occurring if Botanist state is not at 2 or 3
// (resource collecting mode)
if ($botanist.getState() < 2) return false
- Read upRead up
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 uploadToS3
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
S3Uploader.prototype.uploadToS3 = function (file, url, public_url) {
var this_s3upload, xhr
this_s3upload = this
xhr = this.createCORSRequest('PUT', url)
if (!xhr) {
- Read upRead up
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 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 = []
- Read upRead up
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 doTutorial
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
doTutorial: function () {
var tutorialState = _botanist.tutorialState
var dialogue = ''
switch (tutorialState) {
Function beginMove
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
beginMove: function (targetPosition) {
var localPosition = $player.getLocalPosition()
var path
// Clear HUD
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
Function actions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
req.use('account.authenticated')
return {
Function show
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function () {
var level = $game.$player.currentLevel
// Clear nudges if present
clearInterval(_botanist.nudgePlayerInterval)
Function sync
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
_.defaults(options || (options = {}), {
Function loadEnvironmentOnceFx
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadEnvironmentOnceFx: function () {
var mp3 = _musicPath + 'environmentonce.mp3?VERSION='
var ogg = _musicPath + '/ogg/environmentonce.ogg?VERSION='
if (_extension) {