TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function browse has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            browse({page, postId, order}: {page: number, postId: string, order?: string}) {
                let filter = null;
                if (firstCommentCreatedAt && !order) {
                    filter = `created_at:<=${firstCommentCreatedAt}`;
                }
Severity: Minor
Found in apps/comments-ui/src/utils/api.ts - About 1 hr to fix

    Function renderExampleProfiles has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const renderExampleProfiles = () => {
            const renderEl = (profile: {name: string, avatar: string, expertise: string}) => {
                return (
                    <Transition
                        key={profile.name}
    Severity: Minor
    Found in apps/comments-ui/src/components/popups/AddDetailsPopup.tsx - About 1 hr to fix

      Function getActivities has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async getActivities(
              includeOwn: boolean = false,
              includeReplies: boolean = false,
              excludeNonFollowers: boolean = false,
              filter: {type?: string[]} | null = null,
      Severity: Minor
      Found in apps/admin-x-activitypub/src/api/activitypub.ts - About 1 hr to fix

        Function adminXPlaywrightConfig has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function adminXPlaywrightConfig(overrides: Partial<PlaywrightTestConfig> = {}) {
            /**
             * See https://playwright.dev/docs/test-configuration.
             */
            return defineConfig({
        Severity: Minor
        Found in apps/admin-x-framework/src/playwright.ts - About 1 hr to fix

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

              generate() {
                  const errors = [
                      {
                          severity: 'permanent',
                          code: 605,

            Function humanizeRecipientFilter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default helper(function humanizeRecipientFilter([filter = '']/*, hash*/) {
                const parts = filter.split(',');
            
                if (parts.includes('status:free') && parts.includes('status:-free')) {
                    return 'All subscribers';
            Severity: Minor
            Found in ghost/admin/app/helpers/humanize-recipient-filter.js - About 1 hr to fix

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

                  generate() {
                      const id = this.fastFakeObjectId();
                      // Use name from American locale to reflect an English-speaking audience
                      const name = `${americanFaker.name.firstName()} ${americanFaker.name.lastName()}`;
                      const timestamp = this.timestamps.pop();
              Severity: Minor
              Found in ghost/data-generator/lib/importers/MembersImporter.js - About 1 hr to fix

                Function input has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports.input = (apiConfig, apiSerializers, frame) => {
                    debug('input');
                
                    const tasks = [];
                    const sharedSerializers = require('./input');
                Severity: Minor
                Found in ghost/api-framework/lib/serializers/handle.js - About 1 hr to fix

                  Function input has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports.input = (apiConfig, apiValidators, frame) => {
                      debug('input begin');
                  
                      const tasks = [];
                      const sharedValidators = require('./input');
                  Severity: Minor
                  Found in ghost/api-framework/lib/validators/handle.js - About 1 hr to fix

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

                        add(apiConfig, frame) {
                            debug('validate add');
                    
                            // NOTE: this block should be removed completely once JSON Schema validations
                            //       are introduced for all of the endpoints
                    Severity: Minor
                    Found in ghost/api-framework/lib/validators/input/all.js - About 1 hr to fix

                      Function get has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          async get(result, apiConfigHeaders = {}, frame) {
                              let headers = {};
                      
                              if (apiConfigHeaders.disposition) {
                                  const dispositionHeader = await disposition[apiConfigHeaders.disposition.type](result, apiConfigHeaders.disposition);
                      Severity: Minor
                      Found in ghost/api-framework/lib/headers.js - About 1 hr to fix

                        Function notifyParentCommentAuthor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async notifyParentCommentAuthor(reply) {
                                const parent = await this.models.Comment.findOne({id: reply.get('parent_id')});
                                const parentMember = parent.related('member');
                        
                                if (parent?.get('status') !== 'published' || !parentMember.get('enable_comment_notifications')) {
                        Severity: Minor
                        Found in ghost/core/core/server/services/comments/CommentsServiceEmails.js - About 1 hr to fix

                          Function mediaUploadFunction has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const media = (fileName, thumbName) => function mediaUploadFunction(req, res, next) {
                              const mediaUpload = upload.fields([{
                                  name: fileName,
                                  maxCount: 1
                              }, {
                          Severity: Minor
                          Found in ghost/core/core/server/web/api/middleware/upload.js - About 1 hr to fix

                            Function collection has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports = async function collection(slug, options) {
                                options = options || {};
                                options.hash = options.hash || {};
                                options.data = options.data || {};
                            
                            
                            Severity: Minor
                            Found in ghost/core/core/frontend/helpers/collection.js - About 1 hr to fix

                              Function makeReady has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  async makeReady() {
                                      try {
                                          let state = await this.getState();
                              
                                          printState({state});
                              Severity: Minor
                              Found in ghost/core/core/server/data/db/DatabaseStateManager.js - About 1 hr to fix

                                Function makeAPICall has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function makeAPICall(resource, controllerName, action, apiOptions) {
                                    const controller = api[controllerName];
                                    let makeRequest = options => controller[action](options);
                                
                                    const {
                                Severity: Minor
                                Found in ghost/core/core/frontend/helpers/get.js - About 1 hr to fix

                                  Function setResponseContext has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function setResponseContext(req, res, data) {
                                      const pageParam = req.params && req.params.page !== undefined ? parseInt(req.params.page, 10) : 1;
                                  
                                      res.locals = res.locals || {};
                                      res.locals.context = [];
                                  Severity: Minor
                                  Found in ghost/core/core/frontend/services/rendering/context.js - About 1 hr to fix

                                    Function nullable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        get nullable(): UnsafeData|NullData {
                                            if (this.data === null) {
                                                const d: NullData = {
                                                    get string() {
                                                        return null;
                                    Severity: Minor
                                    Found in ghost/recommendations/src/UnsafeData.ts - About 1 hr to fix

                                      Function setupFirstPromoter has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          setupFirstPromoter({site, member}) {
                                              if (hasMode(['test'])) {
                                                  return null;
                                              }
                                              const firstPromoterId = getFirstpromoterId({site});
                                      Severity: Minor
                                      Found in apps/portal/src/App.js - About 1 hr to fix

                                        Function SupportSuccess has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const SupportSuccess = () => {
                                            const {onAction, brandColor, site, t} = useContext(AppContext);
                                            const successTitle = t('Thank you for your support');
                                            const successDescription = t('To continue to stay up to date, subscribe to {{publication}} below.', {publication: site?.title});
                                            const buttonLabel = t('Sign up');
                                        Severity: Minor
                                        Found in apps/portal/src/components/pages/SupportSuccess.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language