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');
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');
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');
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');
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')
}
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();
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')
}
- 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 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');
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();
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');
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, {
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);
- 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 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
- 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('/subscriber', function (req, res) {
const beachEventID = cls.getBeachEventID();
const clsSession = cls.getNamespace();
return clsSession.run(function () {
clsSession.set('beachEventID', beachEventID);
- 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 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
- 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
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');
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');
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": {
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');
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');