blob: 0f0e7a81f40d737418b93d96d5e6a69174cd91bc [file] [log] [blame]
krisgiesing07b5f832016-05-04 10:15:15 -07001# Specify analysis options.
Dan Rubel57843852016-09-09 13:37:56 -04002#
3# Until there are meta linter rules, each desired lint must be explicitly enabled.
4# See: https://github.com/dart-lang/linter/issues/288
5#
6# For a list of lints, see: http://dart-lang.github.io/linter/lints/
7# See the configuration guide for more
8# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
9#
Dan Rubel3ed33902016-09-07 22:41:59 -040010# This file contains the analysis options used by Flutter editors, such as Atom.
11# It is very similar to .analysis_options_flutter_analyze;
12# the only difference (currently) is the public_member_api_docs option,
13# which triggers too many messages to be used in editors.
krisgiesing07b5f832016-05-04 10:15:15 -070014
15analyzer:
16 language:
17 enableStrictCallChecks: true
18 enableSuperMixins: true
Ian Hickson63aa1392017-01-23 01:04:31 -080019 strong-mode:
20 implicit-dynamic: false
krisgiesing07b5f832016-05-04 10:15:15 -070021 errors:
Dan Rubel57843852016-09-09 13:37:56 -040022 # allow overriding fields (if they use super, ideally...)
krisgiesing07b5f832016-05-04 10:15:15 -070023 strong_mode_invalid_field_override: ignore
Dan Rubel57843852016-09-09 13:37:56 -040024 # allow type narrowing
krisgiesing07b5f832016-05-04 10:15:15 -070025 strong_mode_down_cast_composite: ignore
Dan Rubel57843852016-09-09 13:37:56 -040026 # allow having TODOs in the code
krisgiesing07b5f832016-05-04 10:15:15 -070027 todo: ignore
Devon Carew207451f2016-08-18 19:11:39 -070028 exclude:
Devon Carewf1b35232016-11-07 14:47:53 -080029 - 'bin/cache/**'
Ian Hicksoncbda2082017-01-22 16:43:24 -080030 # the following two are relative to the stocks example and the flutter package respectively
31 # see https://github.com/dart-lang/sdk/issues/28463
32 - 'lib/i18n/stock_messages_*.dart'
33 - 'lib/src/http/**'
Ian Hickson94636bd2016-05-20 14:08:46 -070034
krisgiesing07b5f832016-05-04 10:15:15 -070035linter:
36 rules:
Dan Rubel57843852016-09-09 13:37:56 -040037 # these rules are documented on and in the same order as
38 # the Dart Lint rules page to make maintenance easier
39 # http://dart-lang.github.io/linter/lints/
Ian Hickson94636bd2016-05-20 14:08:46 -070040
Dan Rubel57843852016-09-09 13:37:56 -040041 # === error rules ===
krisgiesing07b5f832016-05-04 10:15:15 -070042 - avoid_empty_else
Dan Rubel57843852016-09-09 13:37:56 -040043 # - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
Dan Rubel678da3a2016-09-12 16:32:08 -040044 - cancel_subscriptions
Dan Rubel7cf47ca2016-09-09 15:18:18 -040045 # - close_sinks # https://github.com/flutter/flutter/issues/5789
Ian Hickson94636bd2016-05-20 14:08:46 -070046 - control_flow_in_finally
Dan Rubel7cf47ca2016-09-09 15:18:18 -040047 - empty_statements
Ian Hickson94636bd2016-05-20 14:08:46 -070048 - hash_and_equals
Dan Rubel7cf47ca2016-09-09 15:18:18 -040049 # - invariant_booleans # https://github.com/flutter/flutter/issues/5790
Ian Hickson94636bd2016-05-20 14:08:46 -070050 # - iterable_contains_unrelated_type
Dan Rubel7cf47ca2016-09-09 15:18:18 -040051 - list_remove_unrelated_type
52 # - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
Ian Hickson94636bd2016-05-20 14:08:46 -070053 - test_types_in_equals
54 - throw_in_finally
55 - unrelated_type_equality_checks
Dan Rubel7cf47ca2016-09-09 15:18:18 -040056 - valid_regexps
Ian Hickson94636bd2016-05-20 14:08:46 -070057
Dan Rubel57843852016-09-09 13:37:56 -040058 # === style rules ===
krisgiesing07b5f832016-05-04 10:15:15 -070059 - always_declare_return_types
60 - always_specify_types
61 - annotate_overrides
62 - avoid_as
63 - avoid_init_to_null
Ian Hickson94636bd2016-05-20 14:08:46 -070064 - avoid_return_types_on_setters
65 - await_only_futures
krisgiesing07b5f832016-05-04 10:15:15 -070066 - camel_case_types
Dan Rubel57843852016-09-09 13:37:56 -040067 # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
Ian Hickson94636bd2016-05-20 14:08:46 -070068 - control_flow_in_finally
krisgiesing07b5f832016-05-04 10:15:15 -070069 - empty_constructor_bodies
Ian Hickson94636bd2016-05-20 14:08:46 -070070 - implementation_imports
krisgiesing07b5f832016-05-04 10:15:15 -070071 - library_names
72 - library_prefixes
73 - non_constant_identifier_names
Ian Hickson94636bd2016-05-20 14:08:46 -070074 - one_member_abstracts
Dan Rubel7cf47ca2016-09-09 15:18:18 -040075 # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
Dan Rubel57843852016-09-09 13:37:56 -040076 # - overridden_fields
krisgiesing07b5f832016-05-04 10:15:15 -070077 - package_api_docs
krisgiesing07b5f832016-05-04 10:15:15 -070078 - package_prefixed_library_names
79 - prefer_is_not_empty
Ian Hickson94636bd2016-05-20 14:08:46 -070080 # - public_member_api_docs
krisgiesing07b5f832016-05-04 10:15:15 -070081 - slash_for_doc_comments
82 - sort_constructors_first
83 - sort_unnamed_constructors_first
84 - super_goes_last
Ian Hickson94636bd2016-05-20 14:08:46 -070085 # - type_annotate_public_apis # subset of always_specify_types
krisgiesing07b5f832016-05-04 10:15:15 -070086 - type_init_formals
Dan Rubel7cf47ca2016-09-09 15:18:18 -040087 # - unawaited_futures # https://github.com/flutter/flutter/issues/5793
krisgiesing07b5f832016-05-04 10:15:15 -070088 - unnecessary_brace_in_string_interp
89 - unnecessary_getters_setters
Ian Hickson94636bd2016-05-20 14:08:46 -070090
Dan Rubel57843852016-09-09 13:37:56 -040091 # === pub rules ===
Ian Hickson94636bd2016-05-20 14:08:46 -070092 - package_names