BerniWittmann/spielplanismaning

View on GitHub

Showing 181 of 353 total issues

Function prepareSpiel has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function prepareSpiel(spiel, index, store, cb) {
    const beachEventID = cls.getBeachEventID();
    const clsSession = cls.getNamespace();
    return clsSession.run(function () {
        clsSession.set('beachEventID', beachEventID);
Severity: Minor
Found in src/routes/spielImporter/importer.js - About 1 hr to fix

    Function reset has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    SpielSchema.methods.reset = function (cb) {
        const beachEventID = cls.getBeachEventID();
        const clsSession = cls.getNamespace();
        const self = this;
        return clsSession.run(function () {
    Severity: Minor
    Found in src/models/Spiele.js - About 1 hr to fix

      Function registerMail has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mailGenerator.registerMail = function (user, cb) {
              logger.verbose('Sending Register-Mail');
              if (user) {
                  const templatePath = path.join(__dirname, emailTemplatesFolderName, 'register.ejs');
                  return fs.readFile(templatePath, 'utf-8', function (err, template) {
      Severity: Minor
      Found in src/routes/mailGenerator/mailGenerator.js - About 1 hr to fix

        Function calcSpielDateTime has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function calcSpielDateTime(nr, spielplan, delays) {
            delays = delays || {};
            logger.silly('Calculate Date and Time for a Spiel');
            if (!checkSpielplanZeitenValid(spielplan)) {
                return undefined;
        Severity: Minor
        Found in src/routes/helpers.js - About 1 hr to fix

          Function populate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function populate(opts, level, cb) {
              var docs = opts.docs
                , paths = opts.paths
                , lvlPaths = paths.filter(function (path) { return (path.split('.').length - 1) === level })
                , remained = lvlPaths.length
          Severity: Minor
          Found in src/config/mongoose-deep-populate.js - About 1 hr to fix

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

            module.exports = function () {
                const logger = require('winston').loggers.get('apiAnsprechpartner');
                const express = require('express');
                const router = express.Router();
            
            
            Severity: Minor
            Found in src/routes/ansprechpartner.js - About 1 hr to fix

              Function getEntity has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getEntity(model, population, notFoundMessage, res, req) {
                  const queryData = getEntityQuery(model, req);
                  const query = queryData.query;
                  const searchById = queryData.searchById;
                  const beachEventID = cls.getBeachEventID();
              Severity: Minor
              Found in src/routes/helpers.js - About 1 hr to fix

                Function authenticate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const authenticate = function (req, res, next) {
                        const requiredRoles = helpers.getRequiredRouteConfig(routes, req.path, req.method, 'AUTH');
                
                        logger.silly('Required Roles: ', requiredRoles);
                
                
                Severity: Minor
                Found in src/routes/middleware/authorization.js - About 1 hr to fix

                  Function VerwaltungSpielplanController has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function VerwaltungSpielplanController(spielplan, zeiten, $scope, toastr, spiele, spiel, spielplanEnabled) {
                          const vm = this;
                          vm.loading = true;
                  
                          _.extend(vm, {

                    Function VerwaltungTeamsController has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function VerwaltungTeamsController($scope, auth, jugend, spielplan, $timeout, jugenden, teams, JUGEND_FARBEN, team, turniere, TurnierImportDialog) {
                            const vm = this;
                            vm.loading = true;
                    
                            _.extend(vm, {
                    Severity: Minor
                    Found in src/public/templates/event/verwaltung/teams/verwaltung.teams.ui.js - About 1 hr to fix

                      Function fill has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function fill(entity, cb) {
                          const beachEventID = cls.getBeachEventID();
                          const clsSession = cls.getNamespace();
                          return clsSession.run(function () {
                              clsSession.set('beachEventID', beachEventID);
                      Severity: Minor
                      Found in src/routes/helpers.js - About 1 hr to fix

                        Function VerwaltungTeamsController has 11 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function VerwaltungTeamsController($scope, auth, jugend, spielplan, $timeout, jugenden, teams, JUGEND_FARBEN, team, turniere, TurnierImportDialog) {
                        Severity: Major
                        Found in src/public/templates/event/verwaltung/teams/verwaltung.teams.ui.js - About 1 hr to fix

                          Function passwordForgotMail has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              mailGenerator.passwordForgotMail = function (user, cb) {
                                  logger.verbose('Sending Password-Forgot-Email');
                                  if (user) {
                                      const templatePath = path.join(__dirname, emailTemplatesFolderName, 'passwordForgot.ejs');
                                      return fs.readFile(templatePath, 'utf-8', function (err, template) {
                          Severity: Minor
                          Found in src/routes/mailGenerator/mailGenerator.js - About 1 hr to fix

                            Function setPunkte has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            SpielSchema.methods.setPunkte = function (punkteA, punkteB, cb) {
                                const beachEventID = cls.getBeachEventID();
                                const clsSession = cls.getNamespace();
                                const self = this;
                                return clsSession.run(function () {
                            Severity: Minor
                            Found in src/models/Spiele.js - About 1 hr to fix

                              Function checkSpielChangeable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function checkSpielChangeable(spielid, cb) {
                                  const beachEventID = cls.getBeachEventID();
                                  const clsSession = cls.getNamespace();
                                  return clsSession.run(function () {
                                      clsSession.set('beachEventID', beachEventID);
                              Severity: Minor
                              Found in src/routes/helpers.js - About 1 hr to fix

                                Function handleBadRequest has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    const handleBadRequest = function (req, res, next) {
                                        const requiredKeys = helpers.getRequiredRouteConfig(routes, req.path, req.method, 'PARAMS');
                                        if (requiredKeys) {
                                            logger.silly('Required Keys', requiredKeys);
                                
                                
                                Severity: Minor
                                Found in src/routes/middleware/badRequestHandler.js - About 1 hr to fix

                                  Function bugReportMail has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      mailGenerator.bugReportMail = function (data, cb) {
                                          logger.verbose('Sending Bug-Report');
                                          const beachEventID = cls.getBeachEventID();
                                          const templatePath = path.join(__dirname, emailTemplatesFolderName, 'bugReport.ejs');
                                          return fs.readFile(templatePath, 'utf-8', function (err, template) {
                                  Severity: Minor
                                  Found in src/routes/mailGenerator/mailGenerator.js - About 1 hr to fix

                                    Function GruppeEditierenController has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        function GruppeEditierenController($state, $uibModalInstance, team, teamPromise, gewGruppe, spielplan, TeamEditierenDialog, BestaetigenDialog, $scope, anmeldung) {
                                    Severity: Major
                                    Found in src/public/components/gruppe-edit-modal/gruppe-edit-modal.js - About 1 hr to fix

                                      Function JugendPanelController has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          function JugendPanelController(auth, gruppe, jugend, GruppeEditierenDialog, spielplan, $state, $scope, BestaetigenDialog, AddZwischengruppeDialog, $rootScope) {
                                      Severity: Major
                                      Found in src/public/components/jugend-panel/jugend-panel.ui.js - About 1 hr to fix

                                        Function beachEventQueryMiddleware has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function beachEventQueryMiddleware() {
                                            const beachEventID = cls.getBeachEventID();
                                            if (!beachEventID) {
                                                if (_.includes(JSON.stringify(this.getQuery()), 'veranstaltung')) return;
                                                if (_.includes(JSON.stringify(this.getQuery()), '_id')) return;
                                        Severity: Minor
                                        Found in src/models/helper.js - About 1 hr 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language