|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `masked-edittext/` contains the library module. |
| 5 | + - Core masking and state: `src/main/java/com/github/pinball83/maskededittext` (e.g., `MaskFormatter.kt`, `InputStateMachine.kt`, `CursorPolicyController.kt`). |
| 6 | + - Jetpack Compose API: `src/main/java/com/github/pinball83/maskededittext/compose`. |
| 7 | + - Android resources: `src/main/res`. |
| 8 | +- `demo_app/` and `demo_app_compose/` are sample apps. Keep shared helpers in the library, not in demos. |
| 9 | +- Tests live beside code: JVM specs under `src/test`, Compose instrumentation under `src/androidTest`. Gradle scripts stay at module roots. |
| 10 | + |
| 11 | +## Build, Test & Development Commands |
| 12 | +- `./gradlew assembleRelease` builds the library AAR and validates release config. |
| 13 | +- `./gradlew :masked-edittext:publishToMavenLocal` exercises the publishing pipeline and produces a local snapshot for integration testing. |
| 14 | +- `./gradlew test` runs JVM + Robolectric suites across modules; execute before every push. |
| 15 | +- `./gradlew connectedAndroidTest` launches instrumentation and Compose UI tests on a device or emulator. |
| 16 | +- `./gradlew lint` runs Android Lint and Compose metrics; address findings or document accepted risk. |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | +- Kotlin is the default language; use 4-space indents, trailing commas where they improve diffs, and prefer expression-bodied functions when clear. |
| 20 | +- Classes, composables, and test fixtures use `PascalCase`; methods and variables use `camelCase`; constants stay in `CONSTANT_CASE`. |
| 21 | +- Compose API lives under the `compose/` package; shared mask logic stays in the root package. Keep any Java interop isolated and documented. |
| 22 | +- Run `./gradlew lint` before committing; avoid suppressing warnings unless a tracking issue exists. |
| 23 | + |
| 24 | +## Testing Guidelines |
| 25 | +- Use JUnit4 + Robolectric for mask behaviour; mirror production packages in `src/test` for clarity. |
| 26 | +- Compose UI assertions belong in `src/androidTest` with `createAndroidComposeRule` utilities. |
| 27 | +- Name tests as `functionUnderTest_state_expectedResult` to emphasise behaviour. |
| 28 | +- Prioritise coverage around mask configuration, cursor placement, locale handling, and accessibility announcements. |
| 29 | + |
| 30 | +## Refactoring Summary & Docs |
| 31 | +- Kotlin-first rewrite with Java interop preserved. |
| 32 | +- Unified mask core shared by View and Compose. |
| 33 | +- New Compose API with grouped options (`MaskedOptions`, `MaskedVisualOptions`, `MaskedInputOptions`). |
| 34 | +- Deprecated/no-op XML attributes kept for compatibility: `replacementChar`, `deleteChar`, `maskIconColor`. |
| 35 | +- See `MODERNIZATION.md`, `MODERNIZATION_SUMMARY.md`, and `API_REFACTORING_GUIDE.md` for details and migration guidance. |
| 36 | + |
| 37 | +## Commit & Pull Request Guidelines |
| 38 | +- Match concise, imperative history (`Update Kotlin version`, `Remove unused java code`); scope each commit to one concern. |
| 39 | +- PR descriptions should outline intent, list touched modules, and reference issues or Jira tickets when applicable. |
| 40 | +- Attach emulator logs or screenshots whenever UI or UX changes are visible. |
| 41 | +- Confirm `./gradlew lint test` passes locally and note the run in the PR summary before requesting review. |
0 commit comments