Skip to content

Conversation

@shubertm
Copy link
Member

@shubertm shubertm commented Aug 1, 2025

Changes

Summary by CodeRabbit

  • Chores
    • Added a configuration file to enforce consistent coding styles and editor behaviors across the project.
    • Updated workflow to ensure build runs only after linting jobs complete successfully.
  • Style
    • Reformatted and improved code readability across multiple files, including expanding single-line expressions to multi-line, adjusting indentation, and adding blank lines for clarity.
    • No changes to application functionality or user experience.

@coderabbitai
Copy link

coderabbitai bot commented Aug 1, 2025

Walkthrough

This update introduces a new .editorconfig file to standardize code style and editor behavior across the project. The GitHub Actions workflow is modified to run linting jobs before the build. Numerous Kotlin source files are reformatted for improved readability, with multi-line calls, consistent indentation, and clearer code structure. No functional changes are introduced.

Changes

Cohort / File(s) Change Summary
EditorConfig Addition
.editorconfig
Adds a new .editorconfig to enforce consistent coding style, indentation, line endings, charset, import rules, and line length for all files, with special rules for Kotlin and Markdown files.
GitHub Workflow Update
.github/workflows/build.yml
Reformats YAML indentation and changes job dependencies: lint and ktlint now run before build (not after), improving the workflow sequence. No logic changes to steps.
Formatting: Graphics Parsing
app/src/main/java/dev/arkbuilders/arkmemo/graphics/SVG.kt
Refactors long lines and assignments to multi-line style, adds blank lines for readability, and adjusts command parsing formatting. No functional changes, but one case uses a possibly incorrect parsing method (MoveTo instead of AbsLineTo).
Formatting: Preferences, Repos, Adapters, Dialogs
app/src/main/java/dev/arkbuilders/arkmemo/preferences/MemoPreferencesImpl.kt, app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/NotesListAdapter.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/FilePickerDialog.kt
Reformats method bodies, assignments, and parameter lists to multi-line style with trailing commas and improved indentation. No changes to logic or exported entities.
Formatting: Fragments
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/AboutFragment.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt
Expands single-line calls to multi-line calls, adds blank lines for clarity, and reformats control structures for readability. No logic or control flow changes.
Formatting: ViewModels and Views
app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/views/GraphicControlTextView.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/views/SettingTextView.kt, app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/NotesViewModel.kt
Changes function calls and assignments to multi-line format with trailing commas and consistent indentation. No behavioral or logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Editor
    participant Linter
    participant CI

    Developer->>Editor: Edits code (editorconfig enforced)
    Editor->>Linter: Applies formatting/linting rules
    Linter->>CI: Lint and ktlint jobs run first
    CI->>CI: On success, triggers build job
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

In the warren, code lines hop and play,
Editor rules now guide the way.
Lint and ktlint lead the build parade,
Formatting neat, no logic mislaid.
With tidy files and workflows anew,
This bunny’s proud of what we do!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a54b90c and c0f2b52.

