Showing 181 of 353 total issues
Function exports
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (app) {
const mongooseConnection = {
name: 'Mongoose Connection',
checkHealth: () => {
const mongooseConnectionOkay = mongoose.connection.readyState > 0;
Function removeZwischenRundenGruppe
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function removeZwischenRundenGruppe(callback) {
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
return clsSession.run(function () {
clsSession.set('beachEventID', beachEventID);
Function exports
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function (secret) {
const mongoose = require('mongoose');
const crypto = require('crypto');
const jwt = require('jsonwebtoken');
const moment = require('moment');
- 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 fillSpielFromGruppe
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fillSpielFromGruppe(spiel, cb) {
logger.verbose('Filling Spiel Nummer %d from Gruppe', spiel.nummer);
const calculatedTeams = {
A: undefined,
B: undefined
Function EmailAbonnementsContoller
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function EmailAbonnementsContoller(email, BestaetigenDialog, NgTableParams, $state, subscribers, spielplanEnabled) {
const vm = this;
vm.loading = true;
if (!spielplanEnabled) {
Function fillSpielFromSpiel
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fillSpielFromSpiel(spiel, cb) {
logger.verbose('Filling Spiel Nummer %d from Spiel', spiel.nummer);
const calculatedTeams = {
A: undefined,
B: undefined
File mailGenerator.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module.exports = function (sendgrid, env, url, disableMails) {
const logger = require('winston').loggers.get('mailGenerator');
const _ = require('lodash');
const constants = require('./constants.js');
const ejs = require('ejs');
Function setToreNormal
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SpielSchema.methods.setToreNormal = function (toreA, toreB, cb) {
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
const self = this;
return clsSession.run(function () {
Function regenerate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
spielplanGenerator.regenerate = function (cb) {
logger.verbose('Generate Spielplan with keeping completed games');
const data = {};
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
Function fillTeamFromGruppe
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fillTeamFromGruppe(team, cb) {
logger.verbose('Filling Team %s from Gruppe', team._id);
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
return clsSession.run(function () {
Function createZwischenGruppe
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createZwischenGruppe(data, jugendid, cb) {
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
return clsSession.run(function () {
clsSession.set('beachEventID', beachEventID);
Function sendErgebnisUpdate
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
mailGenerator.sendErgebnisUpdate = function (team, spiel, emails, cb) {
logger.verbose('Sending Ergebnis-Update to %d Subscribers', emails.length);
const beachEventID = cls.getBeachEventID();
if (emails.length > 0) {
const templatePath = path.join(__dirname, emailTemplatesFolderName, 'ergebnisUpdate.ejs');
Function createFilledJugend
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createFilledJugend(req, res) {
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
return clsSession.run(function () {
clsSession.set('beachEventID', beachEventID);
Function TeamDeabonnierenController
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function TeamDeabonnierenController(aktivesTeam, email, $state, $timeout) {
const vm = this;
vm.loading = true;
vm.team = aktivesTeam;
Function exports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (app) {
const logger = require('winston').loggers.get('middlewareBadRequest');
const messages = require('./../messages/messages.js')();
const _ = require('lodash');
const helpers = require('./../helpers.js');
Function exports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (app, secret) {
const logger = require('winston').loggers.get('middlewareAuthorization');
const messages = require('./../messages/messages.js')();
const jwt = require('jsonwebtoken');
const _ = require('lodash');
Function exports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (sendgrid, env, url, disableEmails) {
const mongoose = require('mongoose');
const logger = require('winston').loggers.get('dbSetup');
const User = mongoose.model('User');
const Team = mongoose.model('Team');
Function TeamsController
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function TeamsController($state, teams, NgTableParams) {
const vm = this;
vm.loading = true;
_.extend(vm, {
teams: teams,
Function patchQueryPrototype
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function patchQueryPrototype() {
var Query = mongoose.Query
, _exec = Query.prototype.exec
if (mongoose.Query.prototype.deepPopulate != null) {
Function TeamController
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function TeamController(aktivesTeam, spiele, TeamAbonnierenDialog, email, $state, toastr, gruppe, anmeldung, auth, spielplanEnabled) {
const vm = this;
vm.loading = true;
if (!aktivesTeam.name) {