Skip to content

Updated analysis_options from flutter/flutter#11692

Open
justinmc wants to merge 4 commits into
flutter:mainfrom
justinmc:analysis_options_update
Open

Updated analysis_options from flutter/flutter#11692
justinmc wants to merge 4 commits into
flutter:mainfrom
justinmc:analysis_options_update

Conversation

@justinmc
Copy link
Copy Markdown
Contributor

@justinmc justinmc commented May 11, 2026

It seems like we're supposed to keep analysis_options.dart in sync with the one in flutter/flutter, but we haven't done it since 2023. This PR updates it. The most disruptive change appears to be the increased page width.

I'm inspired to update this after working on #11669, which imports flutter/flutter code that is formatted according to the latest rules. Better to update the rules than to format the new code back to the old rules.

@justinmc justinmc requested a review from stuartmorgan-g May 11, 2026 20:31
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 11, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the analysis_options.yaml file to synchronize with the Flutter repository, adding a formatter configuration with a 100-character page width and enabling several new linter rules such as annotate_redeclares and strict_top_level_inference. Review feedback indicates that the # not yet tested comment on the enabled omit_obvious_local_variable_types rule is misleading and should be removed. Additionally, the reviewer noted that several documentation links were broken by the introduction of relative paths and should be restored to absolute URLs.

Comment thread analysis_options.yaml Outdated
# - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types
- omit_obvious_local_variable_types
# - omit_local_variable_types # superset of omit_obvious_local_variable_types
- omit_obvious_local_variable_types # not yet tested
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The lint omit_obvious_local_variable_types is enabled, but it is marked with a # not yet tested comment. In this file, this specific comment is consistently used for lints that are disabled (commented out) while awaiting verification. Since this lint was already active in the previous version of the configuration and remains enabled here, the comment is misleading and should be removed.

    - omit_obvious_local_variable_types

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix this.

Comment thread analysis_options.yaml Outdated
- prefer_contains
# - prefer_double_quotes # opposite of prefer_single_quotes
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods
# - prefer_expression_function_bodies # conflicts with ./docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The relative path ./docs/contributing/Style-guide-for-Flutter-repo.md is broken in the context of the flutter/packages repository, as the referenced documentation resides in the flutter/flutter repository. Please restore the absolute URL to ensure the link remains functional for contributors.

    # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods

Comment thread analysis_options.yaml Outdated
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use-double-literals-for-double-constants
# - prefer_int_literals # conflicts with ./docs/contributing/Style-guide-for-Flutter-repo.md#use-double-literals-for-double-constants
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The relative path ./docs/contributing/Style-guide-for-Flutter-repo.md is broken in this repository. This link should be restored to its absolute URL to point to the correct documentation in the flutter/flutter repository.

    # - prefer_int_literals # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use-double-literals-for-double-constants

@github-actions github-actions Bot removed the CICD Run CI/CD label May 11, 2026
@justinmc justinmc added the CICD Run CI/CD label May 11, 2026
Comment thread analysis_options.yaml Outdated
# - prefer_double_quotes # opposite of prefer_single_quotes
# - prefer_expression_function_bodies # conflicts with ./docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods
- prefer_final_fields
# - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#consider-using--for-short-functions-and-methods - prefer_final_fields
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was prefer_final_fields pulled into this line and thus removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, thanks for catching that!

Comment thread analysis_options.yaml Outdated
# - omit_local_variable_types # conflicts with specify_nonobvious_local_variable_types
- omit_obvious_local_variable_types
# - omit_local_variable_types # superset of omit_obvious_local_variable_types
- omit_obvious_local_variable_types # not yet tested
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix this.

Comment thread analysis_options.yaml Outdated
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
# - unawaited_futures # too many false positives, especially with the way AnimationController works
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on, it's just in the wrong place. It's two lines down.

@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

I'm not sure what's going on here, but most of the tests never ran. If you are changing the line length, you're going to have to reformat the entire repo in this PR otherwise CI will (when it actually runs) fail.

@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@justinmc
Copy link
Copy Markdown
Contributor Author

@stuartmorgan-g Is that just a dart format .? I've now done that in 4210b40.

The reason why I'm doing this is that the code imported in #11669 is formatted according to the latest flutter/flutter analysis_options.yaml

@justinmc justinmc requested a review from stuartmorgan-g May 12, 2026 19:52
@stuartmorgan-g stuartmorgan-g added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels May 12, 2026
@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

Changelog/version override: autoformat doesn't affect clients.

@justinmc justinmc added CICD Run CI/CD and removed CICD Run CI/CD labels May 12, 2026
@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

The analysis options look good.

What is going on with LUCI tests today ☹️ Did you run the repo tool's analyze command locally to make sure everything passes with the new options, since we don't have CI output for some reason?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants