Showing 258 of 421 total issues
Function debounce
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
var later = function() {
var last = _.now() - timestamp;
Function endGameEmails
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
endGameEmails: function (instanceName) {
// set boss mode unlocked here for specific instance
// send out emails to players who have completed game
_userModel
Function pledgeSeed
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
pledgeSeed: function (info) {
_userModel.findById(info.id, function (err, user) {
if (err) {
console.log(err)
} else if (user) {
Function startGame
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
startGame: function (ingame) {
if ($game.bossModeUnlocked && $game.$player.currentLevel > 3) {
$game.$boss.init()
}
Function loadOtherTrack
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadOtherTrack: function (track, num) {
if (track !== num) {
var mp3 = _musicPath + track + '.mp3?VERSION='
var ogg = _musicPath + '/ogg/' + '.ogg?VERSION='
Function beginTransition
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
beginTransition: function () {
// Verify that the player is at the edge of a screen
// Refuse transition if player is not at a transitional edge
// This catches bugs
var position = $game.$player.getLocalPosition()
Function move
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function move () {
var currentStepIncX = _info.d
var currentStepIncY = 0
if (_onScreen) {
Function deAuthenticate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
deAuthenticate: function () {
winston.info('Deauthenticating...')
// console.log(req.session.firstName, req.session.email, req.session.role, req.session.gameChannel, req.session.userId);
var sessionId = req.sessionId
Function remindMeMyPassword
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
remindMeMyPassword: function (email) {
UserModel.findOne({ email: email }, function (err, user) {
if (!err && user) {
// TODO THIS AUTO RESETS without creds!!
var password = xkcd.generatePassword()
Function _setPlayerInformation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _setPlayerInformation (info) {
// Ensure that flags start from a clean state
$game.flags.unsetAll()
// private
Function checkState
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function saveOtherCommunityResources
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
saveOtherCommunityResources: function (answeredResourceId) {
// Hack for community inventory items
// Dummy data for other resources
var ids = [4001, 4002, 4003]
var bunchOfResources = []
Function onTangramDrag
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onTangramDrag: function (d) {
var x = d3.event.sourceEvent.layerX
var y = d3.event.sourceEvent.layerY
// mX = d3.event.x
// mY = d3.event.y
Function nextLevel
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
nextLevel: function () {
$player.currentLevel += 1
$player.seenRobot = false
$game.$botanist.setState(0)
$game.flags.unset('botanist-teleported')
Function Npc
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Npc (data) {
this.name = data.name
this.id = data.id
this.sprite = data.sprite
this.level = data.level
Function loadEnvironmentLoopFx
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
loadEnvironmentLoopFx: function () {
var mp3 = _musicPath + 'environmentloop.mp3?VERSION='
var ogg = _musicPath + '/ogg/environmentloop.ogg?VERSION='
if (_extension) {
Function renderTile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderTile: function (i, j) {
// get the index (which refers to the location of the image)
// tilemap reference to images starts at 1 instead of 0
var curTile = $game.$map.currentTiles[i][j]
var backIndex1 = curTile.background - 1
Consider simplifying this complex logical expression. Open
Open
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))
&& ('constructor' in a && 'constructor' in b)) {
return false;
}
Function enterGame
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
enterGame: function (callback) {
// Check if they are ACTUALLY playing
ss.rpc('shared.account.checkGameSession', function (response) {
// YOU KNOW, THIS COULD ALL HAPPEN ELSEWHERE?
if (!$game.instantiated) {
- 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 loadOtherTrack
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
loadOtherTrack: function (track, num) {
if (track !== num) {
var mp3 = _musicPath + track + '.mp3?VERSION='
var ogg = _musicPath + '/ogg/' + '.ogg?VERSION='
- 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"