Repository: freeCodeCamp/freeCodeCamp
File: curriculum/get-challenges.js (JavaScript)

Code before:
// without passing around a ton of arguments.
function generateChallengeCreator(lang, englishPath, i18nPath) {
  function addMetaToChallenge(challenge, meta) {
    function addChapterAndModuleToChallenge(challenge) {
      if (chapterBasedSuperBlocks.includes(challenge.superBlock)) {
        const chapter = getChapterFromBlock(
          challenge.block,
          fullStackSuperBlockStructure
        );

        if (!meta.isUpcomingChange && chapter.comingSoon) {
          throw Error(
            `The '${chapter.dashedName}' chapter is 'comingSoon', but it's '${meta.dashedName}' block is not hidden. Set its 'isUpcomingChange' set to 'true' in the 'meta.json' for the block to hide it.`
          );
        }

        challenge.chapter = chapter.dashedName;

        const module = getModuleFromBlock(
          challenge.block,
          fullStackSuperBlockStructure
        );

        if (!meta.isUpcomingChange && module.comingSoon) {
          throw Error(
            `The '${chapter.dashedName}' module is 'comingSoon', but it's '${meta.dashedName}' block is not hidden. Set its 'isUpcomingChange' set to 'true' in the 'meta.json' for the block to hide it.`
          );
        }

        challenge.module = module.dashedName;
      }
    }
    const challengeOrder = findIndex(
      meta.challengeOrder,
      ({ id }) => id === challenge.id
    );

    const isLastChallengeInBlock =
      meta.challengeOrder.length - 1 === challengeOrder;

    const isObjectIdFilename = /\/[a-z0-9]{24}\.md$/.test(englishPath);
    if (isObjectIdFilename) {
      const filename = englishPath.split('/').pop();
      if (filename !== `${challenge.id}.md`) {
        throw Error(
          `Filename matches MongoDB ObjectID pattern, but ${filename} does not match challenge id ${challenge.id}`
        );
      }
    }

    challenge.block = meta.dashedName;

Review comment (suggestion):
```suggestion
            `The '${chapter.dashedName}' module is 'comingSoon', but its '${meta.dashedName}' block is not hidden. Set 'isUpcomingChange' to 'true' in the 'meta.json' for the block to hide it.`
```

Code after:
// without passing around a ton of arguments.
function generateChallengeCreator(lang, englishPath, i18nPath) {
  function addMetaToChallenge(challenge, meta) {
    function addChapterAndModuleToChallenge(challenge) {
      if (chapterBasedSuperBlocks.includes(challenge.superBlock)) {
        const chapter = getChapterFromBlock(
          challenge.block,
          fullStackSuperBlockStructure
        );

        if (!meta.isUpcomingChange && chapter.comingSoon) {
          throw Error(
            `The '${chapter.dashedName}' chapter is 'comingSoon', but its '${meta.dashedName}' block is not hidden. Set 'isUpcomingChange' to 'true' in the 'meta.json' for the block to hide it.`
          );
        }

        challenge.chapter = chapter.dashedName;

        const module = getModuleFromBlock(
          challenge.block,
          fullStackSuperBlockStructure
        );

        if (!meta.isUpcomingChange && module.comingSoon) {
          throw Error(
            `The '${chapter.dashedName}' module is 'comingSoon', but its '${meta.dashedName}' block is not hidden. Set 'isUpcomingChange' to 'true' in the 'meta.json' for the block to hide it.`
          );
        }

        challenge.module = module.dashedName;
      }
    }
    const challengeOrder = findIndex(
      meta.challengeOrder,
      ({ id }) => id === challenge.id
    );

    const isLastChallengeInBlock =
      meta.challengeOrder.length - 1 === challengeOrder;

    const isObjectIdFilename = /\/[a-z0-9]{24}\.md$/.test(englishPath);
    if (isObjectIdFilename) {
      const filename = englishPath.split('/').pop();
      if (filename !== `${challenge.id}.md`) {
        throw Error(
          `Filename matches MongoDB ObjectID pattern, but ${filename} does not match challenge id ${challenge.id}`
        );
      }
    }

    challenge.block = meta.dashedName;