@docker-doctor/cli 0.4.3 → 0.5.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/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>>;
@@ -38,7 +45,9 @@ interface DockerDoctorConfig {
38
45
  }
39
46
  //#endregion
40
47
  //#region ../core/src/project-info/discover.d.ts
41
- declare const discoverProject: (rootDir: string) => Promise<ProjectInfo>;
48
+ declare const discoverProject: (rootDir: string, options?: {
49
+ ignoreFiles?: readonly string[];
50
+ }) => Promise<ProjectInfo>;
42
51
  //#endregion
43
52
  //#region ../core/src/parsers/dockerfile-parser.d.ts
44
53
  declare const parseDockerfile: (content: string) => DockerfileInstruction[];
@@ -50,7 +59,7 @@ declare const parseCompose: (content: string, filepath: string) => unknown;
50
59
  declare const runDockerfileRules: (instructions: DockerfileInstruction[], file: string, projectFiles: string[], rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
51
60
  //#endregion
52
61
  //#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[];
62
+ declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>, locate?: ComposeLocator) => Diagnostic[];
54
63
  //#endregion
55
64
  //#region ../core/src/rules/index.d.ts
56
65
  declare const allRules: RuleDefinition[];
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>>;
@@ -38,7 +45,9 @@ interface DockerDoctorConfig {
38
45
  }
39
46
  //#endregion
40
47
  //#region ../core/src/project-info/discover.d.ts
41
- declare const discoverProject: (rootDir: string) => Promise<ProjectInfo>;
48
+ declare const discoverProject: (rootDir: string, options?: {
49
+ ignoreFiles?: readonly string[];
50
+ }) => Promise<ProjectInfo>;
42
51
  //#endregion
43
52
  //#region ../core/src/parsers/dockerfile-parser.d.ts
44
53
  declare const parseDockerfile: (content: string) => DockerfileInstruction[];
@@ -50,7 +59,7 @@ declare const parseCompose: (content: string, filepath: string) => unknown;
50
59
  declare const runDockerfileRules: (instructions: DockerfileInstruction[], file: string, projectFiles: string[], rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>) => Diagnostic[];
51
60
  //#endregion
52
61
  //#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[];
62
+ declare const runComposeRules: (composeContent: unknown, file: string, rulesConfig?: Record<string, RuleSeverity>, categoriesConfig?: Record<string, RuleSeverity>, locate?: ComposeLocator) => Diagnostic[];
54
63
  //#endregion
55
64
  //#region ../core/src/rules/index.d.ts
56
65
  declare const allRules: RuleDefinition[];
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-TK9DRoRo.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-CpGd43y0.mjs";
3
3
 
4
4
  //#region ../core/src/config/define-config.ts
5
5
  const defineConfig = (config) => config;