mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
Some checks failed
CLI Build / CLI Publish (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Docker / pre-job (push) Has been cancelled
Docs build / pre-job (push) Has been cancelled
Zizmor / Zizmor (push) Has been cancelled
Static Code Analysis / pre-job (push) Has been cancelled
Test / pre-job (push) Has been cancelled
Test / ShellCheck (push) Has been cancelled
Test / OpenAPI Clients (push) Has been cancelled
Test / SQL Schema Checks (push) Has been cancelled
CLI Build / Docker (push) Has been cancelled
Docker / Re-Tag ML (push) Has been cancelled
Docker / Re-Tag Server (push) Has been cancelled
Docker / Build and Push ML (push) Has been cancelled
Docker / Build and Push Server (push) Has been cancelled
Docker / Mirror to Docker Hub (push) Has been cancelled
Docker / Docker Build & Push Server Success (push) Has been cancelled
Docker / Docker Build & Push ML Success (push) Has been cancelled
Docs build / Docs Build (push) Has been cancelled
Static Code Analysis / Run Dart Code Analysis (push) Has been cancelled
Test / Scripts unit tests (push) Has been cancelled
Test / Test & Lint Server (push) Has been cancelled
Test / Unit Test CLI (push) Has been cancelled
Test / Unit Test CLI (Windows) (push) Has been cancelled
Test / Lint Web (push) Has been cancelled
Test / Test Web (push) Has been cancelled
Test / Test i18n (push) Has been cancelled
Test / End-to-End Lint (push) Has been cancelled
Test / Medium Tests (Server) (push) Has been cancelled
Test / End-to-End Tests (Server & CLI) (push) Has been cancelled
Test / End-to-End Tests (Web) (push) Has been cancelled
Test / End-to-End Tests Success (push) Has been cancelled
Test / Unit Test Mobile (push) Has been cancelled
Test / Unit Test ML (push) Has been cancelled
Test / .github Files Formatting (push) Has been cancelled
The lints are regrouped and sorted. Also, added the following new lints: - unnecessary_ignore - parameter_assignments - avoid_unused_constructor_parameters - tighten_type_of_initializing_formals - only_throw_errors - deprecated_consistency - unnecessary_statements Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
145 lines
5.1 KiB
YAML
145 lines
5.1 KiB
YAML
# This file configures the analyzer, which statically analyzes Dart code to
|
|
# check for errors, warnings, and lints.
|
|
#
|
|
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
|
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
|
# invoked from the command line by running `flutter analyze`.
|
|
|
|
# The following line activates a set of recommended lints for Flutter apps,
|
|
# packages, and plugins designed to encourage good coding practices.
|
|
include: package:flutter_lints/flutter.yaml
|
|
|
|
formatter:
|
|
page_width: 120
|
|
|
|
linter:
|
|
# The lint rules applied to this project can be customized in the
|
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
|
# included above or to enable additional rules. A list of all available lints
|
|
# and their documentation is published at
|
|
# https://dart.dev/tools/linter-rules
|
|
#
|
|
# Instead of disabling a lint rule for the entire project in the
|
|
# section below, it can also be suppressed for a single line of code
|
|
# or a specific dart file by using the `// ignore: name_of_lint` and
|
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
|
# producing the lint.
|
|
|
|
rules:
|
|
# Correctness
|
|
always_declare_return_types: true
|
|
avoid_type_to_string: true
|
|
avoid_unused_constructor_parameters: true
|
|
avoid_void_async: true
|
|
cancel_subscriptions: true
|
|
cast_nullable_to_non_nullable: true
|
|
close_sinks: true
|
|
collection_methods_unrelated_type: true
|
|
deprecated_consistency: true
|
|
discarded_futures: true
|
|
no_adjacent_strings_in_list: true
|
|
no_self_assignments: true
|
|
noop_primitive_operations: true
|
|
only_throw_errors: true
|
|
parameter_assignments: true
|
|
throw_in_finally: true
|
|
tighten_type_of_initializing_formals: true
|
|
unawaited_futures: true
|
|
unnecessary_ignore: true
|
|
unnecessary_null_checks: true
|
|
unnecessary_statements: true
|
|
unrelated_type_equality_checks: true
|
|
|
|
# Performance
|
|
avoid_slow_async_io: true
|
|
prefer_const_constructors: true
|
|
prefer_const_declarations: true
|
|
prefer_const_literals_to_create_immutables: true
|
|
|
|
# Flutter specific
|
|
avoid_unnecessary_containers: true
|
|
sized_box_for_whitespace: true
|
|
use_build_context_synchronously: true
|
|
use_colored_box: true
|
|
use_decorated_box: true
|
|
use_full_hex_values_for_flutter_colors: true
|
|
|
|
# Style
|
|
always_put_control_body_on_new_line: true
|
|
always_use_package_imports: true
|
|
avoid_multiple_declarations_per_line: true
|
|
avoid_print: true
|
|
combinators_ordering: true
|
|
directives_ordering: true
|
|
no_leading_underscores_for_local_identifiers: true
|
|
prefer_final_locals: true
|
|
require_trailing_commas: true
|
|
unnecessary_breaks: true
|
|
unnecessary_parenthesis: true
|
|
use_named_constants: true
|
|
use_super_parameters: true
|
|
|
|
# Additional information about this file can be found at
|
|
# https://dart.dev/guides/language/analysis-options
|
|
analyzer:
|
|
exclude:
|
|
- generated/openapi/**
|
|
- build/**
|
|
- lib/generated_plugin_registrant.dart
|
|
- lib/**/*.g.dart
|
|
- lib/**/*.drift.dart
|
|
|
|
# NOTE: We explicitly do not use riverpod_lint as there are analyzer version conflicts between
|
|
# our Flutter version and the required old riverpod_lint 2.x
|
|
errors:
|
|
unawaited_futures: warning
|
|
always_put_control_body_on_new_line: warning
|
|
|
|
dart_code_metrics:
|
|
rules:
|
|
- banned-usage:
|
|
entries:
|
|
- name: debugPrint
|
|
description: Use dPrint instead of debugPrint for proper tree-shaking in release builds.
|
|
exclude-paths:
|
|
- 'lib/utils/debug_print.dart'
|
|
severity: perf
|
|
- name: tr
|
|
description: 'Use context.t.<key> or StaticTranslations.instance.<key> instead of tr().'
|
|
- type: String
|
|
entries:
|
|
- name: tr
|
|
description: 'Use context.t.<key> or StaticTranslations.instance.<key> instead of String.tr().'
|
|
- name: plural
|
|
description: 'Use the generated plural accessor instead of String.plural().'
|
|
- type: Text
|
|
entries:
|
|
- name: tr
|
|
description: 'Use Text(context.t.<key>) instead of Text(<key>).tr().'
|
|
# All rules from "recommended" preset
|
|
# Show potential errors
|
|
# - avoid-cascade-after-if-null
|
|
# - avoid-collection-methods-with-unrelated-types
|
|
# - avoid-duplicate-exports
|
|
# - avoid-dynamic
|
|
# - avoid-missing-enum-constant-in-map
|
|
# - avoid-passing-async-when-sync-expected
|
|
# - avoid-throw-in-catch-block
|
|
- avoid-unused-parameters
|
|
- prefer-const-border-radius
|
|
- prefer-declaring-const-constructor
|
|
- prefer-switch-expression
|
|
|
|
# Riverpod
|
|
- avoid-calling-notifier-members-inside-build
|
|
- avoid-notifier-constructors
|
|
- avoid-nullable-async-value-pattern
|
|
- avoid-public-notifier-properties
|
|
- avoid-ref-inside-state-dispose
|
|
- avoid-ref-read-inside-build
|
|
- avoid-ref-watch-outside-build
|
|
- avoid-unnecessary-consumer-widgets
|
|
- dispose-provided-instances
|
|
- prefer-immutable-provider-arguments
|
|
- use-ref-and-state-synchronously
|
|
- use-ref-read-synchronously
|