MaazAli/phanime

View on GitHub

Showing 80 of 302 total issues

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

    'click #signInButton': function(event, template) {
        event.preventDefault();
        // Get input

        // We are using toLowerCase to ensure any version of the username will
Severity: Minor
Found in client/components/authentication/signIn.js - About 1 hr to fix

    Function discourseLogout has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        discourseLogout: function() {
            var user = Meteor.user();
    
            if (!user) {
                throw new Meteor.Error('user-unavailable', 'User must be logged in to perform this action');
    Severity: Minor
    Found in server/methods/discourseSSO.js - About 1 hr to fix

      Function formatContent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          formatContent: function(text) {
      
              // We first want to escape all the html if there is any
              var text = _.escape(text);
              var returnedHtml = "";
      Severity: Minor
      Found in client/components/profilePost/profilePostCard/profilePostCard.js - About 1 hr to fix

        Function custom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                custom: function() {
                    // We should ensure that the count here is the same as the length of 
                    // the likes array.
        
                    // We can't use this.field("likes").value because it grabs the modified
        Severity: Minor
        Found in collections/profilePosts.js - About 55 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 custom has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                custom: function() {
                    // We should ensure that the count here is the same as the length of 
                    // the likes array.
        
                    // We can't use this.field("likes").value because it grabs the modified
        Severity: Minor
        Found in collections/comments.js - About 55 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 click .status-item has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            'click .status-item' : function(event, template) {
        
                var status = $(event.target).text();
        
        
        

        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 .status-item has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            'click .status-item' : function(event, template) {
        
                var status = $(event.target).text();
                
        
        

        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 uploadImage has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            uploadImage: function(image, imageName, imageSize, imageType, contentDirectory, typeDirectory, contentId) {
        Severity: Major
        Found in server/methods/uploads.js - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (revision.content[key] === null) {
                                      unsetProperties[key] = "";
                                      delete revision.content[key];
                                  }
          Severity: Major
          Found in server/methods/revisions.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (error) {
                                                console.log(error.reason);
                                                throw new Meteor.Error(400, error.reason);
                                            }
            Severity: Major
            Found in client/components/comments/createComment.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (error) {
                                              throw new Meteor.Error(403, error.reason);
                                          }
              Severity: Major
              Found in server/methods/revisions.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (!anime.startDate || moment(anime.startDate).year() == 0) 
                                                    updateObj.startDate = moment(malAnime.start_date[0]).toDate();
                Severity: Major
                Found in packages/phanime-mal-import/server/methods/updateAnimeWithMALId.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                      if (animeId && coverImageUrl) {
                                                          console.log('We\'re about to upload the image');
                                                          Meteor.call("uploadImageFromUrl", coverImageUrl, 'anime', 'cover', animeId, function(error, result) {
                                                              if (error) {
                                                                  throw new Meteor.Error(403, error.reason);
                  Severity: Major
                  Found in packages/phanime-mal-import/server/methods/getUserList.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (!anime.endDate || moment(anime.endDate).year() == 0)
                                                        updateObj.endDate = moment(malAnime.end_date[0]).toDate();
                    Severity: Major
                    Found in packages/phanime-mal-import/server/methods/updateAnimeWithMALId.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (error) {
                                                      throw new Meteor.Error(403, error.reason);
                                                  }
                      Severity: Major
                      Found in server/methods/revisions.js - About 45 mins to fix

                        Function coverImageUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            coverImageUrl: function() {
                                // If revisionId exists then we're using the new upload system
                                // so we should use animeId in the url
                                if (this.newImageURLFormat) {
                                    if (this.coverImage) {
                        Severity: Minor
                        Found in collections/anime.js - About 45 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

                        Avoid deeply nested control flow statements.
                        Open

                                                            if (LibraryEntries.simpleSchema().namedContext().validate(libraryEntry) === false) {
                                                                // if validation failed, we should continue on with adding the entries, but we should push the invalid keys object into an array.
                                                                importStats.failedImports++;
                        
                                                                var invalidKeys = LibraryEntries.simpleSchema().namedContext().invalidKeys();
                        Severity: Major
                        Found in packages/phanime-mal-import/server/methods/getUserList.js - About 45 mins to fix

                          Function custom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  custom: function() {
                                      // this is how we're defining the max value
                                      // We'll need to do this in a roundabout way for now
                                      // since we can't get a field's value if it wasn't updated
                                      // together with episodesSeen
                          Severity: Minor
                          Found in collections/libraryEntries.js - About 45 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 revisionsAnimeUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              revisionsAnimeUpdate: function(anime) {
                          
                                  // Ensure integerity of data
                                  check(anime, AnimeRevisionsSchema);
                          
                          
                          Severity: Minor
                          Found in server/methods/revisions.js - About 45 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 custom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  custom: function() {
                          
                                      if (this.isInsert || !this.docId)
                                          return
                          
                          
                          Severity: Minor
                          Found in collections/profilePosts.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

                          Severity
                          Category
                          Status
                          Source
                          Language