TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    _handleTokenRequest() {
        const handleNoPermission = () => {
            // no permission means the current user requesting the token is not the owner of the site.
            this.isOwner = false;

Severity: Minor
Found in ghost/admin/app/components/gh-billing-iframe.js - About 1 hr to fix

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

        serialize(snapshot/*, options*/) {
            let json = super.serialize(...arguments);
    
            // Inserted locally as a convenience.
            delete json.author_id;
    Severity: Minor
    Found in ghost/admin/app/serializers/post.js - About 1 hr to fix

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

          _updateGrow(settings) {
              const change = Math.round(Math.random() * (settings.growRate - settings.shrinkOffset));
      
              if (settings.growPeriod) {
                  settings.growCount += 1;
      Severity: Minor
      Found in ghost/admin/app/services/dashboard-mocks.js - About 1 hr to fix

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

                    ops.push(async function updateRevisions() {
                        const revisionModels = await ghostBookshelf.model('PostRevision')
                            .findAll(Object.assign({
                                filter: `post_id:'${model.id}'`,
                                columns: ['id', 'lexical', 'created_at', 'author_id', 'title', 'reason', 'post_status', 'created_at_ts', 'feature_image']
        Severity: Minor
        Found in ghost/core/core/server/models/post.js - About 1 hr to fix

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

              defaults: function defaults() {
                  let visibility = 'public';
                  let tiers = [];
                  const defaultContentVisibility = settingsCache.get('default_content_visibility');
                  if (defaultContentVisibility) {
          Severity: Minor
          Found in ghost/core/core/server/models/post.js - About 1 hr to fix

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

                read(options) {
                    options = options || {};
            
                    // remove trailing slashes
                    options.path = (options.path || '').replace(/\/$|\\$/, '');
            Severity: Minor
            Found in ghost/core/core/server/adapters/storage/LocalStorageBase.js - About 1 hr to fix

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

                  init() {
                      if (this.api) {
                          // Prevent creating duplicate DomainEvents subscribers
                          return;
                      }
              Severity: Minor
              Found in ghost/core/core/server/services/staff/index.js - About 1 hr to fix

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

                module.exports = (model, frame) => {
                    const jsonModel = model.toJSON(frame.options);
                
                    if (utils.isContentAPI(frame)) {
                        const serialized = {

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

                      destroy({notificationId, user}) {
                          const allNotifications = this.fetchAllNotifications();
                  
                          const notificationToMarkAsSeen = allNotifications.find((notification) => {
                              return notification.id === notificationId;
                  Severity: Minor
                  Found in ghost/core/core/server/services/notifications/Notifications.js - About 1 hr to fix

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

                    function sendWelcomeEmail(email, mailAPI) {
                        if (config.get('sendWelcomeEmail')) {
                            const data = {
                                ownerEmail: email
                            };
                    Severity: Minor
                    Found in ghost/core/core/server/services/auth/setup.js - About 1 hr to fix

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

                      async function doTiersAndNewsletter(data, api) {
                          const {tiers: tiersAPI, newsletters: newslettersAPI} = api;
                          const context = {context: {user: data.user.id}};
                          const user = data.user;
                          const blogTitle = data.userData.blogTitle;
                      Severity: Minor
                      Found in ghost/core/core/server/services/auth/setup.js - About 1 hr to fix

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

                        module.exports = createIrreversibleMigration(async (knex) => {
                            if (!DatabaseInfo.isSQLite(knex)) {
                                return logging.warn('Skipping fixing foreign key for members_stripe_customers_subscriptions - database is not SQLite3');
                            }
                        
                        

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

                              async function up(knex) {
                                  if (!DatabaseInfo.isMySQL(knex)) {
                                      logging.warn('Skipping cleanup of duplicate offer redemptions - database is not MySQL');
                                      return;
                                  }

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

                                async getCachedImageSizeFromUrl(url) {
                                    if (!url || url === undefined || url === null) {
                                        return;
                                    }
                            
                            
                            Severity: Minor
                            Found in ghost/core/core/server/lib/image/CachedImageSizeFromUrl.js - About 1 hr to fix

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

                                  async function up(knex) {
                                      logging.info('Updating members_status_events for comped members');
                                      const compedMembers = await knex('members')
                                          .select('id')
                                          .where('status', 'comped');

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

                                    async addFixturesForModel(modelFixture, options = {}) {
                                        // Clone the fixtures as they get changed in this function.
                                        // The initial blog posts will be added a `published_at` property, which
                                        // would change the fixturesHash.
                                        modelFixture = _.cloneDeep(modelFixture);
                                Severity: Minor
                                Found in ghost/core/core/server/data/schema/fixtures/FixtureManager.js - About 1 hr to fix

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

                                  module.exports.getUnsplashImage = function getUnsplashImage(imagePath, sizeOptions) {
                                      const parsedUrl = new URL(imagePath);
                                      const {requestedSize, imageSizes, requestedFormat} = sizeOptions;
                                  
                                      if (requestedFormat) {
                                  Severity: Minor
                                  Found in ghost/core/core/frontend/utils/images.js - About 1 hr to fix

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

                                    function loadNconf(options) {
                                        debug('config start');
                                        options = options || {};
                                    
                                        const baseConfigPath = options.baseConfigPath || __dirname;
                                    Severity: Minor
                                    Found in ghost/core/core/shared/config/loader.js - About 1 hr to fix

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

                                      module.exports = function tiers(options = {}) {
                                          options = options || {};
                                          options.hash = options.hash || {};
                                      
                                          const separator = isString(options.hash.separator) ? options.hash.separator : ', ';
                                      Severity: Minor
                                      Found in ghost/core/core/frontend/helpers/tiers.js - About 1 hr to fix

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

                                        function getAssetUrl(path, hasMinFile) {
                                            path = path instanceof SafeString ? path.string : path;
                                        
                                            // CASE: favicon - this is special path with its own functionality
                                            if (path.match(/\/?favicon\.(ico|png)$/)) {
                                        Severity: Minor
                                        Found in ghost/core/core/frontend/meta/asset-url.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language