chore(j0.2): outillage qualite (lint strict, check.sh, mocktail)

- analysis_options.yaml durci (strict-casts/inference/raw-types + regles)
- tool/check.sh : format + analyze + test, garde-fou PATH
- mocktail en dev_dependencies
- README : contrat "check.sh avant de cocher une etape"
- ROADMAP : 0.2 cochee

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vincent Bourdon
2026-06-19 17:19:57 +02:00
parent 682d240893
commit f9cdabfe98
6 changed files with 72 additions and 33 deletions
+11 -2
View File
@@ -19,13 +19,22 @@ flutter --version
Android uniquement. Android uniquement.
## Lancer les tests ## Vérification qualité (avant de cocher une étape)
```bash
tool/check.sh
```
Le script enchaîne `dart format --set-exit-if-changed`, `flutter analyze` et `flutter test`.
Il échoue (exit ≠ 0) dès qu'une vérification ne passe pas. **`tool/check.sh` doit passer avant de cocher une étape dans `ROADMAP.md`.**
## Lancer les tests seuls
```bash ```bash
flutter test flutter test
``` ```
## Analyser le code ## Analyser le code seul
```bash ```bash
flutter analyze flutter analyze
+1 -1
View File
@@ -30,7 +30,7 @@ Spec détaillée : [`docs/specs/`](docs/specs/) — un dossier par jalon, étape
Spec : [`docs/specs/jalon-0-fondations/`](docs/specs/jalon-0-fondations/) Spec : [`docs/specs/jalon-0-fondations/`](docs/specs/jalon-0-fondations/)
- [x] 0.1 — Structure du projet Flutter & arborescence clean archi (2026-06-19) - [x] 0.1 — Structure du projet Flutter & arborescence clean archi (2026-06-19)
- [ ] 0.2 — Outillage qualité (lint strict, format, CI locale) - [x] 0.2 — Outillage qualité (lint strict, format, CI locale) (2026-06-19)
- [ ] 0.3 — Socle transverse (`Result`, erreurs, thème, router, DI Riverpod) - [ ] 0.3 — Socle transverse (`Result`, erreurs, thème, router, DI Riverpod)
## Jalon 1 — Verrouillage / épinglage ⚠️ ## Jalon 1 — Verrouillage / épinglage ⚠️
+30 -25
View File
@@ -1,28 +1,33 @@
# This file configures the analyzer, which statically analyzes Dart code to # Analyse statique Storytime — durcissement au-dessus de flutter_lints.
# check for errors, warnings, and lints. # Objectif : 0 warning sur l'ensemble du projet.
# # Pour désactiver une règle localement : // ignore: nom_de_la_regle
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled # Pour désactiver une règle sur un fichier : // ignore_for_file: nom_de_la_regle
# 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 include: package:flutter_lints/flutter.yaml
linter: analyzer:
# The lint rules applied to this project can be customized in the language:
# section below to disable rules from the `package:flutter_lints/flutter.yaml` strict-casts: true
# included above or to enable additional rules. A list of all available lints strict-inference: true
# and their documentation is published at https://dart.dev/lints. strict-raw-types: true
#
# 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:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at linter:
# https://dart.dev/guides/language/analysis-options rules:
# --- Qualité générale ---
always_declare_return_types: true
avoid_print: true # utiliser un logger plutôt que print
require_trailing_commas: true # lisibilité des arguments multi-lignes
prefer_const_constructors: true
prefer_const_declarations: true
prefer_final_locals: true
prefer_single_quotes: true # cohérence : guillemets simples partout
# --- Robustesse ---
always_use_package_imports: true # pas d'imports relatifs entre features
cancel_subscriptions: true
close_sinks: true
unawaited_futures: true
# --- Style Flutter ---
use_key_in_widget_constructors: true
sized_box_for_whitespace: true
prefer_const_constructors_in_immutables: true
+8
View File
@@ -131,6 +131,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.0" version: "1.17.0"
mocktail:
dependency: "direct dev"
description:
name: mocktail
sha256: "5e1bf53cc7baa8062a33b84424deb61513858ea05c601b8509e683815b5914aa"
url: "https://pub.dev"
source: hosted
version: "1.0.5"
path: path:
dependency: transitive dependency: transitive
description: description:
+1 -5
View File
@@ -37,12 +37,8 @@ dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0
mocktail: ^1.0.4
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
Executable
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# CI locale Storytime — à passer avant de cocher une étape dans ROADMAP.md.
# Échoue (exit non nul) dès qu'une vérification ne passe pas.
set -euo pipefail
cd "$(dirname "$0")/.."
command -v flutter >/dev/null 2>&1 || { echo "flutter absent du PATH"; exit 1; }
command -v dart >/dev/null 2>&1 || { echo "dart absent du PATH"; exit 1; }
echo "==> dart format"
dart format --set-exit-if-changed .
echo "==> flutter analyze"
flutter analyze
echo "==> flutter test"
flutter test
echo ""
echo "Tout est vert."