1
0
mirror of synced 2026-01-04 00:06:20 -05:00

Merge pull request #25194 from github/repo-sync

repo sync
This commit is contained in:
Octomerger Bot
2023-04-24 14:37:46 -04:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ function readFrontmatter(markdown, opts = {}) {
if (filepath) error.filepath = filepath
errors.push(error)
console.log(errors)
console.warn(errors)
return { errors }
}

View File

@@ -41,6 +41,20 @@ console.warn = console.error = (...args) => {
} else if (args[0]?.constructor === Object) {
const path = args[0].path?.replace('/index.md', '').replace('.md', '')
issues.push({ path, message: args[0].message, score: scores[path] || 0 })
} else if (Array.isArray(args[0]) && args[0][0]?.constructor === Object && args[0][0].filepath) {
// This is a YML parsing error. It's serious enough to bump the score.
let message = args[0][0].message
if (args[0][0].reason) {
message += ` (reason: ${args[0][0].reason})`
}
const path = args[0][0].filepath
// By giving it a +100 on the score, it at least stands above all the
// other issues which are mostly score 0. It's artificial but it works.
issues.push({ path, message, score: (scores[path] || 0) + 100 })
} else {
// Don't use .warn() because this logging here is for the engineer
// working on this script.
console.log("WARNING: Don't know how to turn these args into an issue", args)
}
}