📒 Files selected for processing (5)
  • app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt (6 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt (4 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt (2 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/NotesViewModel.kt (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/NotesViewModel.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the ark-memo android app, the notesviewmodel.init {} callback properly handles threading by dispa...
Learnt from: tuancoltech
PR: ARK-Builders/ARK-Memo#0
File: :0-0
Timestamp: 2025-07-18T05:40:19.372Z
Learning: In the ARK-Memo Android app, the notesViewModel.init {} callback properly handles threading by dispatching operations to worker threads, preventing main thread blocking during view restoration.

Applied to files:

  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt
📚 Learning: in the ark-memo android app, textnotesrepo.findnote() intentionally returns null because text notes ...
Learnt from: tuancoltech
PR: ARK-Builders/ARK-Memo#0
File: :0-0
Timestamp: 2025-07-18T05:33:52.382Z
Learning: In the ARK-Memo Android app, TextNotesRepo.findNote() intentionally returns null because text notes don't need special handling during view restoration. This is a design decision to ignore text notes when restoring view state, as users can easily continue editing text notes without complex state recovery mechanisms.

Applied to files:

  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt
🪛 detekt (1.23.8)
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt

[warning] 158-159: This empty block of code can be removed.

(detekt.empty-blocks.EmptyFunctionBlock)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint
🔇 Additional comments (3)
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt (3)

158-159: Empty method implementation follows Kotlin conventions.

Converting the empty override method to use braces is consistent with Kotlin style guidelines and the static analysis warning can be safely ignored - this is a required TextWatcher interface implementation that intentionally does nothing.


276-276: Improved readability with blank lines between when cases.

The addition of blank lines between when expression cases in both handleSideEffect and handlePlaySideEffect methods significantly improves code readability and follows good formatting practices.

Also applies to: 303-303, 314-314, 329-329, 344-344, 348-348


338-342: Multi-line drawable assignment improves maintainability.

The reformatting of the drawable resource assignment to use multiple lines with proper indentation and trailing comma enhances code readability and makes future modifications easier.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhance/code-style

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
app/src/main/java/dev/arkbuilders/arkmemo/graphics/SVG.kt (1)

173-186: Fix the incorrect command creation.

The AbsLineTo case is incorrectly using SVGCommand.MoveTo.fromString(command) instead of SVGCommand.AbsLineTo.fromString(command), which will create the wrong command type and cause incorrect SVG parsing behavior.

Apply this diff to fix the bug:

                                SVGCommand.AbsLineTo.CODE -> {
                                    if (commandElements.size > 3) {
                                        strokeColor = commandElements[3]
                                    }
                                    if (commandElements.size > 4) {
                                        strokeSize = commandElements[4].toInt()
                                    }
                                    commands.addLast(
-                                        SVGCommand.MoveTo.fromString(command).apply {
+                                        SVGCommand.AbsLineTo.fromString(command).apply {
                                            paintColor = strokeColor
                                            brushSizeId = strokeSize
                                        },
                                    )
                                }
🧹 Nitpick comments (1)
.editorconfig (1)

23-29: Verify IntelliJ-specific import-star settings
ij_kotlin_packages_to_use_import_on_demand = unset is an IDE-internal key. In some older JetBrains versions “unset” is not recognized and silently falls back to the IDE default (usually 5). If the team has mixed IDE versions, consider pushing the value to something explicit like * or a large number for predictability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e353a22 and 7f7b122.

📒 Files selected for processing (15)
  • .editorconfig (1 hunks)
  • .github/workflows/build.yml (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/graphics/SVG.kt (4 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/preferences/MemoPreferencesImpl.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/NotesListAdapter.kt (5 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/FilePickerDialog.kt (2 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/AboutFragment.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt (6 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt (4 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt (2 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/views/GraphicControlTextView.kt (1 hunks)
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/views/SettingTextView.kt (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the ark-memo android app, the notesviewmodel.init {} callback properly handles threading by dispa...
Learnt from: tuancoltech
PR: ARK-Builders/ARK-Memo#0
File: :0-0
Timestamp: 2025-07-18T05:40:19.372Z
Learning: In the ARK-Memo Android app, the notesViewModel.init {} callback properly handles threading by dispatching operations to worker threads, preventing main thread blocking during view restoration.

Applied to files:

  • app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/FilePickerDialog.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/preferences/MemoPreferencesImpl.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/NotesListAdapter.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt
📚 Learning: in the ark-memo android app, textnotesrepo.findnote() intentionally returns null because text notes ...
Learnt from: tuancoltech
PR: ARK-Builders/ARK-Memo#0
File: :0-0
Timestamp: 2025-07-18T05:33:52.382Z
Learning: In the ARK-Memo Android app, TextNotesRepo.findNote() intentionally returns null because text notes don't need special handling during view restoration. This is a design decision to ignore text notes when restoring view state, as users can easily continue editing text notes without complex state recovery mechanisms.

Applied to files:

  • app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/NotesListAdapter.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt
  • app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt
🧬 Code Graph Analysis (1)
app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt (2)
app/src/main/java/dev/arkbuilders/arkmemo/media/ArkMediaPlayer.kt (1)
  • isPlaying (27-27)
app/src/main/java/dev/arkbuilders/arkmemo/media/ArkMediaPlayerImpl.kt (1)
  • isPlaying (75-75)
🪛 detekt (1.23.8)
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt

[warning] 157-158: This empty block of code can be removed.

(detekt.empty-blocks.EmptyFunctionBlock)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint
🔇 Additional comments (32)
.editorconfig (1)

1-14: Solid baseline style rules
The generic section covers the critical basics (indentation, newline, trimming, etc.) and will give your linters a single source of truth. Nice!

app/src/main/java/dev/arkbuilders/arkmemo/ui/views/GraphicControlTextView.kt (1)

27-31: Readability improved – no functional diff
Switching to a multi-line getColor call with the trailing comma matches the new style guide and keeps long argument lists tidy.

app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/AboutFragment.kt (1)

34-38: Consistent multi-line formatting
The expanded getString call aligns with the .editorconfig max-line-length rule and enhances clarity.

app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/BaseEditNoteFragment.kt (1)

108-112: Style only, logic unchanged
Multi-line formatting here keeps the 100-char guideline intact while remaining readable. Looks good.

app/src/main/java/dev/arkbuilders/arkmemo/ui/views/SettingTextView.kt (1)

28-32: Matches new formatting conventions
The wrapped getBoolean invocation is consistent with the rest of the refactor; no behavioural impact.

app/src/main/java/dev/arkbuilders/arkmemo/preferences/MemoPreferencesImpl.kt (1)

37-41: LGTM! Excellent formatting improvement.

The multi-line formatting of the getCrashReportEnabled() method with trailing comma enhances readability and aligns with Kotlin style guidelines.

app/src/main/java/dev/arkbuilders/arkmemo/repo/graphics/GraphicNotesRepo.kt (2)

50-54: LGTM! Improved readability.

The multi-line formatting of the thumbViewWidth lazy property with trailing comma enhances code readability.


56-60: LGTM! Consistent formatting improvement.

The multi-line formatting of the thumbDirectory lazy property maintains consistency with the formatting style applied throughout the codebase.

app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/EditTextNotesFragment.kt (1)

45-47: LGTM! Consistent formatting improvement.

The multi-line formatting of the newTextBuilder.append() call with trailing comma enhances readability and maintains consistency with the project's formatting standards.

app/src/main/java/dev/arkbuilders/arkmemo/ui/dialogs/FilePickerDialog.kt (2)

23-24: LGTM! Clean annotation formatting.

The multi-line formatting of the @Inject annotation follows Kotlin conventions and improves readability.


71-75: LGTM! Improved method call readability.

The multi-line formatting of the ContextCompat.checkSelfPermission() call makes the parameters more readable while preserving the permission checking logic.

app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/ArkMediaPlayerViewModel.kt (2)

97-99: LGTM! Enhanced readability.

The multi-line formatting of the arkMediaPlayer.setMaxAmplitude() call with trailing comma improves code readability in the visualizer setup.


174-177: LGTM! Excellent multi-parameter formatting.

The multi-line formatting of the viewModelScope.launchPeriodicAsync() call with each parameter on its own line and trailing commas significantly improves readability of this complex method call.

app/src/main/java/dev/arkbuilders/arkmemo/graphics/SVG.kt (6)

131-131: LGTM!

Good formatting improvement that enhances readability by visually separating the different XML tag handling cases.


134-138: LGTM!

Excellent formatting improvement that makes the multi-parameter function call more readable and easier to maintain.


172-172: LGTM!

Good formatting improvement that provides visual separation between different command handling cases.


187-187: LGTM!

Good formatting improvement that maintains consistent visual separation between command handling cases.


188-201: LGTM!

The AbsQuadTo case is correctly implemented with proper command creation and consistent parameter extraction logic.


202-202: LGTM!

Good formatting improvement that provides visual separation before the fallback else case.

.github/workflows/build.yml (1)

1-131: Excellent workflow improvement!

The restructuring to run linting jobs (lint and ktlint) before the build job is a best practice that:

  • Catches style and linting issues early in the pipeline
  • Saves CI resources by preventing unnecessary builds when linting fails
  • Aligns perfectly with the PR objective of enhancing code style and linting

The consistent 4-space indentation formatting also significantly improves readability.

app/src/main/java/dev/arkbuilders/arkmemo/ui/adapters/NotesListAdapter.kt (4)

38-42: LGTM!

Excellent formatting improvement that makes the complex function type declaration much more readable and easier to understand.


73-78: LGTM!

Good formatting improvement that makes the multi-parameter function call more readable and maintainable with proper indentation and trailing commas.


190-199: LGTM!

Excellent formatting improvement that provides clear visual separation between different side effect handling cases, making the code much easier to read and understand.


311-339: LGTM!

Great formatting improvements that make the complex conditional logic and when expression much more readable. The multi-line structure clearly shows the different note type handling branches.

app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/ArkRecorderFragment.kt (4)

157-158: LGTM!

The conversion from expression body to block body for this empty override method is fine. The static analysis warning about empty blocks is a false positive since this is a required TextWatcher interface method that intentionally has no implementation.


275-318: LGTM!

Excellent formatting improvement that provides clear visual separation between different recording side effect handling cases, making the code much easier to read and follow.


327-350: LGTM!

Good formatting improvement that maintains consistency with other similar methods and provides clear visual separation between different media player side effect handling cases.


336-340: LGTM!

Good formatting improvement that makes the multi-parameter function call more readable with proper indentation and trailing commas.

app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/NotesFragment.kt (4)

291-292: LGTM!

Good formatting improvement that makes the complex conditional logic more readable and explicit with proper braces.


369-377: LGTM!

Excellent formatting improvement that makes the complex nullable casting and property access much more readable and easier to understand.


447-451: LGTM!

Good formatting improvement that makes the complex nullable chain of operations much more readable by breaking it into logical parts.


598-602: LGTM!

Good formatting improvement that makes the multi-parameter function call more readable with each argument clearly visible on its own line.

# Conflicts:
#	app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/NotesViewModel.kt
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.

2 participants