dts-linter 0.2.1 → 0.3.0-beta10

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 CHANGED
@@ -24,7 +24,7 @@ npm install -g --ignore-scripts dts-linter
24
24
 
25
25
  ```bash
26
26
  # Lint and format specific files
27
- dts-linter --files file1.dts --files file2.dtsi --format
27
+ dts-linter --file file1.dts --file file2.dtsi --format
28
28
 
29
29
  # Auto-discover and process all DTS files in current directory
30
30
  dts-linter --format
@@ -35,51 +35,69 @@ dts-linter --formatFixAll
35
35
 
36
36
  ### Command Line Options
37
37
 
38
- | Option | Type | Default | Description |
39
- | ----------------------- | --------------- | --------------- | ---------------------------------------------------------------------------------------------------- |
40
- | `--files` | string | Auto-discover | List of input files (can be repeated) |
41
- | `--cwd` | string | `process.cwd()` | Set the current working directory |
42
- | `--includes` | string | `[]` | Paths to resolve includes (absolute or relative to CWD, can be repeated) |
43
- | `--bindings` | string | `[]` | Zephyr binding root directories (absolute or relative to CWD, can be repeated) |
44
- | `--logLevel` | `none\|verbose` | `none` | Set the logging verbosity |
45
- | `--format` | boolean | `false` | Format the specified files (automatically set to true when formatFixAll) |
46
- | `--formatFixAll` | boolean | `false` | Apply formatting changes directly to files |
47
- | `--processIncludes` | boolean | `false` | Process includes for formatting or diagnostics (automatically set to true when diagnosticsFull) |
48
- | `--diagnostics` | boolean | `false` | Show basic syntax diagnostics |
49
- | `--diagnosticsFull` | boolean | `false` | Show full diagnostics including semantic analysis (requires --includes, --bindings for proper usage) |
50
- | `--showInfoDiagnostics` | boolean | `false` | Show information-level diagnostics |
51
- | `--outFile` | string | - | Write formatting diff output to file |
52
- | `--help` | boolean | `false` | Show help information |
38
+ | Option | Type | Default | Description |
39
+ | ----------------------- | --------------- | --------------- | -------------------------------------------------------------------------------------------------- |
40
+ | `--file` | string | Auto-discover | List of input files (can be repeated) |
41
+ | `--cwd` | string | `process.cwd()` | Set the current working directory |
42
+ | `--include` | string | `[]` | Paths to resolve includes (absolute or relative to CWD, can be repeated) |
43
+ | `--binding` | string | `[]` | Zephyr binding root directories (absolute or relative to CWD, can be repeated) |
44
+ | `--logLevel` | `none\|verbose` | `none` | Set the logging verbosity |
45
+ | `--format` | boolean | `false` | Format the specified files (automatically set to true when formatFixAll) |
46
+ | `--formatFixAll` | boolean | `false` | Apply formatting changes directly to files |
47
+ | `--processIncludes` | boolean | `false` | Process includes for formatting or diagnostics (automatically set to true when diagnosticsFull) |
48
+ | `--diagnostics` | boolean | `false` | Show basic syntax diagnostics |
49
+ | `--diagnosticsFull` | boolean | `false` | Show full diagnostics including semantic analysis (requires --include, --binding for proper usage) |
50
+ | `--showInfoDiagnostics` | boolean | `false` | Show information-level diagnostics |
51
+ | `--patchFile` | string | - | Write formatting diff output to file |
52
+ | `--outputType` | string | `auto` | Output format type: auto, pretty, annotations, or json |
53
+ | `--threads` | number | `1` | Number of parallel LSP instances to use for processing files |
54
+ | `--help` | boolean | `false` | Show help information |
53
55
 
54
56
  ### Examples
55
57
 
56
58
  #### Check formatting without making changes
57
59
 
58
60
  ```bash
59
- dts-linter --format --files my-board.dts
61
+ dts-linter --format --file my-board.dts
60
62
  ```
61
63
 
62
64
  #### Auto-fix formatting issues
63
65
 
64
66
  ```bash
65
- dts-linter --formatFixAll --files my-board.dts --files my-overlay.dtsi
67
+ dts-linter --formatFixAll --file my-board.dts --file my-overlay.dtsi
66
68
  ```
67
69
 
68
70
  #### Full diagnostic check with include processing
69
71
 
70
72
  ```bash
71
- dts-linter --diagnosticsFull --includes ./include --bindings ./zephyr/dts/bindings
73
+ dts-linter --diagnosticsFull --include ./include --binding ./zephyr/dts/bindings
72
74
  ```
73
75
 
74
76
  #### Generate diff file for review
75
77
 
76
78
  ```bash
