TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    async edit(data, options) {
        delete data.last_seen_at;

        let model;

Severity: Minor
Found in ghost/members-api/lib/services/MemberBREADService.js - About 1 hr to fix

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

        permissible: function permissible(roleModelOrId, action, context, unsafeAttrs, loadedPermissions, hasUserPermission, hasApiKeyPermission) {
            // If we passed in an id instead of a model, get the model
            // then check the permissions
            if (_.isNumber(roleModelOrId) || _.isString(roleModelOrId)) {
                // Get the actual role model
    Severity: Minor
    Found in ghost/core/core/server/models/role.js - About 1 hr to fix

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

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

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

            init() {
                if (this.service) {
                    // Already done
                    return;
                }
        Severity: Minor
        Found in ghost/core/core/server/services/member-attribution/index.js - About 1 hr to fix

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

                  getBulkAction(event, count, options) {
                      const actor = this.prototype.getActor(options);
          
                      // @NOTE: we ignore internal updates (`options.context.internal`) for now
                      if (!actor) {
          Severity: Minor
          Found in ghost/core/core/server/models/base/plugins/actions.js - About 1 hr to fix

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

            const icon = (frame) => {
                const iconExtensions = (config.get('uploads').icons && config.get('uploads').icons.extensions) || [];
            
                // We don't support resizing .ico files, so we set a lower max upload size
                const isIco = frame.file.ext.toLowerCase() === '.ico';

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

                  add(frame) {
                      const object = frame.data;
              
                      if (!object || !object.username || !object.password) {
                          return Promise.reject(new errors.UnauthorizedError({
              Severity: Minor
              Found in ghost/core/core/server/api/endpoints/session.js - About 1 hr to fix

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

                const nonePublicAuth = (apiConfig, frame) => {
                    debug('check admin permissions');
                
                    let singular;
                    if (apiConfig.docName.match(/ies$/)) {
                Severity: Minor
                Found in ghost/core/core/server/api/endpoints/utils/permissions.js - About 1 hr to fix

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

                      async trigger(event, model) {
                          const response = {
                              onSuccess: this.onSuccess.bind(this),
                              onError: this.onError.bind(this)
                          };
                  Severity: Minor
                  Found in ghost/core/core/server/services/webhooks/WebhookTrigger.js - About 1 hr to fix

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

                        async mapToOffer(model, options) {
                            const json = model.toJSON();
                            const count = await this.OfferRedemptionModel.where({offer_id: json.id}).count('id', {
                                transacting: options.transacting
                            });
                    Severity: Minor
                    Found in ghost/core/core/server/services/offers/OfferBookshelfRepository.js - About 1 hr to fix

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

                          async getOEmbedData(url, externalRequest) {
                              if (url.host === 'x.com') { // api is still at twitter.com... also not certain how people are getting x urls because twitter currently redirects every x host to twitter
                                  url = new URL('https://twitter.com' + url.pathname);
                              }
                      
                      
                      Severity: Minor
                      Found in ghost/core/core/server/services/oembed/TwitterOEmbedProvider.js - About 1 hr to fix

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

                        const installFromGithub = async (ref) => {
                            const [org, repo] = ref.toLowerCase().split('/');
                        
                            //TODO: move the organization check to config
                            if (limitService.isLimited('customThemes') && org.toLowerCase() !== 'tryghost') {
                        Severity: Minor
                        Found in ghost/core/core/server/services/themes/installer.js - About 1 hr to fix

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

                          const check = async function check(themeName, theme, options = {}) {
                              debug('Begin: Check');
                              // gscan can slow down boot time if we require on boot, for now nest the require.
                              const gscan = require('gscan');
                              const checkedVersion = 'v5';
                          Severity: Minor
                          Found in ghost/core/core/server/services/themes/validate.js - About 1 hr to fix

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

                                constructor() {
                                    const mediaHandler = new ImporterContentFileHandler({
                                        type: 'media',
                                        // @NOTE: making the second parameter strict folder "content/media" brakes the glob pattern
                                        //        in the importer, so we need to keep it as general "content" unless
                            Severity: Minor
                            Found in ghost/core/core/server/data/importer/import-manager.js - About 1 hr to fix

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

                                  constructor(allDataFromFile, options) {
                                      this.options = options;
                                      this.modelName = options.modelName;
                              
                                      // Problems are currently constructed but not displayed to the user
                              Severity: Minor
                              Found in ghost/core/core/server/data/importer/importers/data/Base.js - About 1 hr to fix

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

                                    async function up(knex) {
                                        logging.info('Adding Admin API key for "Self-Serve Migration Integration"');
                                
                                        const integration = await knex('integrations').where({
                                            slug: 'self-serve-migration',

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

                                      async function up(knex) {
                                          logging.info('Adding Admin API key for Ghost Explore Integration');
                                  
                                          const integration = await knex('integrations').where({
                                              slug: 'ghost-explore',

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

                                    module.exports = createIrreversibleMigration(async (knex) => {
                                        logging.info('Adding version to posts.mobiledoc objects and cleaning up deprecated card names');
                                    
                                        await knex.transaction(async (trx) => {
                                            // get list of posts ids, use .forUpdate to lock rows until the transaction is finished

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

                                          replaceIdentifiers() {
                                              debug('replaceIdentifiers');
                                      
                                              // map product_id -> product.id
                                              let invalidProducts = [];

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

                                            populatePriceData() {
                                                const invalidRows = [];
                                                _.each(this.dataToImport, (row) => {
                                                    if (row.slug === 'free') {
                                                        return;
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language