Showing 435 of 452 total issues
Function onBeforeUpload
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
onBeforeUpload: function (file) {
if (! GlobalSettings.getAttachmentsEnabled()) {
return 'Upload not allowed in settings.json';
}
// Check if this upload candidate is allowed by size and extension
Identical blocks of code found in 2 locations. Consider refactoring. Open
let _connectMongo = function (mongoUrl) {
return new Promise((resolve, reject) => {
mongo.connect(mongoUrl, (error, db) => {
if (error) {
reject(error);
- 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 67.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
let _connectMongo = function (mongoUrl) {
return new Promise((resolve, reject) => {
mongo.connect(mongoUrl, (error, db) => {
if (error) {
reject(error);
- 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 67.
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 onBeforeUpload
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
onBeforeUpload: function (file) {
if (! GlobalSettings.getAttachmentsEnabled()) {
return 'Upload not allowed in settings.json';
}
// Check if this upload candidate is allowed by size and extension
- 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 notifyOnRoleChange
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const notifyOnRoleChange = function(usersWithRolesAfterEdit, meetingSeriesId) {
function sendEmail (userId, oldRole, newRole, meetingSeriesId) {
Meteor.call('meetingseries.sendRoleChange', userId, oldRole, newRole, meetingSeriesId);
}
- 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 removeIsEditedMinute
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function removeIsEditedMinute(minuteId, ignoreLock) {
let minute = new Minutes(minuteId);
for (let topic of minute.topics) {
if (ignoreLock === true) {
topic.isEditedBy = null;
Function docMatchesFilterTokens
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
docMatchesFilterTokens(doc, filterTokens) {
for (let i=0; i < filterTokens.length; i++) {
let filter = filterTokens[i];
switch (filter.key) {
Function preImportCheck
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
static preImportCheck (db, msID, force=false) {
return new Promise((resolve, reject) => {
db.collection('migrations')
.findOne()
.then(doc => {
Function responsiblesSearch
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
'responsiblesSearch' (partialName, participants) {
check(partialName, String);
let results_participants = []; // get all the participants for the minute
let foundPartipantsNames = [];
Function users.editProfile
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
'users.editProfile'(userId, eMail, longName) {
check(eMail, String);
check(longName, String);
if (! Meteor.userId()) {
throw new Meteor.Error('Cannot edit profile', 'User not logged in.');
Function send
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
send() {
let emailFrom = this._moderator.emails;
let modFrom = (emailFrom && emailFrom.length > 0)
? emailFrom[0].address
: GlobalSettings.getDefaultEmailSenderAddress();
Function _fetchLDAPUsers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
let _fetchLDAPUsers = function (connection) {
let client = connection.client,
settings = connection.settings,
base = settings.serverDn,
searchDn = _.get(settings, 'propertyMap.username', 'cn'),
Function blur .addItemForm
has 38 lines of code (exceeds 25 allowed). Consider refactoring. 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
let statisticsDetails = function (minMinutesCount = 2, minTopicsCount = 5) { //eslint-disable-line
let MS = MeetingSeriesSchema.find();
let MScount = 0;
let MinutesCount = 0;
let TopicCount = 0;
Similar blocks of code found in 2 locations. Consider refactoring. Open
AttachmentsCollection.remove({'meta.meetingminutes_id': minutes_id},
function (error) {
if (error) {
console.error('File wasn\'t removed, error: ' + error.reason);
} else {
- 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 65.
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
AttachmentsCollection.remove({'meta.parentseries_id': meetingseries_id},
function (error) {
if (error) {
console.error('File wasn\'t removed, error: ' + error.reason);
} else {
- 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 65.
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 e2e.resetMyApp
has 37 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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...
Similar blocks of code found in 2 locations. Consider refactoring. Open
'click .btnToggleAIState'(evt, tmpl) {
performActionForItem(evt, tmpl, (item) => {
if (item instanceof ActionItem) {
item.toggleState();
item.save().catch(handleError);
- 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 64.
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