TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function checkoutDonation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        async checkoutDonation({successUrl, cancelUrl, metadata = {}} = {}) {
            const identity = await api.member.identity();
            const url = endpointFor({type: 'members', resource: 'create-stripe-checkout-session'});

            const metadataObj = {
Severity: Minor
Found in apps/portal/src/utils/api.js - About 1 hr to fix

    Function emailPostController has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function emailPostController(req, res, next) {
        debug('emailPostController');
    
        const api = require('../../proxy').api;
    
    
    Severity: Minor
    Found in ghost/core/core/frontend/services/routing/controllers/email-post.js - About 1 hr to fix

      Function dispatchAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async dispatchAction(action, data) {
              clearTimeout(this.timeoutId);
              this.setState({
                  action: `${action}:running`
              });
      Severity: Minor
      Found in apps/portal/src/App.js - About 1 hr to fix

        Function renderProductCard has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderProductCard({product, offer, currencyClass, updatedPrice, price, benefits}) {
                const {t} = this.context;
        
                if (this.state.showNewsletterSelection) {
                    return null;
        Severity: Minor
        Found in apps/portal/src/components/pages/OfferPage.js - About 1 hr to fix

          Function injectContentIntoIframe has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const injectContentIntoIframe = useCallback((iframe: HTMLIFrameElement) => {
                  if (!url || !previewData) {
                      return;
                  }
          
          

            Function updateOffer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async updateOffer(data, options = {}) {
                    return await this.repository.createTransaction(async (transaction) => {
                        const updateOptions = {...options, transacting: transaction};
                        const uniqueChecker = new UniqueChecker(this.repository, transaction);
            
            
            Severity: Minor
            Found in ghost/offers/lib/application/OffersAPI.js - About 1 hr to fix

              Function codemirrorAssets has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const codemirrorAssets = function () {
                  let codemirrorFiles = [
                      'lib/codemirror.js',
                      'mode/htmlmixed/htmlmixed.js',
                      'mode/xml/xml.js',
              Severity: Minor
              Found in ghost/admin/ember-cli-build.js - About 1 hr to fix

                Function paginateModelCollection has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function paginateModelCollection(modelName, collection, page, limit) {
                    let pages, next, prev, models;
                
                    if (limit === 'all') {
                        pages = 1;
                Severity: Minor
                Found in ghost/admin/mirage/utils.js - About 1 hr to fix

                  Function amount has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      amount(model) {
                          if (model.amount === '' || model.amount === undefined) {
                              model.errors.add('amount', 'Please enter the amount.');
                  
                              return this.invalidate();
                  Severity: Minor
                  Found in ghost/admin/app/validators/offer.js - About 1 hr to fix

                    Function validate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        validate(opts) {
                            let model = this;
                            let hasValidated,
                                type,
                                validator;
                    Severity: Minor
                    Found in ghost/admin/app/mixins/validation-engine.js - About 1 hr to fix

                      Function parse has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function parse(path) {
                          let source;
                          let json;
                      
                          try {
                      Severity: Minor
                      Found in ghost/package-json/lib/parse.js - About 1 hr to fix

                        Function minify has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            async minify(globs, options) {
                                debug('Begin', globs);
                                const destinations = Object.keys(globs);
                                const minifiedFiles = [];
                        
                        
                        Severity: Minor
                        Found in ghost/minifier/lib/Minifier.js - About 1 hr to fix

                          Function subscribe has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              subscribe(domainEvents) {
                                  domainEvents.subscribe(MemberCreatedEvent, async (event) => {
                                      let attribution = event.data.attribution;
                          
                                      await this.models.MemberCreatedEvent.add({
                          Severity: Minor
                          Found in ghost/members-events-service/lib/EventStorage.js - About 1 hr to fix

                            Function updateCheckData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                async updateCheckData() {
                                    let data = {};
                                    let mailConfig = this.config.mail;
                            
                                    data.ghost_version = this.config.ghostVersion;
                            Severity: Minor
                            Found in ghost/update-check-service/lib/UpdateCheckService.js - About 1 hr to fix

                              Function onUpdating has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      onUpdating: function onUpdating(model, attr, options) {
                                          if (this.relationships) {
                                              model.changed = _.omit(model.changed, this.relationships);
                                          }
                              
                              
                              Severity: Minor
                              Found in ghost/core/core/server/models/base/plugins/events.js - About 1 hr to fix

                                Function findOne has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    findOne: function findOne(dataToClone, unfilteredOptions) {
                                        const options = this.filterOptions(unfilteredOptions, 'findOne');
                                        let query;
                                        let status;
                                        let data = _.cloneDeep(dataToClone);
                                Severity: Minor
                                Found in ghost/core/core/server/models/user.js - About 1 hr to fix

                                  Function createBulkOperation has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function createBulkOperation(singular, multiple) {
                                      return async function (knex, table, data, options) {
                                          const result = {
                                              successful: 0,
                                              unsuccessful: 0,
                                  Severity: Minor
                                  Found in ghost/core/core/server/models/base/plugins/bulk-operations.js - About 1 hr to fix

                                    Function setAccessCookies has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    const setAccessCookies = function setAccessCookies(member, req, res, freeTier) {
                                        if (!member) {
                                            // If there is no cookie sent with the request, return early
                                            if (!req.headers.cookie || !req.headers.cookie.includes('ghost-access')) {
                                                return;
                                    Severity: Minor
                                    Found in ghost/core/core/server/services/members/middleware.js - About 1 hr to fix

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

                                          async init() {
                                              this.Suppression = models.Suppression;
                                              const handleEvent = reason => async (event) => {
                                                  try {
                                                      if (reason === 'bounce') {

                                        Function getLastEventTimestamp has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            async getLastEventTimestamp(jobName, events = ['delivered', 'opened', 'failed']) {
                                                const startDate = new Date();
                                                
                                                let maxOpenedAt;
                                                let maxDeliveredAt;
                                        Severity: Minor
                                        Found in ghost/core/core/server/services/email-analytics/lib/queries.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language