Showing 13 of 124 total issues
Function up
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function (knex) {
return knex.schema
.createTable('Faceoffs', (t) => {
t.increments('ID');
t.integer('Points').notNullable();
Function fileUploadHandler
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fileUploadHandler = async (req, res, next) => {
// Create a new instance of a multiparty form object
const form = new multiparty.Form();
// Parse the form data from the request body into multiparty
form.parse(req, async (error, fields, files) => {
Function up
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function (knex) {
return knex.schema
.createTable('Submissions', (t) => {
t.increments('ID');
t.integer('ChildID')
Function up
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function (knex) {
return knex.schema
.createTable('Squads', (t) => {
// Squads table just creates a point of reference to connect teams
t.increments('ID');
Function getFaceoffsForSquad
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const getFaceoffsForSquad = (SquadID, ChildID = null) => {
// return db.transaction(async (trx) => {
// try {
// // Get the faceoffs from the Faceoffs table in the db
// const faceoffs = await faceoff.getSubIdsForFaceoffs(trx, SquadID);
- 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 up
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.up = function (knex) {
return knex.schema
.createTable('Parents', (t) => {
t.increments('ID');
t.string('Name').notNullable();
Function send
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const send = (res, error, name = '') => {
console.log({ error: error.message });
let status, message;
if (error.message.includes('NotFound')) {
status = 404;
Function getLeaderBoardData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getLeaderBoardData = async () =>{
const output = []
const derivedTable = await db('Children AS C')
Function VSequence
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const VSequence = (squads, data) =>{
//pull squad keys that which are equivilent to squad numbers
let allSquadNums = Object.keys(squads)
//converts all indecies into integers
let formatedSquadNum = []
Function formatTeam
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const formatTeam = (submissions) => {
// Initialize response object
const team = {};
// Iterate over submission pages
submissions.forEach(
Function incrementVotesCasted
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const incrementVotesCasted =(squads, ID, FO) =>{
let iSquads = squads[`${ID}`]
let newArr = []
let returnObject = {}
iSquads.forEach(s =>{
Function clusterGeneration
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const clusterGeneration = () => {
return db.transaction(async (trx) => {
try {
const dsReq = {};
// Pull a list of all cohorts
- 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 submitVote
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const submitVote = (vote) => {
// return db('Votes').insert(vote).returning('ID');
return db.transaction(async (trx) => {
try {
const { Vote, MemberID, FaceoffID, subEmojis1, subEmojis2 } = vote;
- 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"