Showing 258 of 421 total issues
Function checkGameSession
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
checkGameSession: function () {
dbHelpers.checkGameActive(req.session.game.instanceName, function (active) {
if (active) {
UserModel.findById(req.session.userId, function (error, user) {
if (error || !user) {
Function dropSeed
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dropSeed: function (bombed, info) {
var minX = info.x1
var maxX = info.x2
var minY = info.y1
var maxY = info.y2
Function _addButton
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _addButton (button, section, callback) {
var buttons = overlay.querySelector('.buttons')
var back = buttons.querySelector('.back-button')
var clear = buttons.querySelector('.clear-button')
var next = buttons.querySelector('.next-button')
Function _move
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _move () {
/** IMPORTANT note: x and y are really flipped!!! **/ // is this true?
// First, check what step of animation we are on.
// After one animation cycle, reset steps and moves
Function renderMouse
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderMouse: function (mouse) {
var mX = mouse.cX * $game.TILE_SIZE
var mY = mouse.cY * $game.TILE_SIZE
var state = $game.$map.getTileState({ x: mouse.cX, y: mouse.cY })
Function loadTilesheets
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadTilesheets: function (num) {
var path = CivicSeed.CLOUD_PATH + '/img/game/'
var ext = '.png'
// load the images recursively until done
Function updateInformation
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateInformation: function (info) {
npcModel
.where('id').equals(info.id)
.find(function (err, result) {
if (err) {
Function loadTiles
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadTiles: function (req, res, ss) {
var tileData = require(rootDir + '/data/tiles.json')
// Set up tile data object
var data = tileData.layers // This is an array of unnamed objects, we want to name them
Function set
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
set: function(key, val, options) {
var attr, attrs, unset, changes, silent, changing, prev, current;
if (key == null) return this;
// Handle both `"key", value` and `{key: value}` -style arguments.
Function place
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function place (data) {
var bubbleEl = document.getElementById('chat-' + data.id)
var pointerEl = document.getElementById('chat-pointer-' + data.id)
var sz = bubbleEl.offsetWidth
var half = sz / 2
Function exports
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = (function () {
var _minimap = {}
var _minimapPlayerContext = null
var _minimapRadarContext = null
var _utils
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.actions = function (req, res, ss) {
req.use('session')
var UserModel = ss.service.db.model('User')
var GameModel = ss.service.db.model('Game')
- 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 init
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init: function (callback) {
// get the players info from the db, alerts other users of presence
ss.rpc('game.player.init', function (playerInfo) {
// time in seconds since 1970 or whatever
_startTime = new Date().getTime() / 1000
Function loadQuestion
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadQuestion: function (resource) {
var overlay = document.getElementById('resource-area')
var el = overlay.querySelector('.resource-question')
var form = el.querySelector('form')
var formHTML = ''
Function getTiles
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getTiles: function (data, callback) {
$map.dataLoaded = false
var x1 = data.x
var y1 = data.y
var x2 = data.x + data.numX
Function exports
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (function () {
var logCounter = new Counter()
return {
Function cheat
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function cheat (input) {
switch (input.toLowerCase()) {
case 'beam me up scotty':
case 'beam me up, Scotty!': // Legacy cheat with punctuation
cheatLog('Teleporting to botanist.')
Function trigger
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function trigger (input) {
switch (input) {
case 'FOREST':
if ($game.flags.check('teleport-forest')) {
outfitLog('Teleporting to ' + $game.world.northwest.name + '!')
Function resetDefaultData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resetDefaultData: function (model, callback) {
var collectionName = model.collection.collection.collectionName
winston.info('CS: '.blue + 'Resetting default data for collection: '.magenta + collectionName.yellow.underline + ' ...'.magenta)
Function Player
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Player (player) {
this.name = player.firstName
this.id = player._id
this.isMoving = false
this.currentStep = 0