TryGhost/Ghost

View on GitHub

Showing 1,820 of 4,015 total issues

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

    async doImport(options, importOptions) {
        debug('doImport', this.modelName, this.dataToImport.length);

        let ops = [];

Severity: Minor
Found in ghost/core/core/server/data/importer/importers/data/TagsImporter.js - About 1 hr to fix

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

    module.exports = createIrreversibleMigration(async (knex) => {
        logging.info('Updating unsplash setting value');
    
        const unsplashSetting = await knex('settings')
            .select('value')

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

          async function down(knex) {
              const freeTier = await knex('products').select('id').where('type', 'free').first();
              const portalPlanSetting = await knex('settings').select('value').where('key', 'portal_plans').first();
      
              if (!freeTier) {

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

            async function down(knex) {
                // eslint-disable-next-line no-restricted-syntax
                const compedMemberIds = (await knex('members')
                    .select('members.id')
                    .innerJoin(

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

              async function up(knex) {
                  // eslint-disable-next-line no-restricted-syntax
                  const compedMemberIds = (await knex('members')
                      .select('members.id')
                      .innerJoin(

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

            const single = name => function singleUploadFunction(req, res, next) {
                const singleUpload = upload.single(name);
            
                singleUpload(req, res, (err) => {
                    if (err) {
            Severity: Minor
            Found in ghost/core/core/server/web/api/middleware/upload.js - About 1 hr to fix

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

              module.exports = function pagination(options) {
                  options = options || {};
                  options.hash = options.hash || {};
                  options.data = options.data || {};
              
              
              Severity: Minor
              Found in ghost/core/core/frontend/helpers/pagination.js - About 1 hr to fix

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

                function updateLocalTemplateOptions(req, res, next) {
                    const localTemplateOptions = hbs.getLocalTemplateOptions(res.locals);
                
                    // adjust @site.url for http/https based on the incoming request
                    const siteData = {

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

                  function getOgImage(data) {
                      const context = data.context ? data.context : null;
                      const contextObject = getContextObject(data, context);
                  
                      if (_.includes(context, 'home')) {
                  Severity: Minor
                  Found in ghost/core/core/frontend/meta/og-image.js - About 1 hr to fix

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

                    module.exports = function match(...attrs) {
                        // options = options || {};
                        // options.hash = options.hash || {};
                        // options.data = options.data || {};
                    
                    
                    Severity: Minor
                    Found in ghost/core/core/frontend/helpers/match.js - About 1 hr to fix

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

                      function getTwitterImage(data) {
                          const context = data.context ? data.context : null;
                          const contextObject = getContextObject(data, context);
                      
                          if (_.includes(context, 'home')) {
                      Severity: Minor
                      Found in ghost/core/core/frontend/meta/twitter-image.js - About 1 hr to fix

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

                                .then(function then(lookup) {
                                    // Format data 1
                                    const entry = lookup ? lookup.entry : false;
                        
                                    if (!entry) {
                        Severity: Minor
                        Found in ghost/core/core/frontend/services/routing/controllers/entry.js - About 1 hr to fix

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

                          function SearchResultBox() {
                              const {searchValue = '', searchIndex, indexComplete} = useContext(AppContext);
                              let searchResults = null;
                              let filteredTags = [];
                              let filteredPosts = [];
                          Severity: Minor
                          Found in apps/sodo-search/src/components/PopupModal.js - About 1 hr to fix

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

                                constructor(options) {
                                    options = options || {};
                            
                                    options.maxPerPage = options.maxPerPage || 50000;
                            
                            
                            Severity: Minor
                            Found in ghost/core/core/frontend/services/sitemap/SiteMapManager.js - About 1 hr to fix

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

                              export default function EmailSuppressedPage() {
                                  const {brandColor, onAction, site, t, pageData} = useContext(AppContext);
                              
                                  const supportAddress = `mailto:${getSupportAddress({site})}`;
                                  const directAccess = (pageData && pageData.direct) || false;
                              Severity: Minor
                              Found in apps/portal/src/components/pages/EmailSuppressionFAQ.js - About 1 hr to fix

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

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

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

                                      async handleOfferQuery({site, offerId, member = this.state.member}) {
                                          const {portal_button: portalButton} = site;
                                          removePortalLinkFromUrl();
                                          if (!isPaidMember({member})) {
                                              try {
                                  Severity: Minor
                                  Found in apps/portal/src/App.js - About 1 hr to fix

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

                                        renderSubmitButton() {
                                            const {action, brandColor, t} = this.context;
                                            const {pageData: offer} = this.context;
                                            let label = t('Continue');
                                    
                                    
                                    Severity: Minor
                                    Found in apps/portal/src/components/pages/OfferPage.js - About 1 hr to fix

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

                                      const ImportModalContent = () => {
                                          const modal = useModal();
                                          const {mutateAsync: importContent} = useImportContent();
                                          const [uploading, setUploading] = useState(false);
                                          const handleError = useHandleError();

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

                                        const ViewFollowingModal: React.FC<RoutingModalProps> = ({}) => {
                                            const {updateRoute} = useRouting();
                                        
                                            const {data: following = []} = useFollowingForUser('index');
                                        
                                        
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language