Showing 258 of 421 total issues
Function loadUsers
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadUsers: function (req, res, ss) {
var userData = require(rootDir + '/data/users.json')
var userDataCopy = _JSONClone(userData)
var numDemoUsers = 16
var demoUsers = []
File admin.js
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
/* global ss, $, apprise */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
File data.tangrams.js
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Ideally, this is JSON, and is formatted as such
// But the browserify module bundled with socketstream
// does not currently support JSON, so we just
// manually attach it to module.exports
Function addContent
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
addContent: function (section) {
var overlay = document.getElementById('boss-area')
var speakerEl = overlay.querySelector('.dialog .speaker')
var messageEl = overlay.querySelector('.dialog .message')
var speaker = $game.$botanist.name
File game.map.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
/* global ss, $, $game */
var _nextTiles = []
var _leftEdge = 0
Function actions
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
exports.actions = function (req, res, ss) {
req.use('session')
req.use('account.authenticated')
var userModel = ss.service.db.model('User')
- 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 loadMiddleware
has a Cognitive Complexity of 22 (exceeds 5 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')
- 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 showSpeechBubble
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
showSpeechBubble: function (speaker, messages, prompt, callback) {
var el = document.getElementById('speech-bubble')
var $el = $(el) // Cache jQuery reference
var hasPrompt = false
var isMultiline = false
Function _processResumeAnswers
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _processResumeAnswers (data) {
for (var i = 0; i < data.resources.length; i++) {
var resource = data.resources[i]
if (resource.questionType === 'resume') {
var answer = resource.answers[0]
Function _addButton
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _addButton (button, section, slide, callback) {
var buttons = overlay.querySelector('.buttons')
var back = buttons.querySelector('.back-button')
var next = buttons.querySelector('.next-button')
var answer = buttons.querySelector('.answer-button')
exports
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
var $render = module.exports = {
ready: false,
colors: {
Function init
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function init () {
// Display share link
showCurrentURIWithoutPrefix()
// Set up all event listeners
Function showPlayerAnswers
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function showPlayerAnswers (index) {
var resources = players[index].game.resources
var numNPC = allQuestions.length
var html = '<h2>' + players[index].firstName + ' ' + players[index].lastName + '</h2>'
- 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 newGameInstance
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
newGameInstance: function (info) {
gameModel
.where('instanceName').equals(info.instanceName)
.select('instanceName')
.find(function (err, results) {
Function createCanvasForPlayer
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
createCanvasForPlayer: function (id, skinSuit, playerColor) {
var context = _offscreenPlayersContext[id]
// If player's canvas currently exists, clear it
if (context) {
Function _move
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. 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
- 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 dropSeed
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
dropSeed: function (options) {
if (options.x !== undefined && options.x >= 0) {
options.mX = $game.$map.currentTiles[options.x][options.y].x
options.mY = $game.$map.currentTiles[options.x][options.y].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 exports
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (function () {
// Private - holder of graph tiles for current screen
var _graph
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 checkPuzzleAnswer
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkPuzzleAnswer: function () {
var allTangrams = $('.puzzle-svg > path')
var correct = true
var numRight = 0
var aLength = $botanist.tangram[$game.$player.currentLevel].answer.length
File account.js
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
var rootDir = process.cwd()
var bcrypt = require('bcrypt')
var xkcd = require('xkcd-pwgen')