77
- dts-linter --format --outFile changes.patch
79
+ dts-linter --format --patchFile changes.patch
80
+ ```
81
+
82
+ #### Use multiple threads for faster processing
83
+
84
+ ```bash
85
+ dts-linter --format --diagnostics --threads 4
78
86
  ```
79
87
 
80
88
  ## File Discovery
81
89
 
82
- When no `--files` option is provided, the linter automatically searches for DeviceTree files using the pattern `**/*.{dts,dtsi,overlay}` or `**/*.{dts}` when using `--diagnosticsFull` in the current working directory.
90
+ When no `--file` option is provided, the linter automatically searches for DeviceTree files using the pattern `**/*.{dts,dtsi,overlay}` or `**/*.{dts}` when using `--diagnosticsFull` in the current working directory.
91
+
92
+ ## Performance and Threading
93
+
94
+ The linter supports parallel processing using multiple LSP instances to improve performance when processing many files:
95
+
96
+ - Use `--threads N` to specify the number of parallel LSP instances
97
+ - Each thread runs its own LSP server instance
98
+ - Files are automatically distributed among available threads
99
+ - Recommended to use 2-4 threads for optimal performance depending on your system
100
+ - Threading is particularly beneficial when processing large numbers of files or when using `--diagnosticsFull`
83
101
 
84
102
  ## Output Formats
85
103
 
@@ -98,9 +116,29 @@ When running in CI environments (GitHub Actions, GitLab CI, etc.), the tool auto
98
116
  - `::error` for syntax errors
99
117
  - File locations and line numbers included
100
118
 
119
+ ### JSON
120
+
121
+ Returns a JSON object of type
122
+
123
+ ```typescript
124
+ {
125
+ cwd: string;
126
+ issues: {
127
+ level: string;
128
+ message: string;
129
+ title?: string;
130
+ file?: string;
131
+ startLine?: number;
132
+ startCol?: number;
133
+ endLine?: number;
134
+ endCol?: number;
135
+ }[];
136
+ }
137
+ ```
138
+
101
139
  ### Diff Output
102
140
 
103
- When using `--outFile`, generates unified diff format showing all formatting changes:
141
+ When using `--patchFile`, generates unified diff format showing all formatting changes:
104
142
 
105
143
  ```diff
106
144
  --- a/my-board.dts
@@ -0,0 +1,235 @@
1
+ THIRD-PARTY LICENSES
2
+
3
+ @isaacs/balanced-match@4.0.1
4
+ License: MIT
5
+ Repository: https://github.com/isaacs/balanced-match
6
+
7
+ ----------------------------------------------------------------------
8
+
9
+ @isaacs/brace-expansion@5.0.0
10
+ License: MIT
11
+
12
+ ----------------------------------------------------------------------
13
+
14
+ @isaacs/cliui@8.0.2
15
+ License: ISC
16
+ Repository: https://github.com/yargs/cliui
17
+
18
+ ----------------------------------------------------------------------
19
+
20
+ ansi-regex@5.0.1
21
+ License: MIT
22
+ Repository: https://github.com/chalk/ansi-regex
23
+
24
+ ----------------------------------------------------------------------
25
+
26
+ ansi-regex@6.1.0
27
+ License: MIT
28
+ Repository: https://github.com/chalk/ansi-regex
29
+
30
+ ----------------------------------------------------------------------
31
+
32
+ ansi-styles@4.3.0
33
+ License: MIT
34
+ Repository: https://github.com/chalk/ansi-styles
35
+
36
+ ----------------------------------------------------------------------
37
+
38
+ ansi-styles@6.2.1
39
+ License: MIT
40
+ Repository: https://github.com/chalk/ansi-styles
41
+
42
+ ----------------------------------------------------------------------
43
+
44
+ color-convert@2.0.1
45
+ License: MIT
46
+ Repository: https://github.com/Qix-/color-convert
47
+
48
+ ----------------------------------------------------------------------
49
+
50
+ color-name@1.1.4
51
+ License: MIT
52
+ Repository: https://github.com/colorjs/color-name
53
+
54
+ ----------------------------------------------------------------------
55
+
56
+ cross-spawn@7.0.6
57
+ License: MIT
58
+ Repository: https://github.com/moxystudio/node-cross-spawn
59
+
60
+ ----------------------------------------------------------------------
61
+
62
+ devicetree-language-server@0.6.0-beta2
63
+ License: Apache-2.0
64
+ Repository: https://github.com/kylebonnici/dts-lsp
65
+
66
+ ----------------------------------------------------------------------
67
+
68
+ diff@8.0.2
69
+ License: BSD-3-Clause
70
+ Repository: https://github.com/kpdecker/jsdiff
71
+
72
+ ----------------------------------------------------------------------
73
+
74
+ dts-linter@0.3.0-beta10
75
+ License: Apache-2.0
76
+ Repository: https://github.com/kylebonnici/dts-linter
77
+
78
+ ----------------------------------------------------------------------
79
+
80
+ eastasianwidth@0.2.0
81
+ License: MIT
82
+ Repository: https://github.com/komagata/eastasianwidth
83
+
84
+ ----------------------------------------------------------------------
85
+
86
+ emoji-regex@8.0.0
87
+ License: MIT
88
+ Repository: https://github.com/mathiasbynens/emoji-regex
89
+
90
+ ----------------------------------------------------------------------
91
+
92
+ emoji-regex@9.2.2
93
+ License: MIT
94
+ Repository: https://github.com/mathiasbynens/emoji-regex
95
+
96
+ ----------------------------------------------------------------------
97
+
98
+ foreground-child@3.3.1
99
+ License: ISC
100
+ Repository: https://github.com/tapjs/foreground-child
101
+
102
+ ----------------------------------------------------------------------
103
+
104
+ glob@11.0.3
105
+ License: ISC
106
+ Repository: https://github.com/isaacs/node-glob
107
+
108
+ ----------------------------------------------------------------------
109
+
110
+ is-fullwidth-code-point@3.0.0
111
+ License: MIT
112
+ Repository: https://github.com/sindresorhus/is-fullwidth-code-point
113
+
114
+ ----------------------------------------------------------------------
115
+
116
+ isexe@2.0.0
117
+ License: ISC
118
+ Repository: https://github.com/isaacs/isexe
119
+
120
+ ----------------------------------------------------------------------
121
+
122
+ jackspeak@4.1.1
123
+ License: BlueOak-1.0.0
124
+ Repository: https://github.com/isaacs/jackspeak
125
+
126
+ ----------------------------------------------------------------------
127
+
128
+ lru-cache@11.1.0
129
+ License: ISC
130
+ Repository: https://github.com/isaacs/node-lru-cache
131
+
132
+ ----------------------------------------------------------------------
133
+
134
+ minimatch@10.0.3
135
+ License: ISC
136
+ Repository: https://github.com/isaacs/minimatch
137
+
138
+ ----------------------------------------------------------------------
139
+
140
+ minipass@7.1.2
141
+ License: ISC
142
+ Repository: https://github.com/isaacs/minipass
143
+
144
+ ----------------------------------------------------------------------
145
+
146
+ package-json-from-dist@1.0.1
147
+ License: BlueOak-1.0.0
148
+ Repository: https://github.com/isaacs/package-json-from-dist
149
+
150
+ ----------------------------------------------------------------------
151
+
152
+ path-key@3.1.1
153
+ License: MIT
154
+ Repository: https://github.com/sindresorhus/path-key
155
+
156
+ ----------------------------------------------------------------------
157
+
158
+ path-scurry@2.0.0
159
+ License: BlueOak-1.0.0
160
+ Repository: https://github.com/isaacs/path-scurry
161
+
162
+ ----------------------------------------------------------------------
163
+
164
+ shebang-command@2.0.0
165
+ License: MIT
166
+ Repository: https://github.com/kevva/shebang-command
167
+
168
+ ----------------------------------------------------------------------
169
+
170
+ shebang-regex@3.0.0
171
+ License: MIT
172
+ Repository: https://github.com/sindresorhus/shebang-regex
173
+
174
+ ----------------------------------------------------------------------
175
+
176
+ signal-exit@4.1.0
177
+ License: ISC
178
+ Repository: https://github.com/tapjs/signal-exit
179
+
180
+ ----------------------------------------------------------------------
181
+
182
+ string-width@4.2.3
183
+ License: MIT
184
+ Repository: https://github.com/sindresorhus/string-width
185
+
186
+ ----------------------------------------------------------------------
187
+
188
+ string-width@5.1.2
189
+ License: MIT
190
+ Repository: https://github.com/sindresorhus/string-width
191
+
192
+ ----------------------------------------------------------------------
193
+
194
+ strip-ansi@6.0.1
195
+ License: MIT
196
+ Repository: https://github.com/chalk/strip-ansi
197
+
198
+ ----------------------------------------------------------------------
199
+
200
+ strip-ansi@7.1.0
201
+ License: MIT
202
+ Repository: https://github.com/chalk/strip-ansi
203
+
204
+ ----------------------------------------------------------------------
205
+
206
+ vscode-jsonrpc@8.2.1
207
+ License: MIT
208
+ Repository: https://github.com/Microsoft/vscode-languageserver-node
209
+
210
+ ----------------------------------------------------------------------
211
+
212
+ which@2.0.2
213
+ License: ISC
214
+ Repository: https://github.com/isaacs/node-which
215
+
216
+ ----------------------------------------------------------------------
217
+
218
+ wrap-ansi@7.0.0
219
+ License: MIT
220
+ Repository: https://github.com/chalk/wrap-ansi
221
+
222
+ ----------------------------------------------------------------------
223
+
224
+ wrap-ansi@8.1.0
225
+ License: MIT
226
+ Repository: https://github.com/chalk/wrap-ansi
227
+
228
+ ----------------------------------------------------------------------
229
+
230
+ zod@3.25.67
231
+ License: MIT
232
+ Repository: https://github.com/colinhacks/zod
233
+
234
+ ----------------------------------------------------------------------
235
+