@mark1russell7/conventions 0.38.6 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/build/cli.js +1 -1
- package/build/index.d.ts +20 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/{run-Meooec24.js → run-kBEWFfNW.js} +18 -9
- package/build/run-kBEWFfNW.js.map +1 -0
- package/package.json +1 -1
- package/build/run-Meooec24.js.map +0 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ pnpm exec conventions fix
|
|
|
18
18
|
pnpm exec conventions --list
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Each break shows the file, the line, the rule and the fix. In GitHub Actions, the check also writes an annotation on the line of each break. It also writes a table of the rules to the summary of the run (`GITHUB_STEP_SUMMARY`). The exit code is 1 when a rule has a break.
|
|
21
|
+
Each break shows the file, the line, the rule and the fix. In GitHub Actions, the check also writes an annotation on the line of each break. It also writes a table of the rules to the summary of the run (`GITHUB_STEP_SUMMARY`). The exit code is 1 when a rule has a break. A break of a new rule before its day `failsFrom` is a warning. The check shows it with the status `warn` and a `::warning` annotation, and the exit code stays 0.
|
|
22
22
|
|
|
23
23
|
`conventions fix` writes the fixes that the rules know, and checks again. It continues until no fix applies. Each fix is an exact change of a file, and the fix writes it only when the file did not change after the check. These breaks have a fix:
|
|
24
24
|
|
|
@@ -244,6 +244,8 @@ A rule is a module in `src/rules/` that exports a `Rule`. A `Rule` has an `id`,
|
|
|
244
244
|
|
|
245
245
|
A break can have `edits`: each edit gives a file, its whole text `before` and its whole text `after`. Give an edit only when the fix is certain, and test it with `runFix`. Add the rule to `RULES` in `src/rules/index.ts`, with a test of a case that passes and a case that breaks. Add a rule only when 3 or more repositories tell it and a script examines it exactly.
|
|
246
246
|
|
|
247
|
+
Give each new rule the field `failsFrom`: the first day (`YYYY-MM-DD`, UTC) on which a break fails the check. Use a day at least `RULE_WARN_DAYS` (14) days after the release. A new version of this package reaches each repository through an update pull request. Thus a new rule that fails at once blocks that pull request in each repository that breaks it. Until the day, each break is a warning, and the owners fix the breaks. A test fails for a new rule with no `failsFrom`.
|
|
248
|
+
|
|
247
249
|
## Library
|
|
248
250
|
|
|
249
251
|
The package also exports the functions of the tool:
|
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ interface RuleContext {
|
|
|
76
76
|
type RuleOutcome = readonly Break[] | {
|
|
77
77
|
readonly skipped: string;
|
|
78
78
|
};
|
|
79
|
+
/** The days from the release of a new rule to its day `failsFrom`, at the least. In this time the owners fix the breaks. */
|
|
80
|
+
export declare const RULE_WARN_DAYS = 14;
|
|
79
81
|
/** One convention, as a machine check. */
|
|
80
82
|
interface Rule {
|
|
81
83
|
/** A short id in kebab case. The configuration names the rule with this id. */
|
|
@@ -95,6 +97,13 @@ interface Rule {
|
|
|
95
97
|
* Then an entry of `ignore` that matches no break is not stale, because a later change can match it.
|
|
96
98
|
*/
|
|
97
99
|
readonly changeScoped?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The first day (`YYYY-MM-DD`, UTC) on which a break of the rule fails the check. Before that day, a break is a
|
|
102
|
+
* warning: the check shows it, and it passes. A new version of this package reaches each repository through an
|
|
103
|
+
* update pull request. A new rule that fails at once blocks that pull request in each repository that breaks it.
|
|
104
|
+
* Thus each new rule gives this field, a day at least 14 days after its release (`RULE_WARN_DAYS`).
|
|
105
|
+
*/
|
|
106
|
+
readonly failsFrom?: string;
|
|
98
107
|
check(context: RuleContext, options: Options): RuleOutcome;
|
|
99
108
|
}
|
|
100
109
|
/** The fields of `package.json` that hold dependencies. */
|
|
@@ -623,8 +632,11 @@ interface RuleResult {
|
|
|
623
632
|
readonly id: string;
|
|
624
633
|
readonly title: string;
|
|
625
634
|
readonly fix: string;
|
|
626
|
-
/**
|
|
627
|
-
|
|
635
|
+
/**
|
|
636
|
+
* `pass`: no break. `break`: one or more breaks. `warn`: one or more breaks before the day `failsFrom` of the rule, so the
|
|
637
|
+
* check passes. `off`: the configuration turns the rule off. `skipped`: the rule did not start. `error`: the rule threw.
|
|
638
|
+
*/
|
|
639
|
+
readonly status: "pass" | "break" | "warn" | "off" | "skipped" | "error";
|
|
628
640
|
readonly breaks: readonly Break[];
|
|
629
641
|
/** The number of breaks in the files of `ignore`. */
|
|
630
642
|
readonly ignored: number;
|
|
@@ -648,6 +660,8 @@ interface CheckOptions {
|
|
|
648
660
|
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
649
661
|
/** The rules. The default is `RULES`. */
|
|
650
662
|
readonly rules?: readonly Rule[];
|
|
663
|
+
/** The day of the check (`YYYY-MM-DD`, UTC), for `failsFrom`. The default is the day of the clock. */
|
|
664
|
+
readonly today?: string;
|
|
651
665
|
}
|
|
652
666
|
/** This function reads the configuration of the root `package.json` at `root`. */
|
|
653
667
|
export declare function readConfig(root: string, rules?: readonly Rule[]): ConventionsConfig;
|
|
@@ -674,7 +688,10 @@ export declare function runFix(options: CheckOptions): FixResult;
|
|
|
674
688
|
export declare function formatResult(result: CheckResult): string;
|
|
675
689
|
/** This function gives the result as Markdown for the summary of a GitHub Actions run. */
|
|
676
690
|
export declare function summaryMarkdown(result: CheckResult): string;
|
|
677
|
-
/**
|
|
691
|
+
/**
|
|
692
|
+
* This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
|
|
693
|
+
* A break of a rule that only warns gives a `::warning` command.
|
|
694
|
+
*/
|
|
678
695
|
export declare function annotations(result: CheckResult): string;
|
|
679
696
|
/** This function gives the text of `--list`: each rule, its reason, its fix, its options, its state and its audit sources. */
|
|
680
697
|
export declare function listRules(config: ConventionsConfig | undefined, rules?: readonly Rule[]): string;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.ts"],"mappings":";;UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.ts"],"mappings":";;UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;qBAG3C;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;;;;;;;WAOA;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBA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as
|
|
1
|
+
import { $ as unreleasedChangeRule, $t as mergeHomes, A as typedFiles, An as RULE_WARN_DAYS, At as nameMatches, B as roadmapParses, Bn as replaceLine, Bt as licenseFileOf, C as versionTitle, Cn as summaryName, Ct as PRIVATE_NAME_LIST, D as typedScripts, Dn as STRICT_OPTIONS, Dt as isCommonUse, E as trustPolicy, En as readWorkflow, Et as isAllowedHit, F as HOME_TIMEOUT_MS, Fn as keyLine, Ft as hasImportMetaMain, G as publishedMinor, Gt as messageOf, H as releaseFiles, Hn as specifiersOf, Ht as repositoryIsPublic, I as blockHash, In as lineOf, It as mainCheck, J as NPM_REGISTRY, Jt as HOMES, K as publishedMinorRule, Kt as repoOf, L as githubFetch, Ln as matchesAny, Lt as LICENSE_TEXTS, M as isSourcePath, Mn as codePackages, Mt as pathNameHit, N as pathsOf, Nn as hasFile, Nt as noBuildOutput, O as configsOfScript, On as cuePreset, Ot as lineNameHit, P as sourceMain, Pn as inFolder, Pt as REAL_COMPARE, Q as unreleasedChange, Qt as mapText, R as sharedDocsRule, Rn as parseJsonc, Rt as authorOf, S as setVersions, Sn as prPathFilters, St as privateTextBreaks, T as TRAIN_SCOPES, Tn as readAction, Tt as firstNameMatch, U as lockedVersions, Un as defaultOptions, Ut as declaredName, V as requiredScripts, Vn as runGit, Vt as mitText, W as minorOf, Wn as parseConfig, Wt as homePackage, X as UNSHIPPED_FILES, Xt as findHomes, Y as SHIPPED_FIELDS, Yt as MAP_RULE, Z as npmLookup, Zt as mapMarkdown, _ as workspaceProtocol, _n as securityOneJob, _t as PRIVATE_PATTERNS_VARIABLE, a as listRules, an as hasTests, at as repositoryOfRemote, b as yamlFaults, bn as convertGate, bt as privateNamesFile, c as runCli, cn as SHARED_CI, ct as pushMainOnly, d as HOOK_MARKER, dn as sharedCi, dt as pagesSite, en as readOverlay, et as pipeFails, f as NO_READ_LINE, fn as setupCue, ft as apiReportScript, g as RULES, gn as securityCallers, gt as PRIVATE_NAMES_FILE_VARIABLE, h as prePush, hn as SECURITY_TIMEOUT_MINUTES, ht as PRIVATE_NAMES_FILE_CONFIG, i as formatResult, in as serviceRunMain, it as pagesAfterRelease, j as testsRequired, jn as cleanPath, jt as parsePrivateNames, k as scriptsOf, kn as DEPENDENCY_FIELDS, kt as lineNameHits, l as runFix, ln as SHARED_WORKFLOWS, lt as PAGES_WORKFLOWS, m as installHook, mn as SECURITY_SCAN_INPUTS, mt as HOME_PATTERNS, n as annotations, nn as SERVICE_PACKAGE, nt as isPinned, o as readConfig, on as tsconfigTest, ot as runnerBudget, p as PRE_PUSH_HOOK, pn as SECURITY_SCAN_COMMIT, pt as DEFAULT_ALLOWED, q as reachOf, qt as signaturesOf, r as createContext, rn as runCalls, rt as pinnedGitDeps, s as runChecks, sn as SHARED_ACTIONS, st as scheduleMinute, t as USAGE, tn as HOME_EXPORTS, tt as isGitSpecifier, u as summaryMarkdown, un as callsSharedCi, ut as pagesCalls, v as GITHUB_YAML, vn as withOneJob, vt as invalidPatternBreaks, w as IGNORE_AFTER, wn as gateAfterCancel, wt as PrivateNameListError, x as namedVersions, xn as gateTrigger, xt as privatePatterns, y as workflowParses, yn as ACTIONS_COMMIT, yt as noLocalPaths, z as roadmapOfLine, zn as readJsonc, zt as licenseFile } from "./run-kBEWFfNW.js";
|
|
2
2
|
import { i as packageFolders, n as globFolders, r as globToRegExp, s as workspaceGlobs } from "./workspace-Cx7p7bWn.js";
|
|
3
3
|
// src/release-text.ts
|
|
4
4
|
/**
|
|
@@ -65,6 +65,6 @@ function releaseNotes(name, version, changelog) {
|
|
|
65
65
|
if (section.length <= 1e5) return section;
|
|
66
66
|
return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
|
|
67
67
|
}
|
|
68
|
-
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, prePush, privateNamesFile, privatePatterns, privateTextBreaks, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
|
|
68
|
+
export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, RULE_WARN_DAYS, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, createContext, cuePreset, declaredName, defaultOptions, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasTests, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, messageOf, minorOf, mitText, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmLookup, npmUrl, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseConfig, parseJsonc, parsePrivateNames, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, prPathFilters, prePush, privateNamesFile, privatePatterns, privateTextBreaks, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, signaturesOf, sourceMain, specifiersOf, summaryMarkdown, summaryName, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
|
|
69
69
|
|
|
70
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -93,6 +93,8 @@ function replaceLine(text, line, lines) {
|
|
|
93
93
|
all.splice(line - 1, 1, ...lines);
|
|
94
94
|
return all.join(eol);
|
|
95
95
|
}
|
|
96
|
+
/** The days from the release of a new rule to its day `failsFrom`, at the least. In this time the owners fix the breaks. */
|
|
97
|
+
const RULE_WARN_DAYS = 14;
|
|
96
98
|
/** The fields of `package.json` that hold dependencies. */
|
|
97
99
|
const DEPENDENCY_FIELDS = [
|
|
98
100
|
"dependencies",
|
|
@@ -14041,6 +14043,7 @@ function runChecks(options) {
|
|
|
14041
14043
|
if (unknown.length > 0) throw new Error(`Unknown rule: ${unknown.join(", ")}. The rules are: ${rules.map((rule) => rule.id).join(", ")}.`);
|
|
14042
14044
|
const config = readConfig(root, rules);
|
|
14043
14045
|
const context = createContext(root, config, options);
|
|
14046
|
+
const today = options.today ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
14044
14047
|
const results = [];
|
|
14045
14048
|
for (const rule of rules) {
|
|
14046
14049
|
if (options.only !== void 0 && options.only.length > 0 && !options.only.includes(rule.id)) continue;
|
|
@@ -14105,10 +14108,12 @@ function runChecks(options) {
|
|
|
14105
14108
|
message: `The entry \`${glob}\` of \`${field}\` matches no break of this rule. Remove it from the field \`conventions\`.`
|
|
14106
14109
|
});
|
|
14107
14110
|
}
|
|
14108
|
-
const
|
|
14111
|
+
const warns = breaks.length > 0 && rule.failsFrom !== void 0 && today < rule.failsFrom;
|
|
14112
|
+
const reason = warns ? [ruleConfig.reason, `The rule fails from ${rule.failsFrom ?? ""}.`].filter((text) => text !== void 0).join(" ") : ruleConfig.reason;
|
|
14113
|
+
const note = reason === void 0 ? {} : { note: reason };
|
|
14109
14114
|
results.push({
|
|
14110
14115
|
...base,
|
|
14111
|
-
status: breaks.length
|
|
14116
|
+
status: breaks.length === 0 ? "pass" : warns ? "warn" : "break",
|
|
14112
14117
|
breaks,
|
|
14113
14118
|
ignored,
|
|
14114
14119
|
...note
|
|
@@ -14172,11 +14177,12 @@ const placeOf = (item) => item.line === void 0 ? item.file : `${item.file}:${ite
|
|
|
14172
14177
|
/** This function gives the text of a result for a terminal or a CI log. */
|
|
14173
14178
|
function formatResult(result) {
|
|
14174
14179
|
const count = (status) => result.rules.filter((rule) => rule.status === status).length;
|
|
14175
|
-
const breaks = result.rules.reduce((sum, rule) => sum + rule.breaks.length, 0);
|
|
14176
|
-
const out = [`conventions: ${result.rules.length} rules: ${count("pass")} pass, ${count("break")} with ${breaks} break(s), ${count("off")} off, ${count("skipped")} skipped, ${count("error")} error(s).`, ""];
|
|
14180
|
+
const breaks = result.rules.filter((rule) => rule.status === "break").reduce((sum, rule) => sum + rule.breaks.length, 0);
|
|
14181
|
+
const out = [`conventions: ${result.rules.length} rules: ${count("pass")} pass, ${count("break")} with ${breaks} break(s), ${count("warn")} warn, ${count("off")} off, ${count("skipped")} skipped, ${count("error")} error(s).`, ""];
|
|
14177
14182
|
const label = {
|
|
14178
14183
|
pass: "pass ",
|
|
14179
14184
|
break: "BREAK",
|
|
14185
|
+
warn: "warn ",
|
|
14180
14186
|
off: "off ",
|
|
14181
14187
|
skipped: "skip ",
|
|
14182
14188
|
error: "ERROR"
|
|
@@ -14205,7 +14211,7 @@ function summaryMarkdown(result) {
|
|
|
14205
14211
|
"|---|---|---|"
|
|
14206
14212
|
];
|
|
14207
14213
|
for (const rule of result.rules) {
|
|
14208
|
-
const shown = rule.status === "break" ? `${rule.breaks.length} break(s)` : rule.status;
|
|
14214
|
+
const shown = rule.status === "break" ? `${rule.breaks.length} break(s)` : rule.status === "warn" ? `warn: ${rule.breaks.length} break(s)` : rule.status;
|
|
14209
14215
|
const note = rule.ignored > 0 ? `${rule.ignored} ignored: ${rule.note ?? ""}` : rule.note ?? "";
|
|
14210
14216
|
out.push(`| \`${rule.id}\` | ${shown} | ${cell(note)} |`);
|
|
14211
14217
|
}
|
|
@@ -14221,12 +14227,15 @@ function summaryMarkdown(result) {
|
|
|
14221
14227
|
/** This function escapes a value of a workflow command of GitHub Actions. */
|
|
14222
14228
|
const escapeData = (text) => text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
|
|
14223
14229
|
const escapeProperty = (text) => escapeData(text).replace(/:/g, "%3A").replace(/,/g, "%2C");
|
|
14224
|
-
/**
|
|
14230
|
+
/**
|
|
14231
|
+
* This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
|
|
14232
|
+
* A break of a rule that only warns gives a `::warning` command.
|
|
14233
|
+
*/
|
|
14225
14234
|
function annotations(result) {
|
|
14226
14235
|
const out = [];
|
|
14227
14236
|
for (const rule of result.rules) for (const item of rule.breaks) {
|
|
14228
14237
|
const line = item.line === void 0 ? "" : `,line=${item.line}`;
|
|
14229
|
-
out.push(
|
|
14238
|
+
out.push(`::${rule.status === "warn" ? "warning" : "error"} file=${escapeProperty(item.file)}${line},title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`${item.message} Fix: ${item.fix ?? rule.fix}`)}`);
|
|
14230
14239
|
}
|
|
14231
14240
|
return out.length === 0 ? "" : `${out.join("\n")}\n`;
|
|
14232
14241
|
}
|
|
@@ -14459,6 +14468,6 @@ function runHook(args, io) {
|
|
|
14459
14468
|
git: (gitArgs) => runGit(io.cwd, gitArgs)
|
|
14460
14469
|
}, io);
|
|
14461
14470
|
}
|
|
14462
|
-
export { unreleasedChangeRule as $, mergeHomes as $t, typedFiles as A,
|
|
14471
|
+
export { unreleasedChangeRule as $, mergeHomes as $t, typedFiles as A, RULE_WARN_DAYS as An, nameMatches as At, roadmapParses as B, replaceLine as Bn, licenseFileOf as Bt, versionTitle as C, summaryName as Cn, PRIVATE_NAME_LIST as Ct, typedScripts as D, STRICT_OPTIONS as Dn, isCommonUse as Dt, trustPolicy as E, readWorkflow as En, isAllowedHit as Et, HOME_TIMEOUT_MS as F, keyLine as Fn, hasImportMetaMain as Ft, publishedMinor as G, messageOf as Gt, releaseFiles as H, specifiersOf as Hn, repositoryIsPublic as Ht, blockHash as I, lineOf as In, mainCheck as It, NPM_REGISTRY as J, HOMES as Jt, publishedMinorRule as K, repoOf as Kt, githubFetch as L, matchesAny as Ln, LICENSE_TEXTS as Lt, isSourcePath as M, codePackages as Mn, pathNameHit as Mt, pathsOf as N, hasFile as Nn, noBuildOutput as Nt, configsOfScript as O, cuePreset as On, lineNameHit as Ot, sourceMain as P, inFolder as Pn, REAL_COMPARE as Pt, unreleasedChange as Q, mapText as Qt, sharedDocsRule as R, parseJsonc as Rn, authorOf as Rt, setVersions as S, prPathFilters as Sn, privateTextBreaks as St, TRAIN_SCOPES as T, readAction as Tn, firstNameMatch as Tt, lockedVersions as U, defaultOptions as Un, declaredName as Ut, requiredScripts as V, runGit as Vn, mitText as Vt, minorOf as W, parseConfig as Wn, homePackage as Wt, UNSHIPPED_FILES as X, findHomes as Xt, SHIPPED_FIELDS as Y, MAP_RULE as Yt, npmLookup as Z, mapMarkdown as Zt, workspaceProtocol as _, securityOneJob as _n, PRIVATE_PATTERNS_VARIABLE as _t, listRules as a, hasTests as an, repositoryOfRemote as at, yamlFaults as b, convertGate as bn, privateNamesFile as bt, runCli as c, SHARED_CI as cn, pushMainOnly as ct, HOOK_MARKER as d, sharedCi as dn, pagesSite as dt, readOverlay as en, pipeFails as et, NO_READ_LINE as f, setupCue as fn, apiReportScript as ft, RULES as g, securityCallers as gn, PRIVATE_NAMES_FILE_VARIABLE as gt, prePush as h, SECURITY_TIMEOUT_MINUTES as hn, PRIVATE_NAMES_FILE_CONFIG as ht, formatResult as i, serviceRunMain as in, pagesAfterRelease as it, testsRequired as j, cleanPath as jn, parsePrivateNames as jt, scriptsOf as k, DEPENDENCY_FIELDS as kn, lineNameHits as kt, runFix as l, SHARED_WORKFLOWS as ln, PAGES_WORKFLOWS as lt, installHook as m, SECURITY_SCAN_INPUTS as mn, HOME_PATTERNS as mt, annotations as n, SERVICE_PACKAGE as nn, isPinned as nt, readConfig as o, tsconfigTest as on, runnerBudget as ot, PRE_PUSH_HOOK as p, SECURITY_SCAN_COMMIT as pn, DEFAULT_ALLOWED as pt, reachOf as q, signaturesOf as qt, createContext as r, runCalls as rn, pinnedGitDeps as rt, runChecks as s, SHARED_ACTIONS as sn, scheduleMinute as st, USAGE as t, HOME_EXPORTS as tn, isGitSpecifier as tt, summaryMarkdown as u, callsSharedCi as un, pagesCalls as ut, GITHUB_YAML as v, withOneJob as vn, invalidPatternBreaks as vt, IGNORE_AFTER as w, gateAfterCancel as wn, PrivateNameListError as wt, namedVersions as x, gateTrigger as xn, privatePatterns as xt, workflowParses as y, ACTIONS_COMMIT as yn, noLocalPaths as yt, roadmapOfLine as z, readJsonc as zn, licenseFile as zt };
|
|
14463
14472
|
|
|
14464
|
-
//# sourceMappingURL=run-
|
|
14473
|
+
//# sourceMappingURL=run-kBEWFfNW.js.map
|