Avoid Heavily Nested Code. Break into steps and Return Early Nested code are harder to read and as a result you often forget to handle certain edge cases. Nested code also makes your code march to the right hand side of the editor, which make hard to read code even harder to read on a small screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Staging CI/CD | |
| on: | |
| pull_request: | |
| types: [synchronize, opened, reopened, ready_for_review] | |
| branches: [development, base-*, feature/*, chore/*, fix/*, bug/*, initiative/*, hotfix/*, dependabot/*] | |
| paths-ignore: | |
| - '.idea/**' | |
| - '.gitattributes' | |
| - '.github/**.json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Production CI/CD | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| types: [synchronize, opened, reopened, ready_for_review] | |
| branches: [master, development] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://www.briansnotes.io/books/ | |
| https://github.com/limkhashing/My-Notes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "CodeQL" | |
| run-name: "CodeQL scan on ${{ github.head_ref || github.ref_name }}" | |
| # For CodeQL scan, below are the optimal ways to do it | |
| # 1. Perform scan on weekly basis for master/main branch. Preferably on Monday | |
| # 2. Perform scan on each PR to master/main branch. | |
| # 3. If necessary, we can do scan for each push event in master/main branch. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Cleanup caches by a branch | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| jobs: | |
| clean-cache-on-last-closed-pr-in-a-branch: | |
| runs-on: ubuntu-latest | |
| steps: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Gradle submit dependency graph | |
| on: | |
| push: | |
| branches: [master] | |
| env: | |
| # Keystore Password | |
| SIGNING_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To get started with Dependabot version updates, you'll need to specify which | |
| # package ecosystems to update and where the package manifests are located. | |
| # Please see the documentation for all configuration options: | |
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | |
| version: 2 | |
| updates: | |
| - package-ecosystem: "gradle" # See documentation for possible values | |
| directory: "/" # Location of package manifests | |
| schedule: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Safely collects one-time events from a Flow while respecting lifecycle. | |
| * Events are consumed exactly once and not re-triggered on recomposition. | |
| * | |
| * This is the recommended pattern for handling navigation events, snackbars, | |
| * and other side effects that should only happen once. | |
| * | |
| * Uses Dispatchers.Main.immediate to ensure events are processed immediately | |
| * without an additional dispatch, which is important for navigation events. | |
| * |
-
Readable code means we just read the code like a book, without process alot of logic behind our brain.
- And rather understand rightaway what a piece of code does
-
Boolean expression should always keep in positive expression to minimize cognitive load
-
Comment the why, not the what.
- Don't add comment explaining what the code did, all you're doing is adding noise to the code
- Comments should be used only to explain the intent behind code that cannot be refactored to explain itself.
- Mostly used for providing additional context, i.e. answering the WHY not the WHAT.
OlderNewer