Showing 20 of 61 total issues
File methods.js
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
/////////////////////////
// Posts API (methods) //
/////////////////////////
Meteor.methods({
Function publishCommentOfPost
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
publishCommentOfPost: function (postId, commentId) {
// Get the post
var post = Posts.findOne(postId);
Function method
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
method: function (form, recipients, name, description, eta, tags) {
var templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
Function downloadStravaActitivities
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Cron.downloadStravaActitivities = function () {
// Retrieve last activity from db
var lastActivity = StravaActivities.findOne({}, {sort: {dateUTC: -1}});
var params = {};
if (lastActivity) {
Function bookmarkPost
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
bookmarkPost: function (postId) {
var user = Meteor.user();
if (!user) {
throw new Meteor.Error("Login required");
}
Function sendWeeklyDigest
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Cron.sendWeeklyDigest = function () {
console.log("SENDING WEEKLY DIGEST...");
var selector = {
published: true,
publishedOn: {
Function addPomodoroEvent
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
addPomodoroEvent: function (taskId, pomodoroId, event) {
var user = Meteor.user() || {};
var prevStatus;
var nextStatus;
Function addCommentToPost
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
addCommentToPost: function (postId, comment) {
// Get the user
var user = Meteor.user();
// Only allow logged in users to comment
Function recommendPost
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
recommendPost: function (postId, userId, message) {
// Check arguments
check(postId, String);
check(userId, String);
if (message === null) {
Function recommendChannel
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
recommendChannel: function (channelId, userId, message) {
// Check arguments
check(channelId, String);
check(userId, String);
if (message === null) {
Function getPermissionsSelector
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
PermissionsEnum.Channels.getPermissionsSelector = function (user) {
return {
// For the channel to be selected either:
$or: [
{
Function action
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
action: function () {
var date = moment.utc({
month: parseInt(this.request.query.month, 10),
year: parseInt(this.request.query.year, 10)
});
Function getPermissionsSelector
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
PermissionsEnum.Posts.getPermissionsSelector = function (user) {
return {
// For the post to be selected either:
$or: [
{
Function getTopic
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
getTopic: function (name) {
var selector = {
// Select only published posts
published: true,
// Which have "name" as text of a first level children
Function getDelay
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var getDelay = function () {
var sum = function (array) {
return array.reduce(function (acc, num) {
return acc + num;
}, 0);
Function method
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
method: function (form, recipients, name, description, eta, tags) {
Function publishCommentOfPost
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
publishCommentOfPost: function (postId, commentId) {
// Get the post
var post = Posts.findOne(postId);
- 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 sendWeeklyDigest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Cron.sendWeeklyDigest = function () {
console.log("SENDING WEEKLY DIGEST...");
var selector = {
published: true,
publishedOn: {
- 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 recommendChannel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
recommendChannel: function (channelId, userId, message) {
// Check arguments
check(channelId, String);
check(userId, String);
if (message === null) {
- 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 recommendPost
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
recommendPost: function (postId, userId, message) {
// Check arguments
check(postId, String);
check(userId, String);
if (message === null) {
- 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"