Skip to content

chore: dev tooling — strict lints, git hooks, commitlint, contributing guide - #2

Open
shroominic wants to merge 1 commit into
mainfrom
chore/dev-tooling
Open

chore: dev tooling — strict lints, git hooks, commitlint, contributing guide#2
shroominic wants to merge 1 commit into
mainfrom
chore/dev-tooling

Conversation

@shroominic

Copy link
Copy Markdown
Owner

Production-grade local dev tooling for the OpenGlucose Flutter app. Tooling/config only — no app feature code touched.

What's added

Strict linting (openhealth/analysis_options.yaml)

  • Extends very_good_analysis (added to dev_dependencies; replaces bare flutter_lints).
  • public_member_api_docs disabled (this is an app, not a published package).
  • A handful of rules with pre-existing violations are baselined with inline comments and a follow-up note, so the strong set lands without a large, conflict-prone rewrite of feature code (most are auto-fixable via dart fix --apply).
  • flutter analyze is green.

Formatting

  • Standardized on dart format as the single source of truth; enforced by the pre-commit hook.

Git hooks via Lefthook (lefthook.yml)

  • pre-commit: dart format --set-exit-if-changed + flutter analyze on staged Dart files (scoped to openhealth/).
  • commit-msg: commitlint (Conventional Commits) via npx — no npm project needed.
  • pre-push: flutter test.

Commitlint (commitlint.config.mjs)

  • Conventional Commits with app/package-area scopes (app, ble, aidex, core, ui, ios, android, docs, deps, ci, repo).

Hook installer (no npm in a Flutter repo)

  • scripts/install-hooks.sh installs Lefthook (Homebrew / go install fallback) then lefthook install.
  • Makefile with make setup (install hooks) plus format, format-check, analyze, test, check.

Docs (CONTRIBUTING.md)

  • Setup, everyday commands, lint/format policy, hooks, and the commit convention.

Verification

  • flutter analyzeNo issues found.
  • dart format --output=none --set-exit-if-changed .clean.
  • flutter test17 passed (incl. widget tests; the suite was already meaningful, so no smoke test was needed).
  • Hooks verified firing: commit-msg rejected a non-conventional message and passed a valid one; a badly-formatted staged Dart file was caught by pre-commit; pre-push ran the test suite on push.

How to install the hooks

make setup          # or: ./scripts/install-hooks.sh

Requires Lefthook (auto-installed) and Node.js (for the commit-msg commitlint hook, run via npx).

…nt, contributing

Set up production-grade local dev tooling for the Flutter app:

- Lints: extend very_good_analysis (replaces bare flutter_lints) with a few
  pre-existing-violation rules baselined as documented follow-ups. analyze is
  green.
- Formatting: standardize on dart format (pre-commit enforced).
- Git hooks via Lefthook (lefthook.yml): pre-commit format+analyze on staged
  Dart, commit-msg commitlint (Conventional Commits), pre-push flutter test.
- commitlint.config.mjs with app/package-area scopes.
- scripts/install-hooks.sh + Makefile (make setup) to install hooks without npm.
- CONTRIBUTING.md documenting setup, commands, lint/format, hooks, commits.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant