TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function notifyPaidSubscriptionCanceled has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async notifyPaidSubscriptionCanceled({member, tier, subscription, cancelNow, expiryAt, canceledAt}, options = {}) {
        const users = await this.models.User.getEmailAlertUsers('paid-canceled', options);

        for (const user of users) {
            const to = user.email;
Severity: Minor
Found in ghost/staff-service/lib/StaffServiceEmails.js - About 1 hr to fix

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

        async read(data, options = {}) {
            const defaultWithRelated = [
                'labels',
                'stripeSubscriptions',
                'stripeSubscriptions.customer',
    Severity: Minor
    Found in ghost/members-api/lib/services/MemberBREADService.js - About 1 hr to fix

      Function author has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const author = (attrs, frame) => {
          if (localUtils.isContentAPI(frame)) {
              delete attrs.created_at;
              delete attrs.updated_at;
              delete attrs.last_seen;

        Function getConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getConfig({config, urlUtils, settingsHelpers}) {
                /**
                 * @returns {StripeURLConfig}
                 */
                function getStripeUrlConfig() {
        Severity: Minor
        Found in ghost/core/core/server/services/stripe/config.js - About 1 hr to fix

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

          module.exports = createIrreversibleMigration(async (knex) => {
              logging.info('Starting re-generation of posts html.');
          
              await knex.transaction(async (trx) => {
                  // get list of posts ids, use .forUpdate to lock rows until the transaction is finished

            Function SupportPage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const SupportPage = () => {
                const [isLoading, setLoading] = useState(true);
                const [error, setError] = useState(null);
                const [disabledFeatureError, setDisabledFeatureError] = useState(null);
                const {member, t, site} = useContext(AppContext);
            Severity: Minor
            Found in apps/portal/src/components/pages/SupportPage.js - About 1 hr to fix

              Function ContinueSubscriptionButton has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ContinueSubscriptionButton = () => {
                  const {member, onAction, action, brandColor, t} = useContext(AppContext);
                  const subscription = getMemberSubscription({member});
                  if (!subscription) {
                      return null;

                Function initSetup has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async initSetup() {
                        try {
                            // Fetch data from API, links, preview, dev sources
                            const {site, member, page, showPopup, popupNotification, lastPage, pageQuery, pageData} = await this.fetchData();
                            const i18nLanguage = this.props.siteI18nEnabled ? site.locale : 'en';
                Severity: Minor
                Found in apps/portal/src/App.js - About 1 hr to fix

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

                      generate() {
                          let timestamp = this.events.pop();
                          if (!timestamp) {
                              return;
                          }
                  Severity: Minor
                  Found in ghost/data-generator/lib/importers/EmailRecipientsImporter.js - About 1 hr to fix

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

                        async createCheckoutSession(priceId, customer, options) {
                            const metadata = options.metadata || undefined;
                            const customerId = customer ? customer.id : undefined;
                            const customerEmail = customer ? customer.email : options.customerEmail;
                    
                    
                    Severity: Minor
                    Found in ghost/stripe/lib/StripeAPI.js - About 1 hr to fix

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

                          async notifyMilestoneReceived({milestone}) {
                              if (!milestone?.emailSentAt || milestone?.meta?.reason) {
                                  // Do not send an email when no email was set to be sent or a reason
                                  // not to send provided
                                  return;
                      Severity: Minor
                      Found in ghost/staff-service/lib/StaffServiceEmails.js - About 1 hr to fix

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

                            async handleMismatch({acceptVersion, contentVersion, apiKeyValue, apiKeyType, requestURL, userAgent = ''}) {
                                if (!await this.versionNotificationsDataService.fetchNotification(acceptVersion)) {
                                    const integration = await this.versionNotificationsDataService.getIntegration(apiKeyValue, apiKeyType);
                        
                                    // We couldn't find the integration

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

                                  async query(frame) {
                                      const store = storage.getStorage('images');
                          
                                      // Normalize
                                      const imageOptimizationOptions = config.get('imageOptimization');
                          Severity: Minor
                          Found in ghost/core/core/server/api/endpoints/images.js - About 1 hr to fix

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

                            module.exports = function (Bookshelf) {
                                Bookshelf.Model = Bookshelf.Model.extend({
                                    getActor(options = {context: {}}) {
                                        if (options.context && options.context.integration) {
                                            return {
                            Severity: Minor
                            Found in ghost/core/core/server/models/base/plugins/user-type.js - About 1 hr to fix

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

                                  async add(attrs, options = {}) {
                                      // create newsletter and assign members in the same transaction
                                      if (options.opt_in_existing && !options.transacting) {
                                          return this.NewsletterModel.transaction((transacting) => {
                                              options.transacting = transacting;
                              Severity: Minor
                              Found in ghost/core/core/server/services/newsletters/NewslettersService.js - About 1 hr to fix

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

                                    run(options) {
                                        const {event, action, eventData} = options;
                                
                                        clearTimeout(this.toNotify[action].timeout);
                                        this.toNotify[action].timeout = null;
                                Severity: Minor
                                Found in ghost/core/core/server/services/url/Queue.js - About 1 hr to fix

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

                                      async destroyUser(frameOptions) {
                                          let filename = null;
                                          const backupPath = await this.dbBackup.backup();
                                  
                                          if (backupPath) {
                                  Severity: Minor
                                  Found in ghost/core/core/server/services/Users.js - About 1 hr to fix

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

                                    async function addPermissionToRoleHelper(connection, config) {
                                        const permission = await connection('permissions').where({
                                            name: config.permission
                                        }).first();
                                    
                                    
                                    Severity: Minor
                                    Found in ghost/core/core/server/data/migrations/utils/permissions.js - About 1 hr to fix

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

                                          async function up(knex) {
                                              // Backfill missing offer redemptions
                                              try {
                                                  // Select all subscriptions that have an `offer_id` but don't have a matching row in the `offer_redemptions` table
                                                  logging.info('Selecting subscriptions with missing offer redemptions');

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

                                        module.exports = function collectionController(req, res, next) {
                                            debug('collectionController beging', req.params, res.routerOptions);
                                        
                                            const pathOptions = {
                                                page: req.params.page !== undefined ? req.params.page : 1,
                                        Severity: Minor
                                        Found in ghost/core/core/frontend/services/routing/controllers/collection.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language