TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    async read(model, apiConfig, frame) {
        const tiersPage = await tiersService.api.browse({});
        const tiers = tiersPage.data?.map((tierModel) => {
            const json = tierModel.toJSON();
            return {

    Function all has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        async all(model, apiConfig, frame) {
            const tiersPage = await tiersService.api.browse({});
            const tiers = tiersPage.data?.map((tierModel) => {
                const json = tierModel.toJSON();
                return {

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

          async add(data, options) {
              const webhook = await this.WebhookModel.getByEventAndTarget(
                  data.webhooks[0].event,
                  data.webhooks[0].target_url,
                  options
      Severity: Minor
      Found in ghost/core/core/server/services/webhooks/webhooks-service.js - About 1 hr to fix

        Function fetchData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            async fetchData() {
                const totalMembers = await this.MembersService.stats.getTotalMembers();
                const mrrStats = await this.StatsService.api.getMRRHistory();
        
                const {description, icon, title, url, accent_color: accentColor, locale} = this.PublicConfigService.site;
        Severity: Minor
        Found in ghost/core/core/server/services/explore/ExploreService.js - About 1 hr to fix

          Function getFromAddress has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getFromAddress(requestedFromAddress, requestedReplyToAddress) {
              if (settingsHelpers.useNewEmailAddresses()) {
                  if (!requestedFromAddress) {
                      // Use the default config
                      requestedFromAddress = emailAddress.service.defaultFromEmail;
          Severity: Minor
          Found in ghost/core/core/server/services/mail/GhostMailer.js - About 1 hr to fix

            Function prepSettingsForEmailVerification has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async prepSettingsForEmailVerification(settings, getSetting) {
                    const filteredSettings = [];
                    const emailsToVerify = [];
            
                    for (const setting of settings) {
            Severity: Minor
            Found in ghost/core/core/server/services/settings/SettingsBREADService.js - About 1 hr to fix

              Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  constructor(name) {
                      super({gc: true});
                      this.name = name;
                      /**
                       * Maps from conn to set of controlled user ids. Delete all user ids from awareness when this conn is closed
              Severity: Minor
              Found in ghost/core/core/server/services/lexical-multiplayer/y-websocket.js - About 1 hr to fix

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

                    start(options) {
                        debug('start');
                
                        // CASE: nobody is in the event queue waiting yet
                        // e.g. all resources are fetched already, but no subscribers (bootstrap)
                Severity: Minor
                Found in ghost/core/core/server/services/url/Queue.js - About 1 hr to fix

                  Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      init() {
                          const CommentsService = require('./CommentsService');
                          const CommentsController = require('./CommentsController');
                          const CommentsStats = require('./CommentsStatsService');
                  
                  
                  Severity: Minor
                  Found in ghost/core/core/server/services/comments/index.js - About 1 hr to fix

                    Function down has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        async function down(knex) {
                            logging.info('Deleting built in collection_posts');
                    
                            const existingLatestCollection = await knex('collections')
                                .where({

                      Function removePermissionFromRoleHelper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function removePermissionFromRoleHelper(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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async function up(knex) {
                                const allOffers = await knex
                                    .select('id', 'name')
                                    .from('offers');
                        
                        

                          Function addIntegrationContentKey has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const addIntegrationContentKey = async (knex, integration) => {
                              const message = `Adding "${integration.name}" integration content key`;
                          
                              const existingIntegration = await knex('integrations').select('id').where({
                                  slug: integration.slug

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

                                async function up(knex) {
                                    const portalPlansRaw = await knex('settings').select('value').where('key', 'portal_plans').first();
                                    const freeTier = await knex('products').select('visibility').where('type', 'free').first();
                            
                                    if (!portalPlansRaw || !freeTier) {

                              Function getAnnouncementBarHelper has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getAnnouncementBarHelper(data) {
                                  const preview = data?.site?._preview;
                                  const isFilled = settingsCache.get('announcement_content') && settingsCache.get('announcement_visibility').length;
                              
                                  if (!isFilled && !preview) {
                              Severity: Minor
                              Found in ghost/core/core/frontend/helpers/ghost_head.js - About 1 hr to fix

                                Function fetchRecommendations has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                async function fetchRecommendations(apiOptions) {
                                    let timer;
                                
                                    try {
                                        const controller = api.recommendationsPublic;
                                Severity: Minor
                                Found in ghost/core/core/frontend/helpers/recommendations.js - About 1 hr to fix

                                  Function scrollSidebarNav has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const scrollSidebarNav = (navElement: HTMLLIElement, doneInitialScroll: boolean) => {
                                      // const sidebar = document.getElementById('admin-x-settings-sidebar')!;
                                      const sidebar = document.getElementById('admin-x-settings-sidebar-scroller')!;
                                  
                                      const bounds = navElement.getBoundingClientRect();
                                  Severity: Minor
                                  Found in apps/admin-x-settings/src/hooks/useScrollSection.tsx - About 1 hr to fix

                                    Function import has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        async import() {
                                            let offset = 0;
                                            let limit = 5000;
                                            this.products = await this.transaction.select('id', 'name').from('products').whereNot('type', 'free');
                                            this.stripeProducts = await this.transaction.select('id', 'product_id', 'stripe_product_id').from('stripe_products');

                                      Function compare has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          compare(postA, postB) {
                                              let updated1 = postA.get('updatedAtUTC');
                                              let updated2 = postB.get('updatedAtUTC');
                                              let idResult,
                                                  publishedAtResult,
                                      Severity: Minor
                                      Found in ghost/admin/app/models/post.js - About 1 hr to fix

                                        Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            init() {
                                                this._super(...arguments);
                                                this.set('errors', Errors.create());
                                                this.set('hasValidated', emberA());
                                        
                                        
                                        Severity: Minor
                                        Found in ghost/admin/app/mixins/validation-engine.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language