MaazAli/phanime

View on GitHub

Showing 80 of 302 total issues

Function revisionApproved has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

    revisionApproved: function(revision) {

        // We should actually be pulling the revision from the database
        // to ensure the revision object itself hasn't been screwed up
        // during transmision. For now, we'll leave it be.
Severity: Minor
Found in server/methods/revisions.js - About 1 day 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

File anime.js has 447 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Anime = new Meteor.Collection("anime");

AnimeSchema = new SimpleSchema({
    canonicalTitle: {
        type: String,
Severity: Minor
Found in collections/anime.js - About 6 hrs to fix

    Function getMALUserList has 167 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getMALUserList: function(xmlContent) {
    
            // The user must be logged in for this function
            if (!Meteor.user())
                throw new Meteor.Error('user-required', 'User must be logged in to import MAL list');
    Severity: Major
    Found in packages/phanime-mal-import/server/methods/getUserList.js - About 6 hrs to fix

      Function revisionApproved has 133 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          revisionApproved: function(revision) {
      
              // We should actually be pulling the revision from the database
              // to ensure the revision object itself hasn't been screwed up
              // during transmision. For now, we'll leave it be.
      Severity: Major
      Found in server/methods/revisions.js - About 5 hrs to fix

        Function userFriendlyText has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            userFriendlyText: function() {
                
                var userFriendlyText;
        
                switch (this.event) {
        Severity: Major
        Found in collections/alerts.js - About 3 hrs to fix

          Function userFriendlyText has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              userFriendlyText: function() {
                  
                  var userFriendlyText;
          
                  switch (this.event) {
          Severity: Minor
          Found in collections/alerts.js - About 3 hrs 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 revisionsAnimeAddEdit has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

              revisionsAnimeAddEdit: function(anime) {
          
                  // The edited version of the anime is sent
                  check(anime, AnimeRevisionsSchema);
                  
          Severity: Minor
          Found in server/methods/revisions.js - About 3 hrs 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

          File revisions.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          Meteor.methods({
              revisionsAnimeAdd: function(anime) {
          
                  // Ensure integerity of data
                  check(anime, AnimeRevisionsSchema);
          Severity: Minor
          Found in server/methods/revisions.js - About 3 hrs to fix

            Function spoilerAlert has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              $.fn.spoilerAlert = function(opts) {
                opts = $.extend(defaults, opts || {})
                var maxBlur = opts.max
                var partialBlur = opts.partial
                var hintText = opts.hintText
            Severity: Major
            Found in packages/phanime-spoiler-alert/spoiler.js - About 2 hrs to fix

              Function revisionsAnimeAddEdit has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  revisionsAnimeAddEdit: function(anime) {
              
                      // The edited version of the anime is sent
                      check(anime, AnimeRevisionsSchema);
                      
              Severity: Major
              Found in server/methods/revisions.js - About 2 hrs to fix

                Function keypress .create-comment textarea has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    'keypress .create-comment textarea' : function (event, template) {
                        // Only execute the below code if the enter key was pressed
                        if (event.keyCode == 13 && !event.shiftKey) {
                            var commentContent = $(event.target).val().trim();
                            var parent = template.data.parent;
                Severity: Major
                Found in client/components/comments/createComment.js - About 2 hrs to fix

                  Function created has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Template.homePageSchedule.created = function() {
                      var self = this;
                      self.ready = new ReactiveVar(false);
                      self.schedule = new ReactiveVar();
                  
                  
                  Severity: Major
                  Found in packages/phanime-homepage-schedule/client/views/homePageSchedule.js - About 2 hrs to fix

                    Function calculateAnimeRatingById has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        calculateAnimeRatingById: function(animeId) {
                            // Get all the library entries for an anime
                            // We only need the rating and episodes seen fields
                            var libraryEntries = LibraryEntries.find({animeId: animeId}, {fields: {status: 1, rating: 1, episodesSeen: 1}});
                            var ratingCounts = {
                    Severity: Major
                    Found in server/methods/calculateAnimeRatingById.js - About 2 hrs to fix

                      Function uploadImageFromUrl has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          uploadImageFromUrl: function(url, contentDirectory, typeDirectory, contentId) {
                              var options;
                              var request = Meteor.npmRequire('request');
                      
                              options = {
                      Severity: Minor
                      Found in server/methods/uploads.js - About 1 hr to fix

                        Function click .libraryEntryIcons has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            'click .libraryEntryIcons' : function(event, template) {
                        
                                var icon = $(event.target);
                                var libraryEntry = template.data;
                                var anime = libraryEntry.anime();

                          Function click .libraryEntryIcons has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              'click .libraryEntryIcons' : function(event, template) {
                          
                                  var icon = $(event.target);
                                  var libraryEntry = template.data;
                                  var anime = libraryEntry.anime();

                            Function friendlyText has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                friendlyText: function() {
                                    var friendlyText = "";
                                    // if it's a libraryEntry
                                    var user = Meteor.users.findOne({_id: this.userId});
                                    if (this.type === 'libraryEntry') {
                            Severity: Minor
                            Found in collections/activity.js - About 1 hr 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 representIcon has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                representIcon: function() {
                            
                                    var icon = 'fa fa-check';
                            
                                    if (this.type === 'libraryEntry') {
                            Severity: Minor
                            Found in collections/activity.js - About 1 hr 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 friendlyText has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                friendlyText: function() {
                                    var friendlyText = "";
                                    // if it's a libraryEntry
                                    var user = Meteor.users.findOne({_id: this.userId});
                                    if (this.type === 'libraryEntry') {
                            Severity: Minor
                            Found in collections/activity.js - About 1 hr to fix

                              Function representIcon has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  representIcon: function() {
                              
                                      var icon = 'fa fa-check';
                              
                                      if (this.type === 'libraryEntry') {
                              Severity: Minor
                              Found in collections/activity.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language