@codacy/verity-cli 0.34.5-experimental.7268b07 → 0.34.5-experimental.eb39cc6
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/bin/verity.js +62 -7
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -16946,7 +16946,9 @@ var TOP_KEYS = /* @__PURE__ */ new Set([
|
|
|
16946
16946
|
"tool_configuration",
|
|
16947
16947
|
"created_by",
|
|
16948
16948
|
"version",
|
|
16949
|
-
"verityignore"
|
|
16949
|
+
"verityignore",
|
|
16950
|
+
"extends",
|
|
16951
|
+
"overrides"
|
|
16950
16952
|
]);
|
|
16951
16953
|
var KNOWLEDGE_SPEC_KEYS = /* @__PURE__ */ new Set([
|
|
16952
16954
|
"project_name",
|
|
@@ -16973,6 +16975,12 @@ var PATTERN_KEYS = /* @__PURE__ */ new Set([
|
|
|
16973
16975
|
]);
|
|
16974
16976
|
var DIMENSION_KEYS = /* @__PURE__ */ new Set(["id", "description", "signals"]);
|
|
16975
16977
|
var SEVERITIES = /* @__PURE__ */ new Set(["critical", "high", "medium", "med", "low"]);
|
|
16978
|
+
var PACK_REF = /^[a-z0-9][a-z0-9-]{0,39}\/[a-z0-9][a-z0-9-]{0,39}(@[A-Za-z0-9._-]{1,40})?$/;
|
|
16979
|
+
var MAX_EXTENDS = 32;
|
|
16980
|
+
var MAX_OVERRIDES = 500;
|
|
16981
|
+
var MAX_OVERRIDE_LIST = 50;
|
|
16982
|
+
var OVERRIDE_ID = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,119}$/;
|
|
16983
|
+
var OVERRIDE_TOKEN = /^[A-Za-z0-9_.\/*?{}[\],@!:+=-]{1,300}$/;
|
|
16976
16984
|
var isPlainObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
16977
16985
|
var PRINTABLE = /^[^\u0000-\u001f\u007f]+$/;
|
|
16978
16986
|
var CONTROL_EXCEPT_WHITESPACE = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
|
|
@@ -17001,6 +17009,51 @@ function checkValues(v, path, depth) {
|
|
|
17001
17009
|
}
|
|
17002
17010
|
return { ok: true };
|
|
17003
17011
|
}
|
|
17012
|
+
function checkPackSettings(content) {
|
|
17013
|
+
if ("extends" in content) {
|
|
17014
|
+
const list2 = content.extends;
|
|
17015
|
+
if (!Array.isArray(list2)) return fail("extends must be an array");
|
|
17016
|
+
if (list2.length > MAX_EXTENDS) return fail(`extends has more than ${MAX_EXTENDS} entries`);
|
|
17017
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17018
|
+
for (const [i2, ref] of list2.entries()) {
|
|
17019
|
+
if (typeof ref !== "string" || !PACK_REF.test(ref)) {
|
|
17020
|
+
return fail(`extends[${i2}] must be a pack reference such as verity/core or verity/core@2026.11`);
|
|
17021
|
+
}
|
|
17022
|
+
if (seen.has(ref)) return fail(`extends[${i2}] repeats ${ref}`);
|
|
17023
|
+
seen.add(ref);
|
|
17024
|
+
}
|
|
17025
|
+
}
|
|
17026
|
+
if ("overrides" in content) {
|
|
17027
|
+
const overrides = content.overrides;
|
|
17028
|
+
if (!isPlainObject(overrides)) return fail("overrides must be an object");
|
|
17029
|
+
const entries = Object.entries(overrides);
|
|
17030
|
+
if (entries.length > MAX_OVERRIDES) return fail(`overrides has more than ${MAX_OVERRIDES} entries`);
|
|
17031
|
+
for (const [id, value] of entries) {
|
|
17032
|
+
if (!OVERRIDE_ID.test(id)) return fail("overrides has a key that is not a pattern id (letters, digits, - _ . :)");
|
|
17033
|
+
const at = `overrides.${id}`;
|
|
17034
|
+
if (value === "off") continue;
|
|
17035
|
+
if (!isPlainObject(value)) return fail(`${at} must be off or an object of settings`);
|
|
17036
|
+
for (const [name2, v] of Object.entries(value)) {
|
|
17037
|
+
if (!OVERRIDE_ID.test(name2)) return fail(`${at} has a setting name that is not a slug (letters, digits, - _ . :)`);
|
|
17038
|
+
const where2 = `${at}.${name2}`;
|
|
17039
|
+
if (Array.isArray(v)) {
|
|
17040
|
+
if (v.length > MAX_OVERRIDE_LIST) return fail(`${where2} has more than ${MAX_OVERRIDE_LIST} entries`);
|
|
17041
|
+
if (!v.every((x) => typeof x === "string" && OVERRIDE_TOKEN.test(x))) {
|
|
17042
|
+
return fail(`${where2} must hold settings, not prose: ids, severities or globs without spaces`);
|
|
17043
|
+
}
|
|
17044
|
+
} else if (typeof v === "string") {
|
|
17045
|
+
if (!OVERRIDE_TOKEN.test(v)) return fail(`${where2} must be a setting, not prose: an id, a severity or a glob without spaces`);
|
|
17046
|
+
} else if (typeof v !== "boolean" && !(typeof v === "number" && Number.isFinite(v))) {
|
|
17047
|
+
return fail(`${where2} must be text, a number, true or false, or a list of text`);
|
|
17048
|
+
}
|
|
17049
|
+
}
|
|
17050
|
+
if ("severity" in value && !SEVERITIES.has(String(value.severity))) {
|
|
17051
|
+
return fail(`${at}.severity must be one of critical, high, medium, low`);
|
|
17052
|
+
}
|
|
17053
|
+
}
|
|
17054
|
+
}
|
|
17055
|
+
return { ok: true };
|
|
17056
|
+
}
|
|
17004
17057
|
function unknownKey(obj, allowed, where2) {
|
|
17005
17058
|
const extra = Object.keys(obj).find((k) => !allowed.has(k));
|
|
17006
17059
|
return extra === void 0 ? null : fail(`${where2}.${extra} is not a known field`);
|
|
@@ -17027,10 +17080,10 @@ function checkEntries(list2, section, allowed, withSeverity) {
|
|
|
17027
17080
|
function validateStandardContent(content, opts = {}) {
|
|
17028
17081
|
const requireAll = opts.requireAll ?? true;
|
|
17029
17082
|
if (!isPlainObject(content)) return fail("content is required and must be an object");
|
|
17030
|
-
const size = new TextEncoder().encode(JSON.stringify(content)).length;
|
|
17031
|
-
if (size > MAX_STANDARD_BYTES) return fail(`content is ${size} bytes; the limit is ${MAX_STANDARD_BYTES}`);
|
|
17032
17083
|
const values = checkValues(content, "", 0);
|
|
17033
17084
|
if (!values.ok) return values;
|
|
17085
|
+
const size = new TextEncoder().encode(JSON.stringify(content)).length;
|
|
17086
|
+
if (size > MAX_STANDARD_BYTES) return fail(`content is ${size} bytes; the limit is ${MAX_STANDARD_BYTES}`);
|
|
17034
17087
|
const missing = ["knowledge_spec", "quality_dimensions", "security_patterns", "process_constraints"].filter((k) => !(k in content));
|
|
17035
17088
|
if (requireAll && missing.length > 0) return fail(`content is missing required keys: ${missing.join(", ")}`);
|
|
17036
17089
|
const extraTop = unknownKey(content, TOP_KEYS, "content");
|
|
@@ -17059,6 +17112,8 @@ function validateStandardContent(content, opts = {}) {
|
|
|
17059
17112
|
const custom = checkEntries(content.custom_patterns, "custom_patterns", PATTERN_KEYS, true);
|
|
17060
17113
|
if (!custom.ok) return custom;
|
|
17061
17114
|
}
|
|
17115
|
+
const pack = checkPackSettings(content);
|
|
17116
|
+
if (!pack.ok) return pack;
|
|
17062
17117
|
for (const key of ["created_by", "version"]) {
|
|
17063
17118
|
if (key in content && content[key] !== null && typeof content[key] !== "string") return fail(`${key} must be a string`);
|
|
17064
17119
|
}
|
|
@@ -28395,7 +28450,7 @@ function channelSilence(input) {
|
|
|
28395
28450
|
// src/lib/cli-version.ts
|
|
28396
28451
|
function cliVersion() {
|
|
28397
28452
|
try {
|
|
28398
|
-
return true ? "0.34.5-experimental.
|
|
28453
|
+
return true ? "0.34.5-experimental.eb39cc6" : "dev";
|
|
28399
28454
|
} catch {
|
|
28400
28455
|
return "dev";
|
|
28401
28456
|
}
|
|
@@ -42663,7 +42718,7 @@ async function recordAnswers(ui, momentIds, telemetry) {
|
|
|
42663
42718
|
await writeSetupState({
|
|
42664
42719
|
moments: momentIds,
|
|
42665
42720
|
...telemetry ? { telemetry } : {},
|
|
42666
|
-
init: { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.34.5-experimental.
|
|
42721
|
+
init: { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.34.5-experimental.eb39cc6" : "dev" }
|
|
42667
42722
|
});
|
|
42668
42723
|
} catch (err2) {
|
|
42669
42724
|
ui.rail.line(`Could not record the setup answers: ${terminalText(err2.message, 200)}`, "warn");
|
|
@@ -44640,10 +44695,10 @@ function registerLeanCommand(program2) {
|
|
|
44640
44695
|
}
|
|
44641
44696
|
|
|
44642
44697
|
// src/cli.ts
|
|
44643
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.34.5-experimental.
|
|
44698
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.34.5-experimental.eb39cc6").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
44644
44699
|
const isTelemetryHelper = actionCommand.name() === "headers" && actionCommand.parent?.name() === "telemetry";
|
|
44645
44700
|
if (!isTelemetryHelper) {
|
|
44646
|
-
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.5-experimental.
|
|
44701
|
+
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.5-experimental.eb39cc6");
|
|
44647
44702
|
}
|
|
44648
44703
|
setUserNamedServiceUrl(program.opts().serviceUrl);
|
|
44649
44704
|
try {
|
package/package.json
CHANGED