TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function parseNqlFilter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        parseNqlFilter: (flt) => {
            const comparator = flt.$and || flt.$or; // $or for legacy filter backwards compatibility

            if (!comparator || comparator.length !== 2) {
                const filter = flt;
Severity: Minor
Found in ghost/admin/app/components/members/filters/subscribed.js - About 1 hr to fix

    Function onTitleKeydown has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @action
        onTitleKeydown(event) {
            if (this.feature.editorExcerpt) {
                // move cursor to the excerpt on
                // - Tab (handled by browser)
    Severity: Minor
    Found in ghost/admin/app/components/gh-koenig-editor-lexical.js - About 1 hr to fix

      Function model has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          model(params) {
              let signupDetails = SignupDetails.create();
              let re = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}|[A-Za-z0-9_-]{3})?$/;
              let email,
                  tokenText;
      Severity: Minor
      Found in ghost/admin/app/routes/signup.js - About 1 hr to fix

        Function handleInvoiceEvent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async handleInvoiceEvent(invoice) {
                const {api, memberRepository, eventRepository, productRepository} = this.deps;
        
                if (!invoice.subscription) {
                    // Check if this is a one time payment, related to a donation
        Severity: Minor
        Found in ghost/stripe/lib/services/webhook/InvoiceEventService.js - About 1 hr to fix

          Function subscribe has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              subscribe(domainEvents) {
                  domainEvents.subscribe(MemberPageViewEvent, async (event) => {
                      try {
                          await this.cachedUpdateLastSeenAt(event.data.memberId, event.data.memberLastSeenAt, event.timestamp);
                      } catch (err) {
          Severity: Minor
          Found in ghost/members-events-service/lib/LastSeenAtUpdater.js - About 1 hr to fix

            Function mappedRows has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                const mappedRows = rows.map((row) => {
                    if (row.error && !columns.includes('error')) {
                        columns.push('error');
                    }
            
            
            Severity: Minor
            Found in ghost/members-csv/lib/unparse.js - About 1 hr to fix

              Function notifyFreeMemberSignup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  async notifyFreeMemberSignup({
                      member, attribution
                  }, options) {
                      const users = await this.models.User.getEmailAlertUsers('free-signup', options);
              
              
              Severity: Minor
              Found in ghost/staff-service/lib/StaffServiceEmails.js - About 1 hr to fix

                Function _execute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                SchedulingDefault.prototype._execute = function (jobs) {
                    const keys = Object.keys(jobs);
                    const self = this;
                
                    keys.forEach(function (timestamp) {
                Severity: Minor
                Found in ghost/core/core/server/adapters/scheduling/scheduling-default.js - About 1 hr to fix

                  Function createSubscription has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async createSubscription(data, options) {
                          if (!this._stripeAPIService.configured) {
                              throw new errors.BadRequestError({message: tpl(messages.noStripeConnection, {action: 'create Stripe Subscription'})});
                          }
                          const member = await this._Member.findOne({
                  Severity: Minor
                  Found in ghost/members-api/lib/repositories/MemberRepository.js - About 1 hr to fix

                    Function getPriceForTierCadence has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        async getPriceForTierCadence(tier, cadence) {
                            const product = await this.getProductForTier(tier);
                            const currency = tier.currency.toLowerCase();
                            const amount = tier.getPrice(cadence);
                            const rows = await this.StripePriceModel.where({
                    Severity: Minor
                    Found in ghost/payments/lib/PaymentsService.js - About 1 hr to fix

                      Function emitChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              emitChange: function (model, event, options) {
                                  const _emit = (ghostEvent, _model, opts) => {
                                      if (!_model.wasChanged()) {
                                          return;
                                      }
                      Severity: Minor
                      Found in ghost/core/core/server/models/base/plugins/events.js - About 1 hr to fix

                        Function attach has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const attach = function attach(Model, effectedModelId, relation, modelsToAttach, options) {
                            options = options || {};
                        
                            let fetchedModel;
                            const localOptions = {transacting: options.transacting};
                        Severity: Minor
                        Found in ghost/core/core/server/models/base/utils.js - About 1 hr to fix

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

                              read(key, context) {
                                  let setting;
                          
                                  if (key === 'slack') {
                                      const slackURL = this.settingsCache.get('slack_url', {resolve: false});
                          Severity: Minor
                          Found in ghost/core/core/server/services/settings/SettingsBREADService.js - About 1 hr to fix

                            Function edit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                async edit(data, options) {
                                    if (options.keyid) {
                                        const model = await this.ApiKeyModel.findOne({id: options.keyid});
                            
                                        if (!model) {

                              Function initVerificationTrigger has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const initVerificationTrigger = () => {
                                  return new VerificationTrigger({
                                      getApiTriggerThreshold: () => _.get(config.get('hostSettings'), 'emailVerification.apiThreshold'),
                                      getAdminTriggerThreshold: () => _.get(config.get('hostSettings'), 'emailVerification.adminThreshold'),
                                      getImportTriggerThreshold: () => _.get(config.get('hostSettings'), 'emailVerification.importThreshold'),
                              Severity: Minor
                              Found in ghost/core/core/server/services/members/service.js - About 1 hr to fix

                                Function filterPrivateRoutes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    filterPrivateRoutes: function filterPrivateRoutes(req, res, next) {
                                        // If this site is not in private mode, skip
                                        if (!res.isPrivateBlog) {
                                            return next();
                                        }
                                Severity: Minor
                                Found in ghost/core/core/frontend/apps/private-blogging/lib/middleware.js - About 1 hr to fix

                                  Function generateItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const generateItem = function generateItem(post) {
                                      const cheerio = require('cheerio');
                                  
                                      const itemUrl = routerManager.getUrlByResourceId(post.id, {absolute: true});
                                      const htmlContent = cheerio.load(post.html || '');
                                  Severity: Minor
                                  Found in ghost/core/core/frontend/services/rss/generate-feed.js - About 1 hr to fix

                                    Function channelController has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    module.exports = function channelController(req, res, next) {
                                        debug('channelController', 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/channel.js - About 1 hr to fix

                                      Function EmailNewsletterAction has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      function EmailNewsletterAction() {
                                          const {member, site, onAction, t} = useContext(AppContext);
                                          let {newsletters} = member;
                                      
                                          const subscribed = !!newsletters?.length;

                                        Function useStaffUsers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const useStaffUsers = (): UsersHook => {
                                            const {currentUser} = useGlobalData();
                                            const {data: {users, meta, isEnd} = {users: []}, isLoading: usersLoading, fetchNextPage} = useBrowseUsers();
                                            const {data: {invites} = {invites: []}, isLoading: invitesLoading} = useBrowseInvites();
                                            const {data: {roles} = {}, isLoading: rolesLoading} = useBrowseRoles();
                                        Severity: Minor
                                        Found in apps/admin-x-settings/src/hooks/useStaffUsers.tsx - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language