BerniWittmann/spielplanismaning

View on GitHub

Showing 351 of 353 total issues

File helpers.js has 1079 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const logger = require('winston').loggers.get('apiHelper');
const async = require('async');
const messages = require('./messages/messages.js')();
const _ = require('lodash');
const handler = require('./handler.js');
Severity: Major
Found in src/routes/helpers.js - About 2 days to fix

    File helper.js has 821 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const _ = require('lodash');
    const logger = require('winston').loggers.get('spielplanGenerator');
    const mongoose = require('mongoose');
    const async = require('async');
    const moment = require('moment');
    Severity: Major
    Found in src/routes/spielplanGenerator/helper.js - About 1 day to fix

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

      module.exports = function (sendgrid, env, url, disableMails) {
          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/spiele.js - About 1 day to fix

        Function exports has 263 lines of code (exceeds 25 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: Major
        Found in src/routes/mailGenerator/mailGenerator.js - About 1 day to fix

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

          module.exports = function (mongoose) {
            if (mongoose == null) {
              throw new Error('An instance of mongoose needs passing in')
            }
          
          
          Severity: Major
          Found in src/config/mongoose-deep-populate.js - About 1 day to fix

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

            module.exports = function (sendgrid, env, url, disableEmails, secret) {
                const logger = require('winston').loggers.get('apiUsers');
                const express = require('express');
                const router = express.Router();
            
            
            Severity: Major
            Found in src/routes/users.js - About 1 day to fix

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

              module.exports = function (mongoose) {
                if (mongoose == null) {
                  throw new Error('An instance of mongoose needs passing in')
                }
              
              
              Severity: Minor
              Found in src/config/mongoose-deep-populate.js - About 1 day 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 exports has 206 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

                module.exports = function () {
                    const logger = require('winston').loggers.get('apiJugenden');
                    const express = require('express');
                    const async = require('async');
                    const router = express.Router();
                Severity: Major
                Found in src/routes/jugenden.js - About 7 hrs to fix

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

                  module.exports = function () {
                      const logger = require('winston').loggers.get('spielplanGenerator');
                      const moment = require('moment');
                      const async = require('async');
                      const _ = require('lodash');
                  Severity: Major
                  Found in src/routes/spielplanGenerator/spielplanGenerator.js - About 7 hrs to fix

                    Function SpielplanController has 177 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function SpielplanController($state, $scope, spiele, spiel, auth, toastr, anzahlPlaetze, spielModus, zeiten, spielplanEnabled) {
                            const vm = this;
                            vm.loading = true;
                    
                            _.extend(vm, {
                    Severity: Major
                    Found in src/public/templates/event/spielplan/spielplan.ui.js - About 7 hrs to fix

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

                          router.get('/', function (req, res) {
                              const beachEventID = cls.getBeachEventID();
                              const clsSession = cls.getNamespace();
                              return clsSession.run(function () {
                                  clsSession.set('beachEventID', beachEventID);
                      Severity: Major
                      Found in src/routes/spielplan.js and 1 other location - About 6 hrs to fix
                      src/routes/email.js on lines 158..174

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

                      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('/subscriber', function (req, res) {
                              const beachEventID = cls.getBeachEventID();
                              const clsSession = cls.getNamespace();
                              return clsSession.run(function () {
                                  clsSession.set('beachEventID', beachEventID);
                      Severity: Major
                      Found in src/routes/email.js and 1 other location - About 6 hrs to fix
                      src/routes/spielplan.js on lines 43..59

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

                      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

                      File Spiele.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      const mongoose = require('mongoose');
                      const Schema = mongoose.Schema;
                      const async = require('async');
                      const _ = require('lodash');
                      const cls = require('../config/cls.js');
                      Severity: Minor
                      Found in src/models/Spiele.js - About 6 hrs to fix

                        Function SpielplanSingleSpielController has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function SpielplanSingleSpielController($scope, $state, auth, spiel, BestaetigenDialog, $timeout, $rootScope) {
                                const vm = this;
                        
                                _.extend(vm, {
                                    canEdit: (auth.isAdmin() || auth.isBearbeiter()) && isSpielplanEnabled(),

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

                          module.exports = function () {
                              const logger = require('winston').loggers.get('apiTeams');
                              const express = require('express');
                              const router = express.Router();
                              const mongoose = require('mongoose');
                          Severity: Major
                          Found in src/routes/teams.js - About 5 hrs to fix

                            File routeConfig.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            const Joi = require('joi');
                            Joi.objectId = require('joi-objectid')(Joi);
                            
                            module.exports = {
                                "/api/email": {
                            Severity: Minor
                            Found in src/routes/middleware/routeConfig.js - About 5 hrs to fix

                              Function initZeiten has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function initZeiten(spielplan, zeiten, $scope, toastr, spiele) {
                                      const vm = this;
                              
                                      function newDateWithHours(h) {
                                          const d = new Date();

                                File spiele.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

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

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

                                  module.exports = function () {
                                      const logger = require('winston').loggers.get('apiVeranstaltungen');
                                      const express = require('express');
                                      const router = express.Router();
                                      const async = require('async');
                                  Severity: Major
                                  Found in src/routes/veranstaltungen.js - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language