analysis_options.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. # This file configures the analyzer, which statically analyzes Dart code to
  2. # check for errors, warnings, and lints.
  3. #
  4. # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
  5. # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
  6. # invoked from the command line by running `flutter analyze`.
  7. # The following line activates a set of recommended lints for Flutter apps,
  8. # packages, and plugins designed to encourage good coding practices.
  9. include: package:flutter_lints/flutter.yaml
  10. analyzer:
  11. exclude:
  12. - lib/app/app.locator.dart
  13. - lib/app/app.router.dart
  14. - lib/models/patch.g.dart
  15. - lib/models/patched_application.g.dart
  16. linter:
  17. rules:
  18. - always_declare_return_types
  19. - require_trailing_commas
  20. - always_put_control_body_on_new_line
  21. - always_use_package_imports # we do this commonly
  22. - annotate_overrides
  23. - avoid_bool_literals_in_conditional_expressions
  24. - avoid_double_and_int_checks
  25. - avoid_empty_else
  26. - avoid_equals_and_hash_code_on_mutable_classes
  27. - avoid_escaping_inner_quotes
  28. - avoid_field_initializers_in_const_classes
  29. - avoid_function_literals_in_foreach_calls
  30. - avoid_implementing_value_types
  31. - avoid_init_to_null
  32. - avoid_js_rounded_ints
  33. - avoid_null_checks_in_equality_operators
  34. - avoid_print
  35. - avoid_redundant_argument_values
  36. - avoid_relative_lib_imports
  37. - avoid_renaming_method_parameters
  38. - avoid_return_types_on_setters
  39. - avoid_returning_null_for_void
  40. - avoid_setters_without_getters
  41. - avoid_shadowing_type_parameters
  42. - avoid_single_cascade_in_expression_statements
  43. - avoid_type_to_string
  44. - avoid_types_as_parameter_names
  45. - avoid_unnecessary_containers
  46. - avoid_void_async
  47. - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
  48. - await_only_futures
  49. - camel_case_extensions
  50. - camel_case_types
  51. - cancel_subscriptions
  52. - cast_nullable_to_non_nullable
  53. - close_sinks # not reliable enough
  54. - control_flow_in_finally
  55. - curly_braces_in_flow_control_structures
  56. - depend_on_referenced_packages
  57. - deprecated_consistency
  58. - directives_ordering
  59. - empty_catches
  60. - empty_constructor_bodies
  61. - empty_statements
  62. - eol_at_end_of_file
  63. - exhaustive_cases
  64. - file_names
  65. - flutter_style_todos
  66. - hash_and_equals
  67. - implementation_imports
  68. - collection_methods_unrelated_type
  69. - leading_newlines_in_multiline_strings
  70. - library_prefixes
  71. - library_private_types_in_public_api
  72. - missing_whitespace_between_adjacent_strings
  73. - no_adjacent_strings_in_list
  74. - no_duplicate_case_values
  75. - no_logic_in_create_state
  76. - non_constant_identifier_names
  77. - noop_primitive_operations
  78. - null_check_on_nullable_type_parameter
  79. - null_closures
  80. - overridden_fields
  81. - package_api_docs
  82. - package_names
  83. - prefer_adjacent_string_concatenation
  84. - prefer_asserts_in_initializer_lists
  85. - prefer_collection_literals
  86. - prefer_conditional_assignment
  87. - prefer_const_constructors
  88. - prefer_const_constructors_in_immutables
  89. - prefer_const_declarations
  90. - prefer_const_literals_to_create_immutables
  91. - prefer_contains
  92. - prefer_final_fields
  93. - prefer_final_in_for_each
  94. - prefer_final_locals
  95. - prefer_for_elements_to_map_fromIterable
  96. - prefer_foreach
  97. - prefer_function_declarations_over_variables
  98. - prefer_generic_function_type_aliases
  99. - prefer_if_elements_to_conditional_expressions
  100. - prefer_if_null_operators
  101. - prefer_initializing_formals
  102. - prefer_inlined_adds
  103. - prefer_interpolation_to_compose_strings
  104. - prefer_is_empty
  105. - prefer_is_not_empty
  106. - prefer_is_not_operator
  107. - prefer_iterable_whereType
  108. - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
  109. - prefer_null_aware_operators
  110. - prefer_single_quotes
  111. - prefer_spread_collections
  112. - prefer_typing_uninitialized_variables
  113. - provide_deprecation_message
  114. - recursive_getters
  115. - sized_box_for_whitespace
  116. - slash_for_doc_comments
  117. - sort_child_properties_last
  118. - sort_constructors_first
  119. - sort_pub_dependencies
  120. - sort_unnamed_constructors_first
  121. - test_types_in_equals
  122. - throw_in_finally
  123. - tighten_type_of_initializing_formals
  124. - type_init_formals
  125. - unnecessary_brace_in_string_interps
  126. - unnecessary_const
  127. - unnecessary_getters_setters
  128. - unnecessary_new
  129. - unnecessary_null_aware_assignments
  130. - unnecessary_null_checks
  131. - unnecessary_null_in_if_null_operators
  132. - unnecessary_nullable_for_final_variable_declarations
  133. - unnecessary_overrides
  134. - unnecessary_parenthesis
  135. - unnecessary_statements
  136. - unnecessary_string_escapes
  137. - unnecessary_string_interpolations
  138. - unnecessary_this
  139. - unrelated_type_equality_checks
  140. - unsafe_html
  141. - use_build_context_synchronously
  142. - use_full_hex_values_for_flutter_colors
  143. - use_function_type_syntax_for_parameters
  144. - use_if_null_to_convert_nulls_to_bools
  145. - use_is_even_rather_than_modulo
  146. - use_key_in_widget_constructors
  147. - use_late_for_private_fields_and_variables
  148. - use_named_constants
  149. - use_raw_strings
  150. - use_rethrow_when_possible
  151. - use_setters_to_change_properties
  152. - use_test_throws_matchers
  153. - valid_regexps
  154. - void_checks