mondora/mondora-website-back

View on GitHub

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({
Severity: Minor
Found in server/models/posts/methods.js - About 4 hrs to fix

    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);
    
    
    Severity: Major
    Found in server/models/posts/methods.js - About 2 hrs to fix

      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
              };
      Severity: Minor
      Found in server/miscMethods/formSubmitActions.js - About 2 hrs to fix

        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) {
        Severity: Minor
        Found in server/cron/downloadStravaActivities.js - About 1 hr to fix

          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");
                  }
          Severity: Minor
          Found in server/models/posts/methods.js - About 1 hr to fix

            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: {
            Severity: Minor
            Found in server/cron/weeklyDigest.js - About 1 hr to fix

              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;
              Severity: Minor
              Found in server/models/tasks/methods.js - About 1 hr to fix

                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
                Severity: Minor
                Found in server/models/posts/methods.js - About 1 hr to fix

                  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) {
                  Severity: Minor
                  Found in server/models/posts/methods.js - About 1 hr to fix

                    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) {
                    Severity: Minor
                    Found in server/models/channels/methods.js - About 1 hr to fix

                      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: [
                                  {
                      Severity: Minor
                      Found in server/models/channels/permissions.js - About 1 hr to fix

                        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)
                                    });
                        Severity: Minor
                        Found in server/routes/presences.js - About 1 hr to fix

                          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: [
                                      {
                          Severity: Minor
                          Found in server/models/posts/permissions.js - About 1 hr to fix

                            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
                            Severity: Minor
                            Found in server/models/posts/methods.js - About 1 hr to fix

                              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);
                              Severity: Minor
                              Found in server/cron/weeklyDigest.js - About 1 hr to fix

                                Function method has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    method: function (form, recipients, name, description, eta, tags) {
                                Severity: Minor
                                Found in server/miscMethods/formSubmitActions.js - About 45 mins to fix

                                  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);
                                  
                                  
                                  Severity: Minor
                                  Found in server/models/posts/methods.js - About 35 mins to fix

                                  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: {
                                  Severity: Minor
                                  Found in server/cron/weeklyDigest.js - About 25 mins to fix

                                  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) {
                                  Severity: Minor
                                  Found in server/models/channels/methods.js - About 25 mins to fix

                                  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) {
                                  Severity: Minor
                                  Found in server/models/posts/methods.js - About 25 mins to fix

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language