BerniWittmann/spielplanismaning

View on GitHub

Showing 351 of 353 total issues

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

function loadTeams(store, cb) {
    const beachEventID = cls.getBeachEventID();
    const clsSession = cls.getNamespace();
    return clsSession.run(function () {
        clsSession.set('beachEventID', beachEventID);
Severity: Major
Found in src/routes/spielImporter/importer.js and 2 other locations - About 1 hr to fix
src/routes/spielImporter/importer.js on lines 56..64
src/routes/spielImporter/importer.js on lines 66..74

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

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 3 locations. Consider refactoring.
Open

function loadJugenden(store, cb) {
    const beachEventID = cls.getBeachEventID();
    const clsSession = cls.getNamespace();
    return clsSession.run(function () {
        clsSession.set('beachEventID', beachEventID);
Severity: Major
Found in src/routes/spielImporter/importer.js and 2 other locations - About 1 hr to fix
src/routes/spielImporter/importer.js on lines 46..54
src/routes/spielImporter/importer.js on lines 66..74

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

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

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

    function addSpiele(spiele, 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 Logger has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Logger(LOG_PREFIX, LOG_MAX_STRING_LENGTH) {
              let LOGGING_ENABLED = false;
      
              return {
                  log: function (text) {
      Severity: Minor
      Found in src/public/services/logger.js - About 1 hr to fix

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

        SpielSchema.methods.setToreComplex = function (data, cb) {
            if (!data.complex || !data.complex.hz1 || !data.complex.hz2) {
                return cb(new Error('Keine Halbzeit Daten gefunden'));
            }
        
        
        Severity: Minor
        Found in src/models/Spiele.js - About 1 hr to fix

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

              function VerwaltungAllgemeinController(auth) {
                  const vm = this;
                  vm.loading = true;
          
                  //noinspection JSUnusedGlobalSymbols

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

            function calcSpielDateTimePresets(spielplan, nr, plaetze, delays) {
                const startDatum = moment(spielplan.startdatum, 'DD.MM.YYYY');
                const dailyStartTime = moment(spielplan.startzeit, 'HH:mm');
                const dailyEndTime = moment(spielplan.endzeit, 'HH:mm');
                let spielzeit, pausenzeit;
            Severity: Minor
            Found in src/routes/helpers.js - About 1 hr to fix

              Function reloadAnmeldeObjects has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function reloadAnmeldeObjects(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 AnsprechpartnerSingleController has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function AnsprechpartnerSingleController($scope, ansprechpartner, toastr) {
                        const vm = this;
                
                        _.extend(vm, {
                            kontakt: $scope.spiAnsprechpartnerSingle,

                  Function generateNew has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      spielplanGenerator.generateNew = function (cb) {
                          logger.verbose('Generate a complete new Spielplan');
                          const data = {};
                          const beachEventID = cls.getBeachEventID();
                          const clsSession = cls.getNamespace();
                  Severity: Minor
                  Found in src/routes/spielplanGenerator/spielplanGenerator.js - About 1 hr to fix

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

                    module.exports = function (app) {
                        const mongoose = require('mongoose');
                        const logger = require('winston').loggers.get('middlewareEvent');
                        const Veranstaltung = mongoose.model('Veranstaltung');
                        const constants = require('../../config/constants.js');
                    Severity: Minor
                    Found in src/routes/middleware/beachEvent.js - About 1 hr to fix

                      Function createBlankJugend has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function createGruppeWithTeams has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createGruppeWithTeams(jugendid, data, 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 createParams has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function createParams(model, docs, paths, options, lean) {
                              var rewrite = options.rewrite
                                , whitelist = options.whitelist
                                , populate = options.populate
                          
                          
                          Severity: Minor
                          Found in src/config/mongoose-deep-populate.js - About 1 hr to fix

                            Function sendSpielReminder has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                mailGenerator.sendSpielReminder = function (team, spiel, emails, cb) {
                                    logger.verbose('Sending Spiel-Reminder to %d Subscribers', emails.length);
                                    const beachEventID = cls.getBeachEventID();
                                    if (emails.length > 0) {
                                        const templatePath = path.join(__dirname, emailTemplatesFolderName, 'spielReminder.ejs');
                            Severity: Minor
                            Found in src/routes/mailGenerator/mailGenerator.js - About 1 hr to fix

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

                              module.exports = function (payload, cb) {
                                  logger.verbose('Generate End-Runde');
                                  const gruppenSpiele = payload.spiele;
                                  let newSpiele = [];
                                  const gruppenByJugend = helper.getGruppenWithSameJugend(payload.gruppen);
                              Severity: Minor
                              Found in src/routes/spielplanGenerator/generateEndRunde.js - About 1 hr to fix

                                Function generateZwischenGruppenHelper has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function generateZwischenGruppenHelper(gruppen, maxTeamsAdvance, zeiten, cb) {
                                    let relevantGruppen = [];
                                    const beachEventID = cls.getBeachEventID();
                                    const clsSession = cls.getNamespace();
                                
                                
                                Severity: Minor
                                Found in src/routes/spielplanGenerator/helper.js - About 1 hr to fix

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

                                                  resolve: {
                                                      jugenden: function (aktivesEvent, jugend) {
                                                          return jugend.getAll();
                                                      },
                                                      jugendTore: function (aktivesEvent, jugend) {
                                  Severity: Major
                                  Found in src/public/templates/event/tabellen/tabellen.ui.js and 1 other location - About 1 hr to fix
                                  src/public/templates/event/verwaltung/slugs/slugs.js on lines 19..29

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

                                  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

                                          $stateProvider
                                              .state('spi.shared.verwaltung.veranstaltungen', {
                                                  url: '/veranstaltungen',
                                                  templateUrl: 'templates/shared/verwaltung/veranstaltungen/verwaltung.veranstaltungen.html',
                                                  controller: VerwaltungVeranstaltungenController,
                                  src/public/templates/shared/verwaltung/ansprechpartner/ansprechpartner.ui.js on lines 13..27

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

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language