Showing 160 of 452 total issues
Function blur .addItemForm
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'blur .addItemForm' (evt, tmpl) {
if (!tmpl.data.isEditable) {
throw new Meteor.Error('illegal-state', 'Tried to call an illegal event in read-only mode');
}
Function statisticsDetails
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let statisticsDetails = function (minMinutesCount = 2, minTopicsCount = 5) { //eslint-disable-line
let MS = MeetingSeriesSchema.find();
let MScount = 0;
let MinutesCount = 0;
let TopicCount = 0;
Function e2e.resetMyApp
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'e2e.resetMyApp'(skipUsersCreation) {
console.log('-------------------------- E2E-METHOD: resetMyApp ');
AttachmentsCollection.remove({});
console.log('Count AttachmentsCollection after reset:'+AttachmentsCollection.find().count());
// remove the meeting series attachment dir
Function createItem
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createItem(itemDoc, parentTopic, minutesId, meetingSeries, type = 'infoItem', labels = []) {
itemDoc.labels = convertOrCreateLabelsFromStrings(labels, meetingSeries);
if (!itemDoc.createdInMinute) {
itemDoc.createdInMinute = minutesId;
Function updateCheck
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let updateCheck = function (forceReport) {
HTTP.get(url, {}, function (error, result) {
if (error || !result.data || !result.data.tag) {
// Swallow silently.
// If we can't check the version - we will not bother the admin...
Function doImport
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doImport (db, msID, usrMap) {
return new Promise((resolve, reject) => {
db.collection('meetingSeries')
.findOne({_id: msID})
.then(doc => {
Function doExport
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doExport (db, msID, userIDs) {
return new Promise((resolve, reject) => {
db.collection('minutes')
.find({meetingSeries_id: msID})
.toArray()
Function docMatchesFilterTokens
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
docMatchesFilterTokens(doc, filterTokens) {
for (let i=0; i < filterTokens.length; i++) {
let filter = filterTokens[i];
switch (filter.key) {
- 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 doExport
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doExport (db, msID, userIDsFlat) {
return new Promise((resolve, reject) => {
userIDsFlat = Object.keys(userIDsFlat);
let userIDsOuputMap = {};
Function users.admin.registerUser
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'users.admin.registerUser'(username, longname, email, password1, password2, sendMail, sendPassword) {
console.log('users.admin.registerUser for user: '+username);
// #Security: Only logged in admin may invoke this method: users.admin.registerUser
if (! Meteor.userId()) {
throw new Meteor.Error('Cannot register user', 'User not logged in.');
Function doImport
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doImport (db, msID, usrMap) {
return new Promise((resolve, reject) => {
const attachmentFile = msID + ExpImpFilesAttachments.FILENAME_POSTFIX;
let AllAttachmentsDoc = undefined;
try {
Function doImport
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doImport (db, msID, usrMap) {
return new Promise((resolve, reject) => {
const protFile = msID + ExpImpFilesDocuments.FILENAME_POSTFIX;
let AllProtocolsDoc = undefined;
try {
Function submit #frmDlgAddInfoItem
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'submit #frmDlgAddInfoItem': async function(evt, tmpl) {
let saveButton = $('#btnInfoItemSave');
try {
saveButton.prop('disabled', true);
Function doImport
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static doImport (db, msID, usrMap) {
return new Promise((resolve, reject) => {
const topFile = msID + ExpImpTopics.FILENAME_POSTFIX;
let AllTopicsDoc = undefined;
try {
Function updateTopicSorting
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let updateTopicSorting = function (event, ui) {
const draggedTopicID = $(ui.item).attr('data-id');
if (!draggedTopicID) {
return;
}
Function notifyOnRoleChange
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const notifyOnRoleChange = function(usersWithRolesAfterEdit, meetingSeriesId) {
function sendEmail (userId, oldRole, newRole, meetingSeriesId) {
Meteor.call('meetingseries.sendRoleChange', userId, oldRole, newRole, meetingSeriesId);
}
Function _insertUsers
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let _insertUsers = function (client, mongoUri, users) {
// unique id from the random package also used by minimongo
// character list: https://github.com/meteor/meteor/blob/release/METEOR%401.4.0.1/packages/random/random.js#L88
// string length: https://github.com/meteor/meteor/blob/release/METEOR%401.4.0.1/packages/random/random.js#L197
const randomStringConfig = {
Function minutes.addTopic
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'minutes.addTopic'(minutesId, doc, insertPlacementTop) {
check(minutesId, String);
console.log(`addTopic to minute: ${minutesId}`);
// Make sure the user is logged in before changing collections
Function workflow.finalizeMinute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
'workflow.finalizeMinute'(id, sendActionItems, sendInfoItems) {
console.log('workflow.finalizeMinute on ' + id);
check(id, String);
let minutes = new Minutes(id);
Function docMatchesFilterTokens
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
docMatchesFilterTokens(doc, filterTokens) {
for (let i=0; i < filterTokens.length; i++) {
let filter = filterTokens[i];
switch (filter.key) {