diff --git a/.github/etc/create-review.cjs b/.github/etc/create-review.cjs index d916e3586..323a6290b 100644 --- a/.github/etc/create-review.cjs +++ b/.github/etc/create-review.cjs @@ -28,7 +28,7 @@ Generally, for each spelling mistake there are 2 ways to fix it: ` const getInvalidUrlText = (text, link) => { - const updatedLink = (link.includes('localhost') ? 'http' : 'https') + '://' + link.split('/').slice(1).join('/') + const updatedLink = link.replace('http', 'https') return createSuggestionText(`${text}(${updatedLink})`) + 'Please use wellformed URLs.' } @@ -141,10 +141,10 @@ module.exports = async ({ github, require, exec, core }) => { // [only-wellformed-urls: URLs should be wellformed] -> only-wellformed-urls const ruleName = details.split(':')[0].slice(1) - if (ruleName === 'only-wellformed-urls') { + if (ruleName === 'prefer-https-links') { const [, text, link] = context.match(/\[Context:.*(\[.*\])(\(.*\)).*\]/) - description = 'Only use wellformed URLs' + description = 'https links should be prefered' contextText = `[Context: "${escapeMarkdownlink(text + link)}"]` const { line, position } = await findPositionInDiff(text + link, path) diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 8b605f9af..305c818f1 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -12,6 +12,6 @@ code-fence-style: no-empty-links: true search-replace: rules: - - name: only-wellformed-urls - message: URLs should be wellformed - searchPattern: /\[.*?\]\((?!(https:\/\/|http://localhost|#)).+?\)/g + - name: prefer-https-links + message: https links should be prefered + searchPattern: /http:\/\/(?!localhost).*/g