BerniWittmann/spielplanismaning

View on GitHub

Showing 351 of 353 total issues

Function sortTeams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function sortTeams(teams, key, spielModel, gruppe, cb) {
    if (!key) {
        key = 'all';
    }

Severity: Major
Found in src/models/helper.js - About 3 hrs to fix

    Function fillSpiele has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function fillSpiele(callback) {
        logger.verbose('Filling Spiele with Team Infos');
        const beachEventID = cls.getBeachEventID();
        const clsSession = cls.getNamespace();
        return clsSession.run(function () {
    Severity: Major
    Found in src/routes/helpers.js - About 3 hrs to fix

      Function TeamAbonnierenController has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function TeamAbonnierenController($state, $uibModalInstance, gewTeam, email, $rootScope, $timeout) {
              const vm = this;
              vm.loading = true;
              const emptymessage = {
                  text: '',
      Severity: Major
      Found in src/public/components/team-abonnieren-modal/team-abonnieren-modal.js - About 3 hrs to fix

        Function GruppeEditierenController has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function GruppeEditierenController($state, $uibModalInstance, team, teamPromise, gewGruppe, spielplan, TeamEditierenDialog, BestaetigenDialog, $scope, anmeldung) {
                const vm = this;
                vm.loading = true;
        
                _.extend(vm, {
        Severity: Major
        Found in src/public/components/gruppe-edit-modal/gruppe-edit-modal.js - About 2 hrs to fix

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

          TeamSchema.methods.fill = function(callback) {
              const team = this;
              const beachEventID = cls.getBeachEventID();
              const clsSession = cls.getNamespace();
              const results = {
          Severity: Major
          Found in src/models/Teams.js - About 2 hrs to fix

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

            module.exports = function (env) {
                const logger = require('winston').loggers.get('apiConfig');
                const express = require('express');
                const version = require('../../package.json').version;
                const router = express.Router();
            Severity: Major
            Found in src/routes/config.js - About 2 hrs to fix

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

              module.exports = function (config) {
                  config.set({
              
                      // base path that will be used to resolve all patterns (eg. files, exclude)
                      basePath: 'src/public',
              Severity: Major
              Found in karma.conf.js - About 2 hrs to fix

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

                    function SpieleTabellenController($state, spiel, $rootScope) {
                        const vm = this;
                
                        _.extend(vm, {
                            gotoTeam: function (team, $event) {
                Severity: Major
                Found in src/public/components/spieletabelle/spieletabelle.ui.js - About 2 hrs to fix

                  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

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

                                      router.get('/spielplanEnabled', function (req, res) {
                                          return helpers.getVeranstaltungData(function (err, data) {
                                              if (err) return messages.Error(res, err);
                                              logger.verbose('Spielplan Enabled %s', data.SPIELPLAN_ENABLED);
                                              return res.json(data.SPIELPLAN_ENABLED);
                                  Severity: Major
                                  Found in src/routes/config.js and 1 other location - About 2 hrs to fix
                                  src/routes/config.js on lines 154..160

                                  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 86.

                                  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

                                      router.get('/spielmodus', function (req, res) {
                                          return helpers.getVeranstaltungData(function (err, data) {
                                              if (err) return messages.Error(res, err);
                                              logger.verbose('Spielmodus %s', data.SPIEL_MODE);
                                              return res.json(data.SPIEL_MODE);
                                  Severity: Major
                                  Found in src/routes/config.js and 1 other location - About 2 hrs to fix
                                  src/routes/config.js on lines 206..212

                                  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 86.

                                  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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language