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';
}
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 () {
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: '',
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, {
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 = {
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();
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',
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) {
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;
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);
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');
- Read upRead up
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
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
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');
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 () {
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();
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 () {