@docker-doctor/cli 0.4.2 → 0.4.4

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/dist/index.d.cts CHANGED
@@ -6,10 +6,11 @@ interface DockerfileInstruction {
6
6
  line: number;
7
7
  raw: string;
8
8
  }
9
+ type DiagnosticSeverity = "error" | "warning" | "info";
9
10
  interface Diagnostic {
10
11
  file: string;
11
12
  rule: string;
12
- severity: "error" | "warning" | "info";
13
+ severity: DiagnosticSeverity;
13
14
  message: string;
14
15
  help: string;
15
16
  line?: number;
@@ -21,14 +22,20 @@ interface ProjectInfo {
21
22
  dockerignores?: string[];
22
23
  }
23
24
  type RuleCategory = "Security" | "Performance" | "Best Practices" | "Compose" | "Image Size";
24
- type RuleSeverity = "error" | "warning" | "info" | "off";
25
+ type RuleSeverity = DiagnosticSeverity | "off";
25
26
  interface RuleDefinition {
26
27
  key: string;
27
28
  category: RuleCategory;
28
- defaultSeverity: RuleSeverity;
29
+ defaultSeverity: DiagnosticSeverity;
29
30
  message: string;
30
31
  help: string;
31
32
  }
33
+ /**
34
+ * Maps a path of YAML keys/indices (e.g. `["services", "web"]`) to the
35
+ * 1-based line where that key is defined, or `undefined` when the path does
36
+ * not resolve to a concrete node in the source document.
37
+ */
38
+ type ComposeLocator = (path: readonly (string | number)[]) => number | undefined;
32
39
  interface DockerDoctorConfig {
33
40
  rules?: Record<string, RuleSeverity>;
34
41
  categories?: Partial<Record<RuleCategory, RuleSeverity>>;
@@ -50,7 +57,7 @@ declare const parseCompose: (content: string, filepath: string) => unknown;
50
57
  declare const runDockerfileRules: (instructions: DockerfileInstruction[], file: string, projectFiles: string[], rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
51
58
  //#endregion
52
59
  //#region ../core/src/runners/compose-runner.d.ts
53
- declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
60
+ declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>, locate?: ComposeLocator) => Diagnostic[];
54
61
  //#endregion
55
62
  //#region ../core/src/rules/index.d.ts
56
63
  declare const allRules: RuleDefinition[];
@@ -60,7 +67,7 @@ declare const findRule: (key: string) => RuleDefinition | undefined;
60
67
  declare const defineConfig: (config: DockerDoctorConfig) => DockerDoctorConfig;
61
68
  //#endregion
62
69
  //#region ../core/src/config/loader.d.ts
63
- declare const loadConfig: (rootDir: string, customPath?: string) => Promise<DockerDoctorConfig>;
70
+ declare const loadConfig: (rootDir: string, customPath?: string, onWarning?: (message: string) => void) => Promise<DockerDoctorConfig>;
64
71
  //#endregion
65
72
  //#region ../core/src/scoring.d.ts
66
73
  declare const calculateScore: (diagnostics: Diagnostic[]) => {
package/dist/index.d.mts CHANGED
@@ -6,10 +6,11 @@ interface DockerfileInstruction {
6
6
  line: number;
7
7
  raw: string;
8
8
  }
9
+ type DiagnosticSeverity = "error" | "warning" | "info";
9
10
  interface Diagnostic {
10
11
  file: string;
11
12
  rule: string;
12
- severity: "error" | "warning" | "info";
13
+ severity: DiagnosticSeverity;
13
14
  message: string;
14
15
  help: string;
15
16
  line?: number;
@@ -21,14 +22,20 @@ interface ProjectInfo {
21
22
  dockerignores?: string[];
22
23
  }
23
24
  type RuleCategory = "Security" | "Performance" | "Best Practices" | "Compose" | "Image Size";
24
- type RuleSeverity = "error" | "warning" | "info" | "off";
25
+ type RuleSeverity = DiagnosticSeverity | "off";
25
26
  interface RuleDefinition {
26
27
  key: string;
27
28
  category: RuleCategory;
28
- defaultSeverity: RuleSeverity;
29
+ defaultSeverity: DiagnosticSeverity;
29
30
  message: string;
30
31
  help: string;
31
32
  }
33
+ /**
34
+ * Maps a path of YAML keys/indices (e.g. `["services", "web"]`) to the
35
+ * 1-based line where that key is defined, or `undefined` when the path does
36
+ * not resolve to a concrete node in the source document.
37
+ */
38
+ type ComposeLocator = (path: readonly (string | number)[]) => number | undefined;
32
39
  interface DockerDoctorConfig {
33
40
  rules?: Record<string, RuleSeverity>;
34
41
  categories?: Partial<Record<RuleCategory, RuleSeverity>>;
@@ -50,7 +57,7 @@ declare const parseCompose: (content: string, filepath: string) => unknown;
50
57
  declare const runDockerfileRules: (instructions: DockerfileInstruction[], file: string, projectFiles: string[], rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
51
58
  //#endregion
52
59
  //#region ../core/src/runners/compose-runner.d.ts
53
- declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
60
+ declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>, locate?: ComposeLocator) => Diagnostic[];
54
61
  //#endregion
55
62
  //#region ../core/src/rules/index.d.ts
56
63
  declare const allRules: RuleDefinition[];
@@ -60,7 +67,7 @@ declare const findRule: (key: string) => RuleDefinition | undefined;
60
67
  declare const defineConfig: (config: DockerDoctorConfig) => DockerDoctorConfig;
61
68
  //#endregion
62
69
  //#region ../core/src/config/loader.d.ts
63
- declare const loadConfig: (rootDir: string, customPath?: string) => Promise<DockerDoctorConfig>;
70
+ declare const loadConfig: (rootDir: string, customPath?: string, onWarning?: (message: string) => void) => Promise<DockerDoctorConfig>;
64
71
  //#endregion
65
72
  //#region ../core/src/scoring.d.ts
66
73
  declare const calculateScore: (diagnostics: Diagnostic[]) => {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runDockerfileRules, c as parseCompose, d as version$1, i as runComposeRules, l as parseDockerfile, n as calculateScore, o as allRules, r as loadConfig, s as findRule, t as toJsonReport, u as discoverProject } from "./src-BuUGk4ND.mjs";
2
+ import { a as runDockerfileRules, d as discoverProject, f as version$1, i as runComposeRules, l as parseCompose, n as calculateScore, o as allRules, r as loadConfig, s as findRule, t as toJsonReport, u as parseDockerfile } from "./src-CvOv-hL3.mjs";
3
3
 
4
4
  //#region ../core/src/config/define-config.ts
5
5
  const defineConfig = (config) => config;