From 89c6280a78e460a57da9edaf15d8ecec23e63691 Mon Sep 17 00:00:00 2001 From: Kaaveh Mohamedi Date: Sun, 5 Jan 2025 10:01:20 +0330 Subject: [PATCH 1/3] fix some typo README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 99c62e58..4004b3ba 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,25 @@ This repo is a playground about best practices, using updated libraries and solutions in the Android world! -Check the apk [from here](asset/app_v1.0.0.apk) +Check the app apk [from here](asset/app_v1.0.0.apk) ## ⚙️ Architecture ![Architecture diagram](asset/architecture.jpg) -The main architecture of code based on MVI + CLEAN architecture. The division criteria is a hybrid strategy based on Feature + Layer by module. -For the detail of architecture, please read [this article](https://medium.com/@kaaveh/migrate-from-mvvm-to-mvi-f938c27c214f). +The main architecture of the code is based on MVI + CLEAN architecture. The division criteria is a hybrid strategy based on Feature + Layer by module. +For the details of architecture, please read [this article](https://medium.com/@kaaveh/migrate-from-mvvm-to-mvi-f938c27c214f). ## Wear OS -This project includes a WearOS module designed for Android-based smartwatches like the Galaxy Watch. The `app-watch` module contains `app`, `designsystem`, `navigation`, and `ui` submodules. You can build the `app-watch:app` to have wearOS version of the application. +This project includes a WearOS module for Android-based smartwatches like the Galaxy Watch. The `app-watch` module contains `app`, `designsystem`, `navigation`, and `ui` submodules. You can build the `app-watch:app` to have a wearOS version of the application. ## 🚦 Navigation -For the detail of navigation implementations, please read [this article](https://proandroiddev.com/all-about-navigation-in-the-jetpack-compose-based-production-code-base-902706b8466d). +For the details of navigation implementations, please read [this article](https://proandroiddev.com/all-about-navigation-in-the-jetpack-compose-based-production-code-base-902706b8466d). ## 📱 Previewing -For the detail of handling preview of composable functions in this code-base, please read [this article](https://proandroiddev.com/an-introduction-about-preview-in-jetpack-compose-b72a96daac35). +For the details of handling the preview of composable functions in this code-base, please read [this article](https://proandroiddev.com/an-introduction-about-preview-in-jetpack-compose-b72a96daac35). ## 🛠 Technologies @@ -39,13 +39,13 @@ For the detail of handling preview of composable functions in this code-base, pl - Support large screens - Support WearOS devices - Monochromatic app icon -- Version catalog & Convention Plugin (For the detail, please read [this article](https://proandroiddev.com/mastering-android-dependency-management-b94205595f6b)) +- Version catalog & Convention Plugin (For the details, please read [this article](https://proandroiddev.com/mastering-android-dependency-management-b94205595f6b)) - CI - Git Hooks - GitHub Actions - Static Analysis(Kotlinter, Detekt) (For the detail, please read [this article](https://blog.kotlin-academy.com/detekt-gradle-configuration-guide-d6d2301b823a)) -### We are porting the project to KMP. Here's the steps: +### We are porting the project to KMP. Here are the steps: - [x] GSON → Kotlinx Serialization - [x] ROOM → SQLDelight - [x] Retrofit → Ktor @@ -71,17 +71,17 @@ For the detail of handling preview of composable functions in this code-base, pl ![](asset/large_screen.jpg) -### WearOS devises (Android based smart watches) +### WearOS devices (Android-based smartwatches) ![Wear OS screenshots](asset/wearos.jpg) ## Additional Resources -- [Git Hooks](documentation/GitHooks.md) - Learn about Git hooks used in this project for code formatting and analysis. +- [Git Hooks](documentation/GitHooks.md) - Learn about Git Hooks used in this project for code formatting and analysis. - [GitHub Actions](documentation/GitHubActions.md) - Explore the GitHub Actions workflows used to validate the code. - [Static Analysis](documentation/StaticAnalysis.md) - Discover how static analysis tools like Detekt and Ktlint are used in this project for code quality assurance. ## 🤝🏻 Contribute -Any PRs are very welcome! 😍 You can fix a bug, add a feature, optimize performance and even propose a new cool approach in code-base architecture. Feel free and make a PR! 😌 +Any PRs are very welcome! 😍 You can fix a bug, add a feature, optimize performance, and even propose a new cool approach in code-base architecture. Feel free to make a PR! 😌 We use static analysis tools like Detekt and Ktlint in this project. Please either set up [Git Hooks](documentation/GitHooks.md) on your project or run [Static Analysis](documentation/StaticAnalysis.md) before creating PR. From 849c347d89ac3dac773dab7803603970964be2ad Mon Sep 17 00:00:00 2001 From: Kaaveh Mohamedi Date: Sun, 5 Jan 2025 10:18:51 +0330 Subject: [PATCH 2/3] fix grammar issue in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4004b3ba..ca0dc0c5 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,6 @@ For the details of handling the preview of composable functions in this code-ba ## 🤝🏻 Contribute -Any PRs are very welcome! 😍 You can fix a bug, add a feature, optimize performance, and even propose a new cool approach in code-base architecture. Feel free to make a PR! 😌 +Any PRs are very welcome! 😍 You can fix a bug, add a feature, optimize performance, and propose a new cool approach in code-base architecture. Feel free to make a PR! 😌 We use static analysis tools like Detekt and Ktlint in this project. Please either set up [Git Hooks](documentation/GitHooks.md) on your project or run [Static Analysis](documentation/StaticAnalysis.md) before creating PR. From b62a00e4400138601665a0ed09a673862841eff1 Mon Sep 17 00:00:00 2001 From: Kaaveh Mohamedi Date: Sun, 5 Jan 2025 10:25:31 +0330 Subject: [PATCH 3/3] Update GitHooks.md according to latest setup --- documentation/GitHooks.md | 54 +++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/documentation/GitHooks.md b/documentation/GitHooks.md index 7427f2d7..62671edb 100644 --- a/documentation/GitHooks.md +++ b/documentation/GitHooks.md @@ -1,11 +1,55 @@ # Git Hooks -This project has some Git hooks included inside the [git-hooks](/git-hooks) folder. These hooks can be installed automatically via the [setup.sh](/git-hooks/setup.sh) (just windows machine currently, support others OS comming soon). +This project has some Git hooks included inside the [git-hooks](/git-hooks) folder. -## Pre-Commit +## **Usage Instructions** -There is a [pre-commit](/git-hooks/pre-commit) hook that will automatically run Ktlint formatting over any modified Kotlin files. This way you can just commit your code and trust that formatting happens behind the scenes, without having to consciously worry about it. +1. **Install Git Hooks**: + - Run the `clean` task to automatically install or update hooks: + ```bash + ./gradlew clean + ``` -## Pre-Push +2. **Commit-Msg Hook**: + - Ensures commit messages include an issue number (e.g., `#123` or `[ #123 ]`). + - Blocks commits with invalid messages. -There is a [pre-push](/git-hooks/pre-push) hook that will run static analysis checks before any code is pushed up to the remote repository. This way, if you have any code smells, you can be alerted right away without waiting for the GitHub Actions to fail. +--- + +## **Examples** + +### Valid Commit Messages: +- `Fix login issue #123` +- `[ #456 ] Refactor module` + +### Invalid Commit Messages: +- `Fix login issue` _(No issue number)._ +- `Updated README 123` _(Missing `#` prefix)._ + +## **Why These settings?** + +1. **Improving Traceability**: + - The `commit-msg` hook enforces commit message standards, making it easier to link commits to specific issues. + +2. **Automating Hook Installation**: + - Integrating hook installation with the `clean` task reduces manual steps and ensures hooks are always up-to-date. + +--- + +## **Directory Structure** + +```plaintext +project-root/ +├── .git/ +│ ├── hooks/ +│ ├── pre-commit +│ ├── pre-push +│ ├── commit-msg +├── build.gradle.kts +├── git-hooks/ +│ ├── pre-commit-unix.sh +│ ├── pre-commit-windows.sh +│ ├── pre-push-unix.sh +│ ├── pre-push-windows.sh +│ ├── commit-msg-unix.sh +│ ├── commit-msg-windows.sh