TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

const authMemberByUuid = async function authMemberByUuid(req, res, next) {
    try {
        const uuid = req.query.uuid;
        if (!uuid) {
            if (res.locals.member && req.member) {
Severity: Minor
Found in ghost/core/core/server/services/members/middleware.js - About 1 hr to fix

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

        async notifiyReport(comment, reporter) {
            const post = await this.models.Post.findOne({id: comment.get('post_id')}, {withRelated: ['authors']});
            const member = await this.models.Member.findOne({id: comment.get('member_id')});
            const owner = await this.models.User.getOwnerUser();
    
    
    Severity: Minor
    Found in ghost/core/core/server/services/comments/CommentsServiceEmails.js - About 1 hr to fix

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

          async function up(knex) {
              const cancelledSubscriptions = await knex
                  .select(
                      'members.id as member_id',
                      'members_stripe_customers_subscriptions.id',

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

            async function up(knex) {
                const products = await knex
                    .select('id')
                    .from('products');
        
        

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

              async function up(knex) {
                  logging.info('Populating built-in collections');
          
                  const existingLatestCollection = await knex('collections')
                      .where({

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

            function formatPageResponse(result, pageAsPost = false, locals = {}) {
                const response = {};
            
                if (result.posts) {
                    response.posts = result.posts;
            Severity: Minor
            Found in ghost/core/core/frontend/services/rendering/format-response.js - About 1 hr to fix

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

              function getPreviewData(previewHeader, customThemeSettingKeys = []) {
                  // Keep the string shorter with short codes for certain parameters
                  const supportedSettings = {
                      c: 'accent_color',
                      icon: 'icon',
              Severity: Minor
              Found in ghost/core/core/frontend/services/theme-engine/preview.js - About 1 hr to fix

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

                export default function FeedbackPage() {
                    const {site, pageData, member, t, api} = useContext(AppContext);
                    const {uuid, key, postId, score: initialScore} = pageData;
                    const [score, setScore] = useState(initialScore);
                    const positive = score === 1;
                Severity: Minor
                Found in apps/portal/src/components/pages/FeedbackPage.js - About 1 hr to fix

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

                      renderSubmitButton() {
                          const {action, site, brandColor, pageQuery, t} = this.context;
                  
                          if (isInviteOnlySite({site, pageQuery})) {
                              return null;
                  Severity: Minor
                  Found in apps/portal/src/components/pages/SignupPage.js - About 1 hr to fix

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

                    const setup = (overrides) => {
                        const {mockOnActionFn, ...utils} = render(
                            <SignupPage />,
                            {
                                overrideContext: {
                    Severity: Minor
                    Found in apps/portal/src/components/pages/SignupPage.test.js - About 1 hr to fix

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

                          async canActivate(context: ExecutionContext): Promise<boolean> {
                              const request = context.switchToHttp().getRequest<Request>();
                              const response = context.switchToHttp().getResponse<Response>();
                      
                              const user = await this.sessionService.getUserForSession(request, response);
                      Severity: Minor
                      Found in ghost/ghost/src/nestjs/guards/admin-api-authentication.guard.ts - About 1 hr to fix

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

                        const ViewFollowersModal: React.FC<RoutingModalProps> = ({}) => {
                            const {updateRoute} = useRouting();
                        
                            const {data: followers = [], isLoading} = useFollowersForUser('index');
                        
                        

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

                          export function useOptions(scriptTag: HTMLElement) {
                              const buildOptions = React.useCallback(() => {
                                  /**
                                   * @type {HTMLElement}
                                   */
                          Severity: Minor
                          Found in apps/comments-ui/src/utils/options.ts - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                if (pathName && modalPaths && loadModals) {
                                    const [, currentModalName] = Object.entries(modalPaths).find(([modalPath]) => matchRoute(currentRoute || '', modalPath)) || [];
                                    const [path, modalName] = Object.entries(modalPaths).find(([modalPath]) => matchRoute(pathName, modalPath)) || [];
                            
                                    return {
                            Severity: Critical
                            Found in apps/admin-x-framework/src/providers/RoutingProvider.tsx - About 1 hr to fix

                              Function setTwitterUrl has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @action
                                  setTwitterUrl(event) {
                                      const {model, modelProperty} = this.args;
                              
                                      const newUrl = event.target.value;
                              Severity: Minor
                              Found in ghost/admin/app/components/gh-twitter-url-input.js - About 1 hr to fix

                                Function beforeSend has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function beforeSend(event, hint) {
                                    try {
                                        const exception = hint.originalException;
                                        event.tags = event.tags || {};
                                        event.tags.shown_to_user = event.tags.shown_to_user || false;
                                Severity: Minor
                                Found in ghost/admin/app/utils/sentry.js - About 1 hr to fix

                                  Function minimumAmountForCurrency has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export function minimumAmountForCurrency(currency) {
                                      const isoCurrency = currency?.toUpperCase();
                                  
                                      switch (isoCurrency) {
                                      case 'AED':
                                  Severity: Minor
                                  Found in ghost/admin/app/utils/currency.js - About 1 hr to fix

                                    Function updateCheckResponse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        async updateCheckResponse(response) {
                                            let notifications = [];
                                            let notificationGroups = (this.config.notificationGroups || []).concat(['all']);
                                    
                                            debug('Notification Groups', notificationGroups);
                                    Severity: Minor
                                    Found in ghost/update-check-service/lib/UpdateCheckService.js - About 1 hr to fix

                                      Function cancelSubscription has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          async cancelSubscription(data, options) {
                                              const sharedOptions = {
                                                  transacting: options ? options.transacting : null
                                              };
                                              if (!this._stripeAPIService.configured) {
                                      Severity: Minor
                                      Found in ghost/members-api/lib/repositories/MemberRepository.js - About 1 hr to fix

                                        Function getCustomerIdByEmail has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            async getCustomerIdByEmail(email) {
                                                await this._searchRateLimitBucket.throttle();
                                                try {
                                                    const result = await this._stripe.customers.search({
                                                        query: `email:"${email}"`,
                                        Severity: Minor
                                        Found in ghost/stripe/lib/StripeAPI.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language