Use the prefix id for keying into metrics rules
Fixes a bug where we were looking for incorrect keys for metrics rules. Previously, we were using full language names in the keys. Now, we use the short language names in the metric ids. This is done through a simplification of the code. Also, this change does two smaller things: 1. Prints out the baseline count to the logs 2. Adds the `assertNever` function to ensure we never miss a case in a switch statement. This function is borrowed from vscode-codeql.
This commit is contained in:
parent
4c0671c518
commit
e8b2a9884b
15 changed files with 168 additions and 116 deletions
17
lib/util.js
generated
17
lib/util.js
generated
|
|
@ -320,4 +320,21 @@ async function getGitHubAuth(logger, githubAuth, fromStdIn, readable = process.s
|
|||
throw new Error("No GitHub authentication token was specified. Please provide a token via the GITHUB_TOKEN environment variable, or by adding the `--github-auth-stdin` flag and passing the token via standard input.");
|
||||
}
|
||||
exports.getGitHubAuth = getGitHubAuth;
|
||||
/**
|
||||
* This error is used to indicate a runtime failure of an exhaustivity check enforced at compile time.
|
||||
*/
|
||||
class ExhaustivityCheckingError extends Error {
|
||||
constructor(expectedExhaustiveValue) {
|
||||
super("Internal error: exhaustivity checking failure");
|
||||
this.expectedExhaustiveValue = expectedExhaustiveValue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Used to perform compile-time exhaustivity checking on a value. This function will not be executed at runtime unless
|
||||
* the type system has been subverted.
|
||||
*/
|
||||
function assertNever(value) {
|
||||
throw new ExhaustivityCheckingError(value);
|
||||
}
|
||||
exports.assertNever = assertNever;
|
||||
//# sourceMappingURL=util.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue