analysis_options.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. analyzer:
  2. linter:
  3. rules:
  4. # these rules are documented on and in the same order as
  5. # the Dart Lint rules page to make maintenance easier
  6. # https://github.com/dart-lang/linter/blob/master/example/all.yaml
  7. - always_declare_return_types
  8. - always_put_control_body_on_new_line
  9. # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219
  10. - always_require_non_null_named_parameters
  11. # - always_specify_types
  12. - annotate_overrides
  13. # - avoid_annotating_with_dynamic # conflicts with always_specify_types
  14. - avoid_as
  15. # - avoid_bool_literals_in_conditional_expressions # not yet tested
  16. # - avoid_catches_without_on_clauses # we do this commonly
  17. # - avoid_catching_errors # we do this commonly
  18. - avoid_classes_with_only_static_members
  19. # - avoid_double_and_int_checks # only useful when targeting JS runtime
  20. - avoid_empty_else
  21. - avoid_field_initializers_in_const_classes
  22. # - avoid_function_literals_in_foreach_calls
  23. - avoid_init_to_null
  24. # - avoid_js_rounded_ints # only useful when targeting JS runtime
  25. - avoid_null_checks_in_equality_operators
  26. # - avoid_positional_boolean_parameters # not yet tested
  27. # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
  28. - avoid_relative_lib_imports
  29. - avoid_renaming_method_parameters
  30. - avoid_return_types_on_setters
  31. # - avoid_returning_null # we do this commonly
  32. # - avoid_returning_this # https://github.com/dart-lang/linter/issues/842
  33. # - avoid_setters_without_getters # not yet tested
  34. # - avoid_single_cascade_in_expression_statements # not yet tested
  35. - avoid_slow_async_io
  36. # - avoid_types_as_parameter_names # https://github.com/dart-lang/linter/pull/954/files
  37. # - avoid_types_on_closure_parameters # conflicts with always_specify_types
  38. # - avoid_unused_constructor_parameters # https://github.com/dart-lang/linter/pull/847
  39. - await_only_futures
  40. - camel_case_types
  41. - cancel_subscriptions
  42. # - cascade_invocations # not yet tested
  43. # - close_sinks # https://github.com/flutter/flutter/issues/5789
  44. # - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
  45. # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
  46. - control_flow_in_finally
  47. - directives_ordering
  48. - empty_catches
  49. - empty_constructor_bodies
  50. - empty_statements
  51. - hash_and_equals
  52. - implementation_imports
  53. # - invariant_booleans # https://github.com/flutter/flutter/issues/5790
  54. - iterable_contains_unrelated_type
  55. # - join_return_with_assignment # not yet tested
  56. - library_names
  57. - library_prefixes
  58. - list_remove_unrelated_type
  59. # - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
  60. - no_adjacent_strings_in_list
  61. - no_duplicate_case_values
  62. - non_constant_identifier_names
  63. # - omit_local_variable_types # opposite of always_specify_types
  64. # - one_member_abstracts # too many false positives
  65. # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
  66. - overridden_fields
  67. - package_api_docs
  68. - package_names
  69. - package_prefixed_library_names
  70. # - parameter_assignments # we do this commonly
  71. - prefer_adjacent_string_concatenation
  72. - prefer_asserts_in_initializer_lists
  73. - prefer_bool_in_asserts
  74. - prefer_collection_literals
  75. - prefer_conditional_assignment
  76. - prefer_const_constructors
  77. - prefer_const_constructors_in_immutables
  78. - prefer_const_declarations
  79. - prefer_const_literals_to_create_immutables
  80. # - prefer_constructors_over_static_methods # not yet tested
  81. - prefer_contains
  82. - prefer_equal_for_default_values
  83. # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods
  84. - prefer_final_fields
  85. - prefer_final_locals
  86. # - prefer_foreach
  87. # - prefer_function_declarations_over_variables # not yet tested
  88. - prefer_initializing_formals
  89. # - prefer_interpolation_to_compose_strings # not yet tested
  90. # - prefer_iterable_whereType # https://github.com/dart-lang/sdk/issues/32463
  91. - prefer_is_empty
  92. - prefer_is_not_empty
  93. - prefer_single_quotes
  94. - prefer_typing_uninitialized_variables
  95. - recursive_getters
  96. - slash_for_doc_comments
  97. - sort_constructors_first
  98. - sort_unnamed_constructors_first
  99. - super_goes_last
  100. - test_types_in_equals
  101. - throw_in_finally
  102. # - type_annotate_public_apis # subset of always_specify_types
  103. - type_init_formals
  104. # - unawaited_futures # https://github.com/flutter/flutter/issues/5793
  105. - unnecessary_brace_in_string_interps
  106. - unnecessary_getters_setters
  107. # - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498
  108. - unnecessary_null_aware_assignments
  109. - unnecessary_null_in_if_null_operators
  110. - unnecessary_overrides
  111. - unnecessary_parenthesis
  112. # - unnecessary_statements # not yet tested
  113. - unnecessary_this
  114. - unrelated_type_equality_checks
  115. - use_rethrow_when_possible
  116. # - use_setters_to_change_properties # not yet tested
  117. # - use_string_buffers # https://github.com/dart-lang/linter/pull/664
  118. # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
  119. - valid_regexps
  120. # - void_checks # not yet tested