Showing 258 of 421 total issues
Function createUserAndSendInvite
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var createUserAndSendInvite = function (email, instanceName, i) {
// Note: All invites assume a NEW USER. This means if the user is
// already in the system, this OVERWRITES their account.
// TODO: Figure out how to work around this properly.
Function set
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set: function(models, options) {
options = _.defaults({}, options, setOptions);
if (options.parse) models = this.parse(models, options);
var singular = !_.isArray(models);
models = singular ? (models ? [models] : []) : _.clone(models);
exports
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
var $game = module.exports = {
// GLOBAL GAME CONSTANTS
VIEWPORT_WIDTH: 30,
VIEWPORT_HEIGHT: 15,
Function dateFormat
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var dateFormat = function () {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
timezoneClip = /[^-+\dA-Z]/g,
pad = function (val, len) {
Function displayNpcComments
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
displayNpcComments: function () {
// Clear any previous comment bubbles
$player.clearNpcComments()
// Get on-screen NPCs
Function gameColorUpdate
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
gameColorUpdate: function (newInfo, instanceName, callback) {
// access our global game model for status updates
_gameModel
.where('instanceName').equals(instanceName)
.find(function (err, results) {
Function transitionMap
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
transitionMap: function (stepNumber) {
// --------RIGHT------------
// go thru current array and shift everthing
if ($map.stepDirection === 'right') {
// shift all except last column
Function hashDemoData
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function hashDemoData (i) {
if (i < numDemoUsers) {
accountHelpers.hashPassword('demo', function (hashedPassword) {
// create demo users
var d = {
Function drawMapTile
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
drawMapTile: function (tileData) {
var srcX, srcY
var tilesheetIndex = tileData.colored ? 1 : 0
// background1, the ground texture
Function eq
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
File astar.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// javascript-astar 0.3.0
// http://github.com/bgrins/javascript-astar
// Freely distributable under the MIT License.
// Implements the astar search algorithm in javascript using a Binary Heap.
// Includes Binary Heap (with modifications) from Marijn Haverbeke.
File startup.js
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict'
var rootDir = process.cwd()
var winston = require('winston')
_resources
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
var _resources = {
data: [],
temporaryAnswer: '',
exports
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
var $audio = module.exports = {
ready: false,
isMute: false,
Function setupInviteCodes
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setupInviteCodes () {
$body.on('submit', '#admin-invites form', function (event) {
// Prevent the 'enter' key on some browsers from
// submitting the form in the wrong way
event.preventDefault()
Function beginMove
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
beginMove: function (targetPosition) {
var localPosition = $player.getLocalPosition()
var path
// Clear HUD
- 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 move
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
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
- 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 search
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
search: function(graph, start, end, options) {
astar.init(graph);
options = options || {};
var heuristic = options.heuristic || astar.heuristics.manhattan;
Function onClick
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onClick (mouseInfo) {
if (mouseInfo.event.which === 3) {
console.log('Right mouse button clicked')
}
Function calculateSeeds
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
calculateSeeds: function (options) {
var tiles = []
// Get the tiles that need to be bombed
if (options.radius > 1) {