Skip to content

Commit bbdbf6c

Browse files
Merge branch 'main' into lang-evo-link
2 parents e80ba39 + e32e97b commit bbdbf6c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/content/tools/analysis.md

+52
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ Other options are to explicitly enable individual linter rules
310310
or [disable individual rules][].
311311
:::
312312

313+
:::note
314+
For more information about including options files,
315+
check out the [Including shared options](#including-shared-options) section.
316+
:::
317+
313318
[lints package]: {{site.pub-pkg}}/lints
314319

315320
### Enabling individual rules {:#individual-rules}
@@ -368,6 +373,53 @@ Due to YAML restrictions,
368373
You can use the other syntax for rules in an included file.
369374
:::
370375

376+
## Including shared options
377+
378+
An analysis options file can include options which are specified in
379+
another options file, or even a list of other options files.
380+
You can specify such files using the top-level `include:` field:
381+
382+
```yaml title="analysis_options.yaml"
383+
include: package:flutter_lints/recommended.yaml
384+
```
385+
386+
An included options file can be specified with a `package:` path, or a relative
387+
path. Multiple analysis options files can be specified in a list:
388+
389+
```yaml title="analysis_options.yaml"
390+
include:
391+
- package:flutter_lints/recommended.yaml
392+
- ../team_options.yaml
393+
```
394+
395+
Options in an included file can be overridden in the including file,
396+
as well as by subsequent included files.
397+
In other words, the options specified by an analysis options file are
398+
computed by first applying the options specified in each of the included files
399+
(by recursively applying this algorithm), in the order they appear in the list,
400+
and then overriding them with any locally defined options.
401+
402+
For example, given the following options files:
403+
404+
```yaml title="three.yaml"
405+
include: two.yaml
406+
# ...
407+
```
408+
409+
And a final options file that includes these:
410+
411+
```yaml title="analysis_options.yaml"
412+
include:
413+
- one.yaml
414+
- three.yaml
415+
# ...
416+
```
417+
418+
Then the combined analysis options are computed by applying the options found
419+
in `one.yaml`, then `two.yaml`, then `three.yaml`, and finally
420+
`analysis_options.yaml`.
421+
422+
371423
## Enabling analyzer plugins (experimental) {:#plugins}
372424

373425
The analyzer has experimental support for plugins.

0 commit comments

Comments
 (0)