TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    async setupWebhook(id, secret, opts = {}) {
        if (!id || !secret || opts.forceCreate) {
            if (id && !opts.skipDelete) {
                try {
                    await this.api.deleteWebhookEndpoint(id);
Severity: Minor
Found in ghost/stripe/lib/WebhookManager.js - About 1 hr to fix

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

        async destroy(data, options) {
            const member = await this._Member.findOne(data, options);
    
            if (!member) {
                // throw error?
    Severity: Minor
    Found in ghost/members-api/lib/repositories/MemberRepository.js - About 1 hr to fix

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

          check: function check(object) {
              const self = this;
      
              return this.getByEmail(object.email)
                  .then((user) => {
      Severity: Minor
      Found in ghost/core/core/server/models/user.js - About 1 hr to fix

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

            onSaving: function onSaving(model, attr, options) {
                let labelsToSave = [];
        
                if (_.isUndefined(this.get('labels'))) {
                    this.unset('labels');
        Severity: Minor
        Found in ghost/core/core/server/models/member.js - About 1 hr to fix

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

          const getPostServiceInstance = () => {
              const urlUtils = require('../../../shared/url-utils');
              const labs = require('../../../shared/labs');
              const models = require('../../models');
              const PostStats = require('./stats/PostStats');
          Severity: Minor
          Found in ghost/core/core/server/services/posts/posts-service.js - About 1 hr to fix

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

                async notifyPostAuthors(comment) {
                    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')});
            
                    for (const author of post.related('authors')) {
            Severity: Minor
            Found in ghost/core/core/server/services/comments/CommentsServiceEmails.js - About 1 hr to fix

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

                  async commentOnPost(post, member, comment, options) {
                      this.checkEnabled();
                      const memberModel = await this.models.Member.findOne({
                          id: member
                      }, {
              Severity: Minor
              Found in ghost/core/core/server/services/comments/CommentsService.js - About 1 hr to fix

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

                    async doImport(options, importOptions) {
                        debug('doImport', this.modelName, this.dataToImport.length);
                
                        let ops = [];
                
                

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

                      const renderCounts = function () {
                          for (const [id, count] of Object.entries(countsMap)) {
                              const countElems = document.querySelectorAll(`[data-ghost-comment-count="${id}"]`);
                              countElems.forEach((e) => {
                                  let text = e.dataset.ghostCommentCountEmpty;
                  Severity: Minor
                  Found in ghost/core/core/frontend/src/comment-counts/js/comment-counts.js - About 1 hr to fix

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

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

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

                      function entryLookup(postUrl, routerOptions, locals) {
                          debug(postUrl);
                      
                          const api = require('../proxy').api;
                          const targetPath = url.parse(postUrl).path;
                      Severity: Minor
                      Found in ghost/core/core/frontend/services/data/entry-lookup.js - About 1 hr to fix

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

                            async fetchPageHtml(url, options = {}) {
                                // Fetch url and get response as binary buffer to
                                // avoid implicit cast
                                let {headers, body, url: responseUrl} = await this.fetchPage(
                                    url,
                        Severity: Minor
                        Found in ghost/oembed-service/lib/OEmbedService.js - About 1 hr to fix

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

                              renderSignupTerms() {
                                  const {site} = this.context;
                          
                                  if (site.portal_signup_terms_html === null || site.portal_signup_terms_html === '') {
                                      return null;
                          Severity: Minor
                          Found in apps/portal/src/components/pages/SignupPage.js - About 1 hr to fix

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

                                renderSignupTerms() {
                                    const {site} = this.context;
                                    if (site.portal_signup_terms_html === null || site.portal_signup_terms_html === '') {
                                        return null;
                                    }
                            Severity: Minor
                            Found in apps/portal/src/components/pages/OfferPage.js - About 1 hr to fix

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

                                  static async create(data: any): Promise<Collection> {
                                      let id;
                              
                                      if (!data.id) {
                                          id = new ObjectID();
                              Severity: Minor
                              Found in ghost/collections/src/Collection.ts - About 1 hr to fix

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

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

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

                                  export function minimumAmountForCurrency(currency: string) {
                                      const isoCurrency = currency?.toUpperCase();
                                  
                                      switch (isoCurrency) {
                                      case 'AED':
                                  Severity: Minor
                                  Found in apps/admin-x-settings/src/utils/currency.ts - About 1 hr to fix

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

                                    export function useOptions(scriptTag: HTMLElement) {
                                        const buildOptions = React.useCallback(() => {
                                            const labels = [];
                                    
                                            while (scriptTag.dataset[`label-${labels.length + 1}`]) {
                                    Severity: Minor
                                    Found in apps/signup-form/src/utils/options.tsx - About 1 hr to fix

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

                                      const handleResponse = async (response: Response) => {
                                          if (response.status === 0) {
                                              throw new ServerUnreachableError();
                                          } else if (response.status === 503) {
                                              throw new MaintenanceError(response, await response.text());
                                      Severity: Minor
                                      Found in apps/admin-x-framework/src/utils/api/handleResponse.ts - About 1 hr to fix

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

                                            generate() {
                                                const count = this.count;
                                                this.count = this.count + 1;
                                        
                                                const relatedProduct = this.products.find(product => product.id === this.model.product_id);
                                        Severity: Minor
                                        Found in ghost/data-generator/lib/importers/StripePricesImporter.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language