-
Notifications
You must be signed in to change notification settings - Fork 6
/
analysis_options.yaml
100 lines (88 loc) · 2.8 KB
/
analysis_options.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
############################################################################
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
# Get result
# flutter pub run dart_code_metrics:metrics analyze lib
############################################################################
# DEPRECATED
##################### Standart flutter linter #####################
# include: package:flutter_lints/flutter.yaml
# linter:
# rules:
# avoid_print: false
# prefer_single_quotes: true #
# always_use_package_imports: true
# avoid_dynamic_calls: true
# avoid_empty_else: true
# avoid_relative_lib_imports: true
##################### Standart flutter linter #####################
include: package:extra_pedantic/analysis_options.yaml
linter:
# All rules: https://github.com/dart-lang/linter/blob/master/lib/src/rules.dart
rules:
prefer_relative_imports: false
use_build_context_synchronously: false # TODO Is it possible to check if context is mounted? :(
comment_references: false
sort_pub_dependencies: false
sort_child_properties_last: true
leading_newlines_in_multiline_strings: true
no_runtimeType_toString: true
unnecessary_null_checks: true
use_if_null_to_convert_nulls_to_bools: true
use_key_in_widget_constructors: true
use_late_for_private_fields_and_variables: true
require_trailing_commas: true
eol_at_end_of_file: true
analyzer:
### extra_pedantic ###
# strong-mode:
# # https://github.com/dart-lang/language/tree/master/resources/type-system
# implicit-casts: false
# implicit-dynamic: true
language:
# https://github.com/dart-lang/language/tree/master/resources/type-system
strict-inference: true
strict-raw-types: true
strict-casts: true
errors:
inference_failure_on_function_invocation: false
### extra_pedantic ###
plugins:
- dart_code_metrics
exclude:
- '**/*.g.dart'
- '**/*.freezed.dart'
- '**/*.gr.dart'
- '**/__generated__/**'
dart_code_metrics:
metrics:
cyclomatic-complexity: 10
halstead-volume: 700
lines-of-code: 80
maintainability-index: 48
maximum-nesting-level: 5
number-of-methods: 10
number-of-parameters: 8
metrics-exclude:
- test/**
- '**/__generated__/**'
rules:
# Common rules
- no-boolean-literal-compare
- no-empty-block
- prefer-trailing-comma
- prefer-first
- prefer-last
- no-equal-then-else
# Flutter specific
- avoid-border-all
- avoid-returning-widgets
- avoid-unnecessary-setstate
- avoid-wrapping-in-padding
- prefer-const-border-radius
- prefer-extracting-callbacks
- prefer-single-widget-per-file:
ignore-private-widgets: true
anti-patterns:
- long-method
- long-parameter-list