BerniWittmann/spielplanismaning

View on GitHub

Showing 351 of 353 total issues

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

module.exports = function () {
    const logger = require('winston').loggers.get('api');
    function send(obj, res) {
        let level = 'warn';
        if (obj.STATUSCODE < 400) {
Severity: Major
Found in src/routes/messages/messages.js - About 4 hrs to fix

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

    module.exports = function (payload, cb) {
        const properties = helper.configureProperties(payload);
        const plaetze = properties.plaetze,
            zeiten = properties.zeiten,
            gruppen = properties.gruppen,
    Severity: Major
    Found in src/routes/spielplanGenerator/generateGruppenPhase.js - About 4 hrs to fix

      Function SlugsContoller has 108 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function SlugsContoller(jugenden, gruppen, teams, NgTableParams, $state, $scope, auth, veranstaltungen) {
              const vm = this;
              vm.loading = true;
              const originalTooltipText = 'Klick zum Kopieren';
      
      
      Severity: Major
      Found in src/public/templates/event/verwaltung/slugs/slugs.js - About 4 hrs to fix

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

        module.exports = function () {
            const logger = require('winston').loggers.get('apiSpiele');
            const express = require('express');
            const router = express.Router();
            const cls = require('../config/cls.js');
        Severity: Major
        Found in src/routes/spielplan.js - About 4 hrs to fix

          Function SpielController has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function SpielController($state, aktivesSpiel, spiel, spielModus, auth, $stateParams, toastr, spielplanEnabled) {
                  const vm = this;
                  vm.loading = true;
          
                  if (!aktivesSpiel.complex || !aktivesSpiel.complex.hz1 || !aktivesSpiel.complex.hz2 || !aktivesSpiel.complex.hz3) {
          Severity: Major
          Found in src/public/templates/event/spiel/spiel.ui.js - About 4 hrs to fix

            Function exports has 98 lines of code (exceeds 25 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: Major
            Found in src/models/Users.js - About 3 hrs to fix

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              SpielSchema.methods.setPunkteB = function (punkteB, cb) {
                  const beachEventID = cls.getBeachEventID();
                  const clsSession = cls.getNamespace();
                  const self = this;
                  return clsSession.run(function () {
              Severity: Major
              Found in src/models/Spiele.js and 3 other locations - About 3 hrs to fix
              src/models/Spiele.js on lines 290..301
              src/models/Spiele.js on lines 303..314
              src/models/Spiele.js on lines 385..396

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              SpielSchema.methods.setToreA = function (toreA, cb) {
                  const beachEventID = cls.getBeachEventID();
                  const clsSession = cls.getNamespace();
                  const self = this;
                  return clsSession.run(function () {
              Severity: Major
              Found in src/models/Spiele.js and 3 other locations - About 3 hrs to fix
              src/models/Spiele.js on lines 303..314
              src/models/Spiele.js on lines 385..396
              src/models/Spiele.js on lines 398..409

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              SpielSchema.methods.setToreB = function (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 and 3 other locations - About 3 hrs to fix
              src/models/Spiele.js on lines 290..301
              src/models/Spiele.js on lines 385..396
              src/models/Spiele.js on lines 398..409

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              SpielSchema.methods.setPunkteA = function (punkteA, cb) {
                  const beachEventID = cls.getBeachEventID();
                  const clsSession = cls.getNamespace();
                  const self = this;
                  return clsSession.run(function () {
              Severity: Major
              Found in src/models/Spiele.js and 3 other locations - About 3 hrs to fix
              src/models/Spiele.js on lines 290..301
              src/models/Spiele.js on lines 303..314
              src/models/Spiele.js on lines 398..409

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function AddZwischengruppeController has 90 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function AddZwischengruppeController($scope, $uibModalInstance, gewJugend, gruppe, $rootScope, $timeout) {
                      const vm = this;
              
                      if($rootScope.spielplanEnabled) {
                          $timeout(function () {

                Function exports has a Cognitive Complexity of 25 (exceeds 5 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 3 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 generateZwischenGruppen has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateZwischenGruppen(gruppen, jugendid, maxTeamsAdvance, callback) {
                    const gruppenLength = gruppen.length;
                    const relevantGruppen = [];
                    if (gruppenLength <= 2) {
                        return callback(null, []);
                Severity: Major
                Found in src/routes/spielplanGenerator/helper.js - About 3 hrs to fix

                  Function TurnierImportController has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function TurnierImportController($scope, $uibModalInstance, importedJugend, gewJugend, jugend) {
                          const vm = this;
                  
                          _.extend(vm, {
                              jugend: gewJugend,
                  Severity: Major
                  Found in src/public/components/turnier-import-modal/turnier-import-modal.ui.js - About 3 hrs to fix

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

                    module.exports = function (payload, cb) {
                        const properties = helper.configureProperties(payload);
                        const plaetze = properties.plaetze,
                            zeiten = properties.zeiten,
                            gruppen = properties.gruppen,
                    Severity: Minor
                    Found in src/routes/spielplanGenerator/generateGruppenPhase.js - About 3 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 JugendPanelController has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function JugendPanelController(auth, gruppe, jugend, GruppeEditierenDialog, spielplan, $state, $scope, BestaetigenDialog, AddZwischengruppeDialog, $rootScope) {
                            const vm = this;
                            vm.loading = true;
                    
                            _.extend(vm, {
                    Severity: Major
                    Found in src/public/components/jugend-panel/jugend-panel.ui.js - About 3 hrs to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                          if (spiel.toreA > spiel.toreB) {
                                              return clsSession.run(function () {
                                                  clsSession.set('beachEventID', beachEventID);
                      
                                                  spiel.setPunkte(2, 0, function (err, spiel) {
                      Severity: Major
                      Found in src/models/Spiele.js and 1 other location - About 3 hrs to fix
                      src/models/Spiele.js on lines 127..155

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 105.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                          } else if (spiel.toreA < spiel.toreB) {
                                              return clsSession.run(function () {
                                                  clsSession.set('beachEventID', beachEventID);
                      
                                                  spiel.setPunkte(0, 2, function (err, spiel) {
                      Severity: Major
                      Found in src/models/Spiele.js and 1 other location - About 3 hrs to fix
                      src/models/Spiele.js on lines 112..155

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 105.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Function SpieleDruckController has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function SpieleDruckController($state, spiele, spiel, $scope, $rootScope, mannschaftslisten) {
                              const vm = this;
                              vm.loading = true;
                      
                              vm.mode = 'all';

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

                        module.exports = function (sendgrid, env, url, disableEmails) {
                            const logger = require('winston').loggers.get('apiEmail');
                            const express = require('express');
                            const router = express.Router();
                        
                        
                        Severity: Major
                        Found in src/routes/email.js - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language