TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

Function shortToLongForm has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const shortToLongForm = (shortForm, options = {}) => {
        let longForm = {
            query: {},
            router: {}
        };
Severity: Minor
Found in ghost/core/core/server/services/route-settings/validate.js - About 1 hr to fix

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

        add(options) {
            const {url, generatorId, resource} = options;
            debug('add', resource.data.id, url);
    
            if (this.urls[resource.data.id]) {
    Severity: Minor
    Found in ghost/core/core/server/services/url/Urls.js - About 1 hr to fix

      Function save has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          async save(offer, options) {
              /** @type any */
              const data = {
                  id: offer.id,
                  name: offer.name.value,
      Severity: Minor
      Found in ghost/core/core/server/services/offers/OfferBookshelfRepository.js - About 1 hr to fix

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

        const init = () => {
            let helpLink;
        
            if (config.get('hostSettings:billing:enabled') && config.get('hostSettings:billing:enabled') === true && config.get('hostSettings:billing:url')) {
                helpLink = config.get('hostSettings:billing:url');
        Severity: Minor
        Found in ghost/core/core/server/services/limits.js - About 1 hr to fix

          Function setupApiApp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function setupApiApp() {
              debug('Admin API setup start');
              const apiApp = express('admin api');
          
              // API middleware
          Severity: Minor
          Found in ghost/core/core/server/web/api/endpoints/admin/app.js - About 1 hr to fix

            Function populateImageSizes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                populateImageSizes: async function (mobiledocJson) {
                    // do not require image-size until it's requested to avoid circular dependencies
                    // shared/url-utils > server/lib/mobiledoc > server/lib/image/image-size > server/adapters/storage/utils
                    const {imageSize} = require('./image');
            
            
            Severity: Minor
            Found in ghost/core/core/server/lib/mobiledoc.js - About 1 hr to fix

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

                  async function up(knex) {
                      const membersWithProduct = await knex
                          .select('id')
                          .from('members')
                          .whereIn('status', ['comped', 'paid']);

                Function tags has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function tags(options) {
                    options = options || {};
                    options.hash = options.hash || {};
                
                    const autolink = !(isString(options.hash.autolink) && options.hash.autolink === 'false');
                Severity: Minor
                Found in ghost/core/core/frontend/helpers/tags.js - About 1 hr to fix

                  Function initNestDependencies has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function initNestDependencies() {
                      debug('Begin: initNestDependencies');
                      const GhostNestApp = require('@tryghost/ghost');
                      const providers = [];
                      providers.push({
                  Severity: Minor
                  Found in ghost/core/core/boot.js - About 1 hr to fix

                    Function getPostSchema has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function getPostSchema(metaData, data) {
                        // CASE: metaData.excerpt for post context is populated by either the custom excerpt, the meta description,
                        // or the automated excerpt of 50 words. It is empty for any other context.
                        const description = metaData.excerpt ? escapeExpression(metaData.excerpt) : null;
                    
                    
                    Severity: Minor
                    Found in ghost/core/core/frontend/meta/schema.js - About 1 hr to fix

                      Function corsOptionsDelegate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function corsOptionsDelegate(req, callback) {
                          const origin = req.header('Origin');
                          const corsOptions = {
                              origin: false, // disallow cross-origin requests by default
                              credentials: true, // required to allow admin-client to login to private sites
                      Severity: Minor
                      Found in ghost/core/core/frontend/web/middleware/cors.js - About 1 hr to fix

                        Function EmailPreferencesAction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function EmailPreferencesAction() {
                            const {onAction, member, t} = useContext(AppContext);
                            const emailSuppressed = isEmailSuppressed({member});
                            const page = emailSuppressed ? 'emailSuppressed' : 'accountEmail';
                        
                        

                          Function render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              render() {
                                  const {pageData: offer, site, t} = this.context;
                                  if (!offer) {
                                      return null;
                                  }
                          Severity: Minor
                          Found in apps/portal/src/components/pages/OfferPage.js - About 1 hr to fix

                            Function handleDelete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                const handleDelete = async () => {
                                    NiceModal.show(ConfirmationModal, {
                                        title: 'Are you sure you want to delete this?',
                                        prompt: (
                                            <>

                              Function renderSenderEmailField has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  const renderSenderEmailField = () => {
                                      // Self-hosters, or legacy Pro users
                                      if (!isManagedEmail(config)) {
                                          return (
                                              <TextField

                                Function compute has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    compute([event, hasMultipleNewsletters]) {
                                        const subject = event.data.member ? (event.data.member.name || event.data.member.email) : (event.data.name || event.data.email || '');
                                        const icon = this.getIcon(event);
                                        const action = this.getAction(event, hasMultipleNewsletters);
                                        const info = this.getInfo(event);
                                Severity: Minor
                                Found in ghost/admin/app/helpers/parse-member-event.js - About 1 hr to fix

                                  Function getTypeAndIdFromPath has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      getTypeAndIdFromPath(path) {
                                          const resource = this.urlService.getResource(path);
                                          if (!resource) {
                                              return;
                                          }
                                  Severity: Minor
                                  Found in ghost/member-attribution/lib/UrlTranslator.js - About 1 hr to fix

                                    Function drag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        @action
                                        drag(e) {
                                            e.preventDefault();
                                    
                                            let eventX, eventY;
                                    Severity: Minor
                                    Found in ghost/admin/app/modifiers/movable.js - About 1 hr to fix

                                      Function subscribeEvents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          subscribeEvents() {
                                              // Trigger email for free member signup
                                              this.DomainEvents.subscribe(MemberCreatedEvent, async (event) => {
                                                  try {
                                                      await this.handleEvent(MemberCreatedEvent, event);
                                      Severity: Minor
                                      Found in ghost/staff-service/lib/StaffService.js - About 1 hr to fix

                                        Function serveStaticContent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                return function serveStaticContent(req, res, next) {
                                                    return serveStatic(
                                                        storagePath,
                                                        {
                                                            maxAge: constants.ONE_YEAR_MS,
                                        Severity: Minor
                                        Found in ghost/core/core/server/adapters/storage/LocalStorageBase.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language