Showing 258 of 421 total issues
Function makeResponsePrivate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
makeResponsePrivate: function (data) {
Game.where('instanceName').equals(data.instanceName)
.find(function (err, game) {
if (err) {
winston.error('Could not find game', err)
Function actions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
var tileModel = ss.service.db.model('Tile')
var colorModel = ss.service.db.model('Color')
Function message
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
message: function (data) {
var gameboard = document.getElementById('gameboard')
var bubbleEl = document.getElementById('chat-' + data.id)
var pointerEl = document.getElementById('pointer-' + data.id)
var name = 'me'
Function loadData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadData: function (dataType) {
if (req.session.role && req.session.role === 'superadmin') {
winston.info(filename + ' Loading data for collection: '.magenta + dataType.yellow.underline + ' ...'.magenta)
switch (dataType) {
Function saveResourceLocally
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveResourceLocally: function (data) {
var playerResource = _resources[data.id]
// See if the resource is already in the player's game data
// If so, retrieve it and update it
Function uploadToS3
has 29 lines of code (exceeds 25 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) {
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function (callback) {
console.log('Initializing all modules')
// Instantiating code
this.flags = require('/game.flags')
Function idleCheckTrigger
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function idleCheckTrigger () {
currentStep++
if (currentStep % 8 === 0) {
if (currentStep > numSteps) {
currentStep = 0
Function init
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function (callback) {
// Optimize display for higher-pixel-density screens (e.g. Retina)
if (window.devicePixelRatio) {
$game.PIXEL_RATIO = window.devicePixelRatio
}
Function addMessage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
addMessage: function (data) {
var el = document.getElementById('game-log')
var date = Date()
var displayDate = date.substring(0, 10) + date.substring(15, 24)
var html
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (function () {
function setupRouter () {
// Note: Davis.js has not been actively
// supported since v0.9.9 in 2012.
var app = Davis(function () {
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (function () {
return {
// Generates a hashed password and salt
hashPassword: function (password, cb) {
bcrypt.genSalt(10, function (err, salt) {
- 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 saveResourceLocally
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
saveResourceLocally: function (data) {
var playerResource = _resources[data.id]
// See if the resource is already in the player's game data
// If so, retrieve it and update it
- 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 actions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
var tileModel = ss.service.db.model('Tile')
var colorModel = ss.service.db.model('Color')
- 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 exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (function () {
var logCounter = new Counter()
return {
- 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 createCanvasForPlayer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
createCanvasForPlayer: function (id, skinSuit, playerColor) {
var context = _offscreenPlayersContext[id]
// If player's canvas currently exists, clear it
if (context) {
- 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 startGame
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
startGame: function (ingame) {
if ($game.bossModeUnlocked && $game.$player.currentLevel > 3) {
$game.$boss.init()
}
- 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 unlockSkin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function unlockSkin (skin, part) {
var skinventory = $game.$player.getSkinventory()
if (part !== undefined) {
// If part already exists, skip.
- 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 authenticate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
authenticate: function (email, password) {
ss.rpc('shared.account.authenticate', email, password, function (response) {
var session
if (response.status) {
- 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 throttle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});