Showing 258 of 421 total issues
Function loadRewards
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadRewards: function (resource) {
var el = document.getElementById('resource-area').querySelector('.resource-content')
var input = el.querySelector('.tagline-input input')
var npc = $game.$npc.findNpcByResourceId(resource.id)
var playerLevel = $game.$player.currentLevel
Function actions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
var chatModel = ss.service.db.model('Chat')
Function init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function (callback) {
// Get all resources
var npcs = $game.$npc.getNpcData()
$.each(npcs, function (key, npc) {
Function onTangramDrop
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
onTangramDrop: function (e) {
e.preventDefault()
e.stopPropagation()
// Fetch tangram data from the data passed through the event data transfer
Function activate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
activate: function (npcId) {
var MASTER_NPC_ID = 64
var npc = this.get(npcId)
var botanistState = $game.$botanist.getState()
Function loadSkinSuitImages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadSkinSuitImages: function (num) {
if (num === undefined) num = 0
var next = num + 1
var skinsList = $game.$skins.getSetsList()
Function chooseResumeResponses
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
chooseResumeResponses: function (data) {
var numberToGet = 4
var allResponses = _removeCurrentPlayer(data)
var theChosenOnes = []
Function resetInit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
resetInit: function () {
_curFrame = 0
_currentStepIncX = 0
_currentStepIncY = 0
_direction = 0
Function actions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
// Set up Markdown parser
var md = new Remarkable('full', {
Function update
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function () {
var trackNum = whichTrack()
var message = 'Entering '
if (_soundtracks[trackNum]._loaded && trackNum !== _currentTrack && !_midTransition) {
Function drawForegroundTile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawForegroundTile: function (tileData) {
var srcX, srcY
var tilesheetIndex = tileData.colored ? 1 : 0
if (tileData.f1 > -1) {
Function moveStraight
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
moveStraight: function (direction) {
var location
var targetPosition
var x, y
- 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 loadResponses
has a Cognitive Complexity of 11 (exceeds 5 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 = ''
- 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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
init: function () {
// When a new player has joined
ss.event.on('ss-addPlayer', function (data, chan) {
$game.$others.add(data.info)
if (data.info._id !== $game.$player.id) {
- 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 signS3Request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
signS3Request: function (playerId, file) {
winston.info('Request to upload a profile image:', playerId, file.name, file.type, file.size)
var NODE_ENV = config.get('NODE_ENV')
var S3_BUCKET = config.get('MUGSHOTS_S3_BUCKET')
Function neighbors
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Graph.prototype.neighbors = function(node) {
var ret = [],
x = node.x,
y = node.y,
grid = this.grid;
Function actions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
req.use('account.authenticated')
return {
Function bubbleUp
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
bubbleUp: function(n) {
// Look up the target element and its score.
var length = this.content.length,
element = this.content[n],
elemScore = this.scoreFunction(element);
Function loadMiddleware
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadMiddleware: function (app) {
// check if user experiences/authentic
app.before(function (req) {
var fullPath = req.fullPath
var userRole = sessionStorage.getItem('userRole')
Function makeResponsePublic
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
makeResponsePublic: function (data) {
Game.where('instanceName').equals(data.instanceName)
.find(function (err, game) {
if (err) {
winston.error('Could not find game', err)