BerniWittmann/spielplanismaning

View on GitHub

Showing 181 of 353 total issues

Function exports has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (app) {
    const mongooseConnection = {
        name: 'Mongoose Connection',
        checkHealth: () => {
            const mongooseConnectionOkay = mongoose.connection.readyState > 0;
Severity: Major
Found in src/routes/middleware/healthChecks.js - About 2 hrs to fix

    Function removeZwischenRundenGruppe has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function removeZwischenRundenGruppe(callback) {
        const beachEventID = cls.getBeachEventID();
        const clsSession = cls.getNamespace();
        return clsSession.run(function () {
            clsSession.set('beachEventID', beachEventID);
    Severity: Major
    Found in src/routes/spielplanGenerator/helper.js - About 2 hrs to fix

      Function exports has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (secret) {
          const mongoose = require('mongoose');
          const crypto = require('crypto');
          const jwt = require('jsonwebtoken');
          const moment = require('moment');
      Severity: Minor
      Found in src/models/Users.js - About 2 hrs to fix

      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

      function fillSpielFromGruppe(spiel, cb) {
          logger.verbose('Filling Spiel Nummer %d from Gruppe', spiel.nummer);
          const calculatedTeams = {
              A: undefined,
              B: undefined
      Severity: Major
      Found in src/routes/helpers.js - About 2 hrs to fix

        Function EmailAbonnementsContoller has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        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

          function fillSpielFromSpiel(spiel, cb) {
              logger.verbose('Filling Spiel Nummer %d from Spiel', spiel.nummer);
              const calculatedTeams = {
                  A: undefined,
                  B: undefined
          Severity: Major
          Found in src/routes/helpers.js - About 2 hrs to fix

            File mailGenerator.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            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');
            Severity: Minor
            Found in src/routes/mailGenerator/mailGenerator.js - About 2 hrs to fix

              Function setToreNormal has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              SpielSchema.methods.setToreNormal = function (toreA, toreB, cb) {
                  const beachEventID = cls.getBeachEventID();
                  const clsSession = cls.getNamespace();
                  const self = this;
                  return clsSession.run(function () {
              Severity: Major
              Found in src/models/Spiele.js - About 2 hrs to fix

                Function regenerate has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    spielplanGenerator.regenerate = function (cb) {
                        logger.verbose('Generate Spielplan with keeping completed games');
                        const data = {};
                        const beachEventID = cls.getBeachEventID();
                        const clsSession = cls.getNamespace();
                Severity: Major
                Found in src/routes/spielplanGenerator/spielplanGenerator.js - About 2 hrs to fix

                  Function fillTeamFromGruppe has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  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 () {
                  Severity: Major
                  Found in src/routes/helpers.js - About 2 hrs to fix

                    Function createZwischenGruppe has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function createZwischenGruppe(data, jugendid, cb) {
                            const beachEventID = cls.getBeachEventID();
                            const clsSession = cls.getNamespace();
                            return clsSession.run(function () {
                                clsSession.set('beachEventID', beachEventID);
                    Severity: Major
                    Found in src/routes/gruppen.js - About 2 hrs to fix

                      Function sendErgebnisUpdate has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      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');
                      Severity: Major
                      Found in src/routes/mailGenerator/mailGenerator.js - About 2 hrs to fix

                        Function createFilledJugend has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function createFilledJugend(req, res) {
                                const beachEventID = cls.getBeachEventID();
                                const clsSession = cls.getNamespace();
                                return clsSession.run(function () {
                                    clsSession.set('beachEventID', beachEventID);
                        Severity: Major
                        Found in src/routes/jugenden.js - About 2 hrs to fix

                          Function TeamDeabonnierenController has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          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

                            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');
                            Severity: Minor
                            Found in src/routes/middleware/badRequestHandler.js - About 1 hr to fix

                              Function exports has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              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');
                              Severity: Minor
                              Found in src/routes/middleware/authorization.js - About 1 hr to fix

                                Function exports has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                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');
                                Severity: Minor
                                Found in src/config/setup-db.js - About 1 hr to fix

                                  Function TeamsController has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function TeamsController($state, teams, NgTableParams) {
                                          const vm = this;
                                          vm.loading = true;
                                          _.extend(vm, {
                                              teams: teams,
                                  Severity: Minor
                                  Found in src/public/templates/event/tgj/teams/teams.ui.js - About 1 hr to fix

                                    Function patchQueryPrototype has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function patchQueryPrototype() {
                                        var Query = mongoose.Query
                                          , _exec = Query.prototype.exec
                                    
                                        if (mongoose.Query.prototype.deepPopulate != null) {
                                    Severity: Minor
                                    Found in src/config/mongoose-deep-populate.js - About 1 hr to fix

                                      Function TeamController has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          function TeamController(aktivesTeam, spiele, TeamAbonnierenDialog, email, $state, toastr, gruppe, anmeldung, auth, spielplanEnabled) {
                                              const vm = this;
                                              vm.loading = true;
                                      
                                              if (!aktivesTeam.name) {
                                      Severity: Minor
                                      Found in src/public/templates/event/tgj/teams/team/team.ui.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language