TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    async function up(knex) {
        logging.info('Backfilling "offer_id" column in "members_stripe_customers_subscriptions" by matching tier and cadence');

        const subquery = `
            SELECT

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

        async function down(connection) {
            const newSetting = await connection('settings')
                .where('key', 'members_signup_access')
                .select('value', 'created_by', 'updated_by')
                .first();

      Function clickHandler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function clickHandler(event) {
                  el.removeEventListener('click', clickHandler);
                  event.preventDefault();
                  el.classList.remove('error');
                  el.classList.add('loading');
      Severity: Minor
      Found in apps/portal/src/data-attributes.js - About 1 hr to fix

        Function clickHandler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function clickHandler(event) {
                    el.removeEventListener('click', clickHandler);
                    event.preventDefault();
                    el.classList.remove('error');
                    el.classList.add('loading');
        Severity: Minor
        Found in apps/portal/src/data-attributes.js - About 1 hr to fix

          Function validateFilter has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function validateFilter(filter: string | null, type: 'manual' | 'automatic', isAllowedEmpty = false) {
              const allowedProperties = ['featured', 'published_at', 'tag', 'tags'];
              if (type === 'manual') {
                  if (filter !== null) {
                      throw new ValidationError({
          Severity: Minor
          Found in ghost/collections/src/Collection.ts - About 1 hr to fix

            Function useSearchService has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const useSearchService = () => {
                const [filter, setFilter] = useState('');
                const [noResult, setNoResult] = useState(false);
            
                const checkVisible = (keywords: string[]) => {
            Severity: Minor
            Found in apps/admin-x-settings/src/utils/search.tsx - About 1 hr to fix

              Function initialize has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function initialize(applicationInstance) {
                  const config = new TrackedObject({});
              
                  Object.defineProperty(config, 'availableTimezones', {
                      get() {
              Severity: Minor
              Found in ghost/admin/app/instance-initializers/config.js - About 1 hr to fix

                Function get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async get(data, options = {}) {
                        if (!options.transacting) {
                            return this._Product.transaction((transacting) => {
                                return this.get(data, {
                                    ...options,
                Severity: Minor
                Found in ghost/members-api/lib/repositories/ProductRepository.js - About 1 hr to fix

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

                      edit: function (data, unfilteredOptions) {
                          const options = this.filterOptions(unfilteredOptions, 'edit');
                          const self = this;
                  
                          if (!Array.isArray(data)) {
                  Severity: Minor
                  Found in ghost/core/core/server/models/settings.js - About 1 hr to fix

                    Function authenticateContentApiKey has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const authenticateContentApiKey = async function authenticateContentApiKey(req, res, next) {
                        // allow fallthrough to other auth methods or final ensureAuthenticated check
                        if (!req.query || !req.query.key) {
                            return next();
                        }
                    Severity: Minor
                    Found in ghost/core/core/server/services/auth/api-key/content.js - About 1 hr to fix

                      Function addFixturesForRelation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          async addFixturesForRelation(relationFixture, options) {
                              const ops = [];
                              let max = 0;
                      
                              const data = await this.fetchRelationData(relationFixture, options);
                      Severity: Minor
                      Found in ghost/core/core/server/data/schema/fixtures/FixtureManager.js - About 1 hr to fix

                        Function mediaUploadValidation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            return function mediaUploadValidation(req, res, next) {
                                const extensions = (config.get('uploads')[type] && config.get('uploads')[type].extensions) || [];
                                const contentTypes = (config.get('uploads')[type] && config.get('uploads')[type].contentTypes) || [];
                        
                                const thumbnailExtensions = (config.get('uploads').thumbnails && config.get('uploads').thumbnails.extensions) || [];
                        Severity: Minor
                        Found in ghost/core/core/server/web/api/middleware/upload.js - About 1 hr to fix

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

                              async function up(knex) {
                                  logging.info('Creating built in collections');
                          
                                  const existingLatestCollection = await knex('collections')
                                      .where({

                            Function getAmperizeHTML has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function getAmperizeHTML(html, post) {
                                if (!html) {
                                    return;
                                }
                            
                            
                            Severity: Minor
                            Found in ghost/core/core/frontend/apps/amp/lib/helpers/amp_content.js - About 1 hr to fix

                              Function getTitle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function getTitle(data, root, options = {}) {
                                  const context = root ? root.context : null;
                                  const siteTitle = settingsCache.get('title') || '';
                                  const pagination = root ? root.pagination : null;
                              
                              
                              Severity: Minor
                              Found in ghost/core/core/frontend/meta/title.js - About 1 hr to fix

                                Function HeaderNotification has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    const HeaderNotification = () => {
                                        if (pageData.comments && commentsEnabled) {
                                            const hideClassName = hasInteracted ? 'gh-portal-hide' : '';
                                            return (
                                                <>
                                Severity: Minor
                                Found in apps/portal/src/components/pages/AccountEmailPage.js - About 1 hr to fix

                                  Function HeaderNotification has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      const HeaderNotification = () => {
                                          if (pageData.comments && commentsEnabled) {
                                              const hideClassName = hasInteracted ? 'gh-portal-hide' : '';
                                              return (
                                                  <>
                                  Severity: Minor
                                  Found in apps/portal/src/components/pages/UnsubscribePage.js - About 1 hr to fix

                                    Function handleSignup has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

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

                                      Function fetchOfferQueryStrData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          fetchOfferQueryStrData(qs = '') {
                                              const qsParams = new URLSearchParams(qs);
                                              const data = {};
                                              // Handle the query params key/value pairs
                                              for (let pair of qsParams.entries()) {
                                      Severity: Minor
                                      Found in apps/portal/src/App.js - About 1 hr to fix

                                        Function StripeConnectModal has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        const StripeConnectModal: React.FC = () => {
                                            const {config, settings} = useGlobalData();
                                            const stripeConnectAccountId = getSettingValue(settings, 'stripe_connect_account_id');
                                            const {updateRoute} = useRouting();
                                            const [step, setStep] = useState<'start' | 'connect'>('start');
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language