|
| 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 | + |
| 8 | +# The following line activates a set of recommended lints for Flutter apps, |
| 9 | +# packages, and plugins designed to encourage good coding practices. |
| 10 | +include: package:flutter_lints/flutter.yaml |
| 11 | + |
| 12 | +analyzer: |
| 13 | + exclude: |
| 14 | + - "lib/**/*.freezed.dart" |
| 15 | + - "lib/**/*.g.dart" |
| 16 | + - "lib/**/*.config.dart" |
| 17 | + plugins: |
| 18 | + - dart_code_metrics |
| 19 | + |
| 20 | +linter: |
| 21 | + # The lint rules applied to this project can be customized in the |
| 22 | + # section below to disable rules from the `package:flutter_lints/flutter.yaml` |
| 23 | + # included above or to enable additional rules. A list of all available lints |
| 24 | + # and their documentation is published at |
| 25 | + # https://dart-lang.github.io/linter/lints/index.html. |
| 26 | + # |
| 27 | + # Instead of disabling a lint rule for the entire project in the |
| 28 | + # section below, it can also be suppressed for a single line of code |
| 29 | + # or a specific dart file by using the `// ignore: name_of_lint` and |
| 30 | + # `// ignore_for_file: name_of_lint` syntax on the line or in the file |
| 31 | + # producing the lint. |
| 32 | + rules: |
| 33 | + require_trailing_commas: true |
| 34 | + prefer_final_locals: true |
| 35 | + prefer_final_in_for_each: true |
| 36 | + null_check_on_nullable_type_parameter: true |
| 37 | + avoid_function_literals_in_foreach_calls: true |
| 38 | + avoid_relative_lib_imports: true |
| 39 | + always_use_package_imports: true |
| 40 | + avoid_types_on_closure_parameters: true |
| 41 | + avoid_void_async: true |
| 42 | + cancel_subscriptions: true |
| 43 | + close_sinks: true |
| 44 | + package_api_docs: true |
| 45 | + package_prefixed_library_names: true |
| 46 | + test_types_in_equals: true |
| 47 | + throw_in_finally: true |
| 48 | + unnecessary_statements: true |
| 49 | + use_super_parameters: true |
| 50 | + avoid_dynamic_calls: false |
| 51 | + avoid_slow_async_io: true |
| 52 | + no_duplicate_case_values: true |
| 53 | + use_build_context_synchronously: true |
| 54 | + valid_regexps: true |
| 55 | + depend_on_referenced_packages: true |
| 56 | + always_require_non_null_named_parameters: true |
| 57 | + annotate_overrides: true |
| 58 | + avoid_annotating_with_dynamic: true |
| 59 | + avoid_bool_literals_in_conditional_expressions: true |
| 60 | + avoid_catches_without_on_clauses: false |
| 61 | + avoid_catching_errors: false |
| 62 | + avoid_classes_with_only_static_members: false |
| 63 | + avoid_double_and_int_checks: true |
| 64 | + avoid_escaping_inner_quotes: true |
| 65 | + avoid_field_initializers_in_const_classes: true |
| 66 | + avoid_init_to_null: true |
| 67 | + avoid_null_checks_in_equality_operators: true |
| 68 | + # Need for LINT |
| 69 | + avoid_positional_boolean_parameters: false |
| 70 | + avoid_private_typedef_functions: true |
| 71 | + avoid_redundant_argument_values: true |
| 72 | + avoid_returning_null_for_void: true |
| 73 | + avoid_shadowing_type_parameters: true |
| 74 | + avoid_single_cascade_in_expression_statements: true |
| 75 | + avoid_unnecessary_containers: true |
| 76 | + await_only_futures: true |
| 77 | + cast_nullable_to_non_nullable: false |
| 78 | + combinators_ordering: true |
| 79 | + conditional_uri_does_not_exist: true |
| 80 | + enable_null_safety: true |
| 81 | + eol_at_end_of_file: true |
| 82 | + exhaustive_cases: true |
| 83 | + prefer_is_empty: true |
| 84 | + prefer_is_not_empty: true |
| 85 | + prefer_is_not_operator: true |
| 86 | + prefer_iterable_whereType: true |
| 87 | + prefer_null_aware_method_calls: true |
| 88 | + prefer_null_aware_operators: true |
| 89 | + prefer_spread_collections: true |
| 90 | + sized_box_for_whitespace: true |
| 91 | + sized_box_shrink_expand: true |
| 92 | + unnecessary_null_checks: true |
| 93 | + unnecessary_null_in_if_null_operators: true |
| 94 | + unnecessary_overrides: true |
| 95 | + unnecessary_parenthesis: true |
| 96 | + unnecessary_raw_strings: true |
| 97 | + unnecessary_string_interpolations: true |
| 98 | + unnecessary_this: true |
| 99 | + unnecessary_to_list_in_spreads: true |
| 100 | + unreachable_from_main: true |
| 101 | + use_colored_box: true |
| 102 | + use_enums: true |
| 103 | + use_full_hex_values_for_flutter_colors: true |
| 104 | + use_if_null_to_convert_nulls_to_bools: true |
| 105 | + use_is_even_rather_than_modulo: true |
| 106 | + use_named_constants: true |
| 107 | + use_raw_strings: true |
| 108 | + use_setters_to_change_properties: true |
| 109 | + use_string_buffers: false |
| 110 | + use_test_throws_matchers: true |
| 111 | + use_to_and_as_if_applicable: true |
| 112 | + void_checks: true |
| 113 | + |
| 114 | + # Pub rules |
| 115 | + secure_pubspec_urls: true |
| 116 | + |
| 117 | + # avoid_print: false # Uncomment to disable the `avoid_print` rule |
| 118 | + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule |
| 119 | +# Additional information about this file can be found at |
| 120 | +# https://dart.dev/guides/language/analysis-options |
| 121 | + |
| 122 | +dart_code_metrics: |
| 123 | + # anti-patterns: |
| 124 | + # - long-method |
| 125 | + # - long-parameter-list |
| 126 | + metrics: |
| 127 | + cyclomatic-complexity: 20 |
| 128 | + maximum-nesting-level: 5 |
| 129 | + number-of-parameters: 10 |
| 130 | + source-lines-of-code: 50 |
| 131 | + metrics-exclude: |
| 132 | + - test/** |
| 133 | + rules: |
| 134 | + # - newline-before-return: |
| 135 | + # severity: style |
| 136 | + - no-boolean-literal-compare: |
| 137 | + severity: style |
| 138 | + # - no-empty-block: |
| 139 | + # severity: warning |
| 140 | + # - prefer-trailing-comma: |
| 141 | + # severity: none |
| 142 | + # - prefer-conditional-expressions: |
| 143 | + # severity: none |
| 144 | + - no-equal-then-else: |
| 145 | + severity: error |
0 commit comments