MaazAli/phanime

View on GitHub

Showing 80 of 302 total issues

Consider simplifying this complex logical expression.
Open

                if (!anime.series_title || !anime.series_animedb_id || !anime.my_watched_episodes || !anime.my_start_date || !anime.my_finish_date || !anime.my_score || !anime.my_status || !anime.my_rewatching || !anime.my_comments)
                    throw new Meteor.Error('mal-import-failed', 'XML file format is different than expected');
Severity: Critical
Found in packages/phanime-mal-import/server/methods/getUserList.js - About 1 hr to fix

    Function click #createProfilePostBtn has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        'click #createProfilePostBtn' : function(event, template) {
            var content = $('#createProfilePostContent').val().trim();
            var user = template.data;
            var statusUpdate;
    
    

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

      Template.userLibrarySection.created = function() {
          var data = Template.currentData();
          var self = this;
      
          // These reactiveVars needed for infinite scrolling

        Function click .status-item has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            'click .status-item' : function(event, template) {
                // For some awkward reason, unable to use 
                // $(this).html() or $(this).text() .. will
                // need to examine this further, for now
                // we'll do with the .join
        Severity: Minor
        Found in client/components/anime/addLibraryEntry/addLibraryEntry.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 entriesWithContent has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            entriesWithContent: function() {
                // Let's grab all the id's
                var ids = _.pluck(this.entries, 'contentId');
        
                switch (this.type) {
        Severity: Minor
        Found in collections/customLists.js - About 1 hr to fix

          Function rendered has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Template.user.rendered = function() {
              var template = this;
              var self = this;
          
              // Grab the Top Genres chart data
          Severity: Minor
          Found in client/components/user/user.js - About 1 hr to fix

            Function updateAnimeWithMALId has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                'updateAnimeWithMALId' : function() {
                    var moment = Npm.require('moment');
                    var xml2js = Npm.require('xml2js');
                    var parseString = xml2js.parseString;
                    var amountMatched = 0;
            Severity: Minor
            Found in packages/phanime-mal-import/server/methods/updateAnimeWithMALId.js - About 1 hr to fix

              Function uploadImage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  uploadImage: function(image, imageName, imageSize, imageType, contentDirectory, typeDirectory, contentId) {
              
                      // We'll use the unix timestamp as the name of the file.
                      var imageName = uploadToS3Helpers.buildImageNameWithExtension(new Date().getTime(), imageType);
                      var key = uploadToS3Helpers.buildUploadUrl(imageName, contentDirectory, typeDirectory, contentId);
              Severity: Minor
              Found in server/methods/uploads.js - About 1 hr to fix

                Function rendered has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                Template.animeExplore.rendered = function() {
                    // Initialize the selectize plugin
                    var self = this;
                
                    $("#selectGenre").selectize({
                Severity: Minor
                Found in client/components/animeExplore/animeExplore.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 airingText has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    airingText: function() {
                        // We should check if startDate is equal to endDate
                        if (this.startDate !== undefined && this.endDate !== undefined && this.startDate === this.endDate) {
                            return "Aired on";
                        } else if (this.startDate !== undefined && this.endDate !== undefined && moment(this.startDate).year() && moment(this.endDate).year()) {
                Severity: Minor
                Found in client/components/anime/anime.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 click .libraryEntryIcons has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

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

                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 click .libraryEntryIcons has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

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

                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 click #reviewAddBtn has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    'click #reviewAddBtn' : function (event, template) {
                
                        var anime = template.data;
                
                        // Setup 
                Severity: Minor
                Found in client/components/review/reviewAdd.js - About 1 hr to fix

                  Function click #createCustomListBtn has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      'click #createCustomListBtn' : function(event, template) {
                          var title = $('#listTitle').val().trim();
                          var description = $('#listDescription').val().trim();
                          var type = "anime";
                          var privacy = $('#listPrivacy').is(":checked");

                    Function rendered has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Template.animeExplore.rendered = function() {
                        // Initialize the selectize plugin
                        var self = this;
                    
                        $("#selectGenre").selectize({
                    Severity: Minor
                    Found in client/components/animeExplore/animeExplore.js - About 1 hr to fix

                      Function click .status-item has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          'click .status-item' : function(event, template) {
                              // For some awkward reason, unable to use 
                              // $(this).html() or $(this).text() .. will
                              // need to examine this further, for now
                              // we'll do with the .join
                      Severity: Minor
                      Found in client/components/anime/addLibraryEntry/addLibraryEntry.js - About 1 hr to fix

                        Function topGenresChartData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            topGenresChartData: function(userId) {
                                this.unblock();
                                // Get the user's library entries
                                var libraryEntries  = LibraryEntries.find({userId: userId}, {fields: {animeId: 1}}).fetch();
                                // Grab the animeIds from libraryEntries
                        Severity: Minor
                        Found in server/methods/topGenresChartData.js - About 1 hr to fix

                          Function generateAnimeRecommendations has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              generateAnimeRecommendations: function(userId) {
                                  // Let's grab user's library entries.
                                  var libraryEntries = LibraryEntries.find({userId: userId}).fetch();
                          
                                  // These are anime that we cannot recommend again!
                          Severity: Minor
                          Found in server/methods/recommendations.js - About 1 hr to fix

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

                            Template.customListEdit.created = function() {
                                var self = this;
                                self.query = new ReactiveVar('');
                                self.ready = new ReactiveVar(true);
                                self.searchResults = new ReactiveVar();
                            Severity: Minor
                            Found in client/components/customList/customListEdit/customListEdit.js - About 1 hr to fix

                              Function addThemes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                addThemes : function() {
                                    var themes = [
                                      "Cars",
                                      "Demons",
                                      "Drama",
                              Severity: Minor
                              Found in server/methods/themes.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language