diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index b5238cf854..083e814bc0 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -98,8 +98,7 @@ jobs: run: dart analyze --fatal-infos - name: Run dart format - # Ignore generated files manually until https://github.com/dart-lang/dart_style/issues/864 is resolved - run: dart format --set-exit-if-changed $(find lib -name '*.dart' -not \( -name 'generated_plugin_registrant.dart' -o -name '*.g.dart' -o -name '*.drift.dart' \)) + run: make format - name: Run dart custom_lint run: dart run custom_lint diff --git a/docs/docs/developer/pr-checklist.md b/docs/docs/developer/pr-checklist.md index 58581e669a..8fe3772b03 100644 --- a/docs/docs/developer/pr-checklist.md +++ b/docs/docs/developer/pr-checklist.md @@ -38,6 +38,19 @@ Run all server checks with `npm run check:all` You can use `npm run __:fix` to potentially correct some issues automatically for `npm run format` and `lint`. ::: +## Mobile Checks + +The following commands must be executed from within the mobile app directory of the codebase. + +- [ ] `make build` (auto-generate files using build_runner) +- [ ] `make analyze` (static analysis via Dart Analyzer and DCM) +- [ ] `make format` (formatting via Dart Formatter) +- [ ] `make test` (unit tests) + +:::info Auto Fix +You can use `dart fix --apply` and `dcm fix lib` to potentially correct some issues automatically for `make analyze`. +::: + ## OpenAPI The OpenAPI client libraries need to be regenerated whenever there are changes to the `immich-openapi-specs.json` file. Note that you should not modify this file directly as it is auto-generated. See [OpenAPI](/docs/developer/open-api.md) for more details. diff --git a/mobile/makefile b/mobile/makefile index fe259ca771..356649d5dd 100644 --- a/mobile/makefile +++ b/mobile/makefile @@ -1,4 +1,4 @@ -.PHONY: build watch create_app_icon create_splash build_release_android pigeon +.PHONY: build watch create_app_icon create_splash build_release_android pigeon test analyze format build: dart run build_runner build --delete-conflicting-outputs @@ -29,3 +29,14 @@ translation: dart run bin/generate_keys.dart dart format lib/generated/codegen_loader.g.dart dart format lib/generated/intl_keys.g.dart + +analyze: + dart analyze --fatal-infos + dcm analyze lib --fatal-style --fatal-warnings + +format: +# Ignore generated files manually until https://github.com/dart-lang/dart_style/issues/864 is resolved + dart format --set-exit-if-changed $$(find lib -name '*.dart' -not \( -name 'generated_plugin_registrant.dart' -o -name '*.g.dart' -o -name '*.drift.dart' \)) + +test: + flutter test