Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text regarding including shared analysis options #6402

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/content/tools/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ Other options are to explicitly enable individual linter rules
or [disable individual rules][].
:::

:::note
For more information about including options files,
check out the [Including shared options](#including-shared-options) section.
:::

[lints package]: {{site.pub-pkg}}/lints

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

## Including shared options

An analysis options file can include options which are specified in
another options file, or even a list of other options files.
You can specify such files using the top-level `include:` field:

```yaml title="analysis_options.yaml"
include: package:flutter_lints/recommended.yaml
```

An included options file can be specified with a `package:` path, or a relative
path. Multiple analysis options files can be specified in a list:

```yaml title="analysis_options.yaml"
include:
- package:flutter_lints/recommended.yaml
- ../team_options.yaml
```

Options in an included file can be overridden in the including file,
as well as by subsequent included files.
In other words, the options specified by an analysis options file are
computed by first applying the options specified in each of the included files
(by recursively applying this algorithm), in the order they appear in the list,
and then overriding them with any locally defined options.

For example, given the following options files:

```yaml title="three.yaml"
include: two.yaml
# ...
```

And a final options file that includes these:

```yaml title="analysis_options.yaml"
include:
- one.yaml
- three.yaml
# ...
```

Then the combined analysis options are computed by applying the options found
in `one.yaml`, then `two.yaml`, then `three.yaml`, and finally
`analysis_options.yaml`.


## Enabling analyzer plugins (experimental) {:#plugins}

The analyzer has experimental support for plugins.
Expand Down