From 35098dae21733b36f3f84478507689d29492006a Mon Sep 17 00:00:00 2001 From: lukaknezic Date: Sun, 8 May 2022 19:37:29 +0200 Subject: [PATCH] Update default analysis options to include codemetrics --- project/analysis_options.yaml | 63 ++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/project/analysis_options.yaml b/project/analysis_options.yaml index fa2cfdc..1bf724a 100644 --- a/project/analysis_options.yaml +++ b/project/analysis_options.yaml @@ -1,14 +1,69 @@ +# TODO: Add flutter_lints to your pubspec.yaml file include: package:flutter_lints/flutter.yaml analyzer: + plugins: + - dart_code_metrics + strong-mode: implicit-casts: false implicit-dynamic: false exclude: - - "lib/**/*.freezed.dart" + - "bin/cache/**" + - "lib/util/localization/initialize_i18n/**" + - "lib/assets.dart" - "lib/**/*.g.dart" - - "lib/**/*.gen.dart" + - "lib/**/*.freezed.dart" + - "test/**" + +# TODO: Add dart_code_metrics to your pubspec.yaml file +dart_code_metrics: + anti-patterns: + - long-method + - long-parameter-list + metrics: + cyclomatic-complexity: 20 + maximum-nesting-level: 5 + number-of-methods: 10 + technical-debt: + threshold: 0 + todo-cost: 6 + ignore-cost: 6 + ignore-for-file-cost: 16 + as-dynamic-cost: 6 + deprecated-annotations-cost: 16 + file-nullsafety-migration-cost: 8 + unit-type: "Hours" -linter: rules: - - prefer_single_quotes + - avoid-collection-methods-with-unrelated-types + - avoid-global-state + - avoid-nested-conditional-expressions + - avoid-unnecessary-type-assertions + - avoid-unnecessary-type-casts + - avoid-unused-parameters + - ban-name: + severity: warning + entries: + # If using loggy then don't use print + - ident: print + description: Use Loggy for printing statements to the console in this project + # Common look oversights + - ident: Theme.of + description: Use Look for styling in this project + - ident: TextStyle + description: Use Look for styling in this project + - ident: Colors + description: Use Look for styling in this project + - no-boolean-literal-compare + - no-empty-block + - no-equal-then-else + - prefer-immediate-return + - prefer-match-file-name: + severity: style + # Flutter + - always-remove-listener + - avoid-returning-widgets + - prefer-extracting-callbacks + - prefer-single-widget-per-file: + ignore-private-widgets: true \ No newline at end of file