TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function authors has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function authors(options = {}) {
    options.hash = options.hash || {};

    let {
        autolink,
Severity: Minor
Found in ghost/core/core/frontend/helpers/authors.js - About 1 hr to fix

    Function entryController has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function entryController(req, res, next) {
        debug('entryController', res.routerOptions);
    
        return dataService.entryLookup(req.path, res.routerOptions, res.locals)
            .then(function then(lookup) {
    Severity: Minor
    Found in ghost/core/core/frontend/services/routing/controllers/entry.js - About 1 hr to fix

      Function start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          start(routerSettings) {
              debug('routing start', routerSettings);
              const RESOURCE_CONFIG = require(`./config`);
      
              const unsubscribeRouter = new UnsubscribeRouter();
      Severity: Minor
      Found in ghost/core/core/frontend/services/routing/RouterManager.js - About 1 hr to fix

        Function renderTriggerIcon has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderTriggerIcon() {
                const {portal_button_icon: buttonIcon = '', portal_button_style: buttonStyle = ''} = this.context.site || {};
                const Style = Styles({brandColor: this.context.brandColor});
                const memberGravatar = this.context.member && this.context.member.avatar_image;
        
        
        Severity: Minor
        Found in apps/portal/src/components/TriggerButton.js - About 1 hr to fix

          Function sendMagicLink has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  async sendMagicLink({email, emailType, labels, name, oldEmail, newsletters, redirect, integrityToken, phonenumber, customUrlHistory, autoRedirect = true}) {
                      const url = endpointFor({type: 'members', resource: 'send-magic-link'});
                      const body = {
                          name,
                          email,
          Severity: Minor
          Found in apps/portal/src/utils/api.js - About 1 hr to fix

            Function validatePayload has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                validatePayload(payload: Payload) {
                    if (payload.signature === undefined) {
                        throw new errors.ValidationError({
                            message: tpl(VALIDATION_MESSAGES.payloadSignatureMissing)
                        });
            Severity: Minor
            Found in ghost/mail-events/src/MailEventService.ts - About 1 hr to fix

              Function getOfferPortalPreviewUrl has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const getOfferPortalPreviewUrl = (overrides:offerPortalPreviewUrlTypes, baseUrl: string) : string => {
                  const {
                      disableBackground = false,
                      name,
                      code,
              Severity: Minor
              Found in apps/admin-x-settings/src/utils/getOffersPortalPreviewUrl.ts - About 1 hr to fix

                Function verify has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        const verify = async () => {
                            try {
                                const {newsletters: [updatedNewsletter], meta: {email_verified: emailVerified} = {}} = await verifyEmail({token: verifyEmailToken});
                                let title;
                                let prompt;
                Severity: Minor
                Found in apps/admin-x-settings/src/components/settings/email/Newsletters.tsx - About 1 hr to fix

                  Function getOfferDiscount has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const getOfferDiscount = (type: string, amount: number, cadence: string, currency: string, tier: Tier | undefined): {discountColor: string, discountOffer: string, originalPriceWithCurrency: string, updatedPriceWithCurrency: string} => {
                      let discountColor = '';
                      let discountOffer = '';
                      const originalPrice = cadence === 'month' ? tier?.monthly_price ?? 0 : tier?.yearly_price ?? 0;
                      let updatedPrice = originalPrice;

                    Function useHandleError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const useHandleError = () => {
                        const {sentryDSN} = useFramework();
                    
                        /**
                         * @param error Thrown error.
                    Severity: Minor
                    Found in apps/admin-x-framework/src/hooks/useHandleError.ts - About 1 hr to fix

                      Function getAttributionFromContext has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          async getAttributionFromContext(context) {
                              if (!context || !this.isTrackingEnabled) {
                                  return null;
                              }
                      
                      
                      Severity: Minor
                      Found in ghost/member-attribution/lib/MemberAttributionService.js - About 1 hr to fix

                        Function uiText has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function uiText([style]) {
                            let cssClass = '';
                        
                            switch (style) {
                            case 'h1':
                        Severity: Minor
                        Found in ghost/admin/app/helpers/ui-text.js - About 1 hr to fix

                          Function _passwordSetup has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _passwordSetup() {
                                  let setupProperties = ['blogTitle', 'name', 'email', 'password'];
                                  let data = this.getProperties(setupProperties);
                                  let method = this.blogCreated ? 'put' : 'post';
                          
                          
                          Severity: Minor
                          Found in ghost/admin/app/controllers/setup.js - About 1 hr to fix

                            Function errorsWithFormattedMessages has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    const errorsWithFormattedMessages = erroredMembers.map((row) => {
                                        const formattedError = row.error
                                            .replace(
                                                'Value in [members.email] cannot be blank.',
                                                'Missing email address'
                            Severity: Minor
                            Found in ghost/admin/app/components/modal-import-members.js - About 1 hr to fix

                              Function getOfferPortalPreviewUrl has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  getOfferPortalPreviewUrl(overrides) {
                                      const {
                                          disableBackground = false,
                                          name,
                                          code,
                              Severity: Minor
                              Found in ghost/admin/app/services/members-utils.js - About 1 hr to fix

                                Function updateCheckRequest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    async updateCheckRequest() {
                                        const reqData = await this.updateCheckData();
                                
                                        let reqObj = {
                                            timeout: {
                                Severity: Minor
                                Found in ghost/update-check-service/lib/UpdateCheckService.js - About 1 hr to fix

                                  Function getEmailDeliveredEvents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      async getEmailDeliveredEvents(options = {}, filter) {
                                          options = {
                                              ...options,
                                              withRelated: ['member', 'email'],
                                              filter: 'delivered_at:-null+custom:true',
                                  Severity: Minor
                                  Found in ghost/members-api/lib/repositories/EventRepository.js - About 1 hr to fix

                                    Function getEmailFailedEvents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        async getEmailFailedEvents(options = {}, filter) {
                                            options = {
                                                ...options,
                                                withRelated: ['member', 'email'],
                                                filter: 'failed_at:-null+custom:true',
                                    Severity: Minor
                                    Found in ghost/members-api/lib/repositories/EventRepository.js - About 1 hr to fix

                                      Function getEmailOpenedEvents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          async getEmailOpenedEvents(options = {}, filter) {
                                              options = {
                                                  ...options,
                                                  withRelated: ['member', 'email'],
                                                  filter: 'opened_at:-null+custom:true',
                                      Severity: Minor
                                      Found in ghost/members-api/lib/repositories/EventRepository.js - About 1 hr to fix

                                        Function getPaymentLink has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            async getPaymentLink({tier, cadence, offer, member, metadata, successUrl, cancelUrl, email}) {
                                                let coupon = null;
                                                let trialDays = null;
                                                if (offer) {
                                                    if (!tier.id.equals(offer.tier.id)) {
                                        Severity: Minor
                                        Found in ghost/payments/lib/PaymentsService.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language