refactor: remove unnecessary inline modifiers and deprecated indented function#209
refactor: remove unnecessary inline modifiers and deprecated indented function#209rafaeltonholo wants to merge 1 commit intomainfrom
Conversation
… function Remove `inline` modifiers from functions that don't benefit from inlining, delete deprecated `String.indented()` in favor of `prependIndent()`, simplify `rootParent` lazy initialization loop, and clean up redundant `else` branch in `SvgElementNode.copy()`.
WalkthroughThis PR refactors indentation handling by replacing a custom Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/extensions/String.extension.kt (1)
38-38:⚠️ Potential issue | 🟡 Minor
prependIndent()indents every non-blank line, not just the first.Kotlin's stdlib
String.prependIndent(indent: String)prepends indentation to every non-blank line in a multi-line string. The previousindented()helper appears to have handled only the first line. This behavior difference will affect generated source formatting for multi-line fragments, includingPathDatablocks and gradient parameters already formatted before indentation.If behavior-preserving refactoring is required, define a first-line-only helper for those embed sites instead of replacing the semantics globally.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/extensions/String.extension.kt` at line 38, The change to String.prependIndent(indentSize: Int) altered behavior by using Kotlin's prependIndent which adds indentation to every non-blank line, but callers (e.g., places that previously used indented() or expected only the first line to be indented such as PathData and gradient parameter embedding) relied on first-line-only indentation; revert this global semantics by restoring the original first-line-only helper (or add a new function like prependIndentFirstLine or indentedFirstLine) and update call sites that truly need multi-line indentation to use the stdlib prependIndent, leaving functions that embed single-line fragments (reference String.prependIndent and the previous indented helper name) to call the first-line-only helper so generated source formatting remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/extensions/String.extension.kt`:
- Line 38: The change to String.prependIndent(indentSize: Int) altered behavior
by using Kotlin's prependIndent which adds indentation to every non-blank line,
but callers (e.g., places that previously used indented() or expected only the
first line to be indented such as PathData and gradient parameter embedding)
relied on first-line-only indentation; revert this global semantics by restoring
the original first-line-only helper (or add a new function like
prependIndentFirstLine or indentedFirstLine) and update call sites that truly
need multi-line indentation to use the stdlib prependIndent, leaving functions
that embed single-line fragments (reference String.prependIndent and the
previous indented helper name) to call the first-line-only helper so generated
source formatting remains unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 81cdbf99-63ab-48e6-9a04-4245a249804f
📒 Files selected for processing (9)
svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/ImageVectorNode.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/PathCommand.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/PathNodes.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/avg/AvgNode.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/compose/ComposeBrush.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/svg/SvgElementNode.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/xml/XmlNode.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/error/ExitProgramException.ktsvg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/extensions/String.extension.kt
💤 Files with no reviewable changes (1)
- svg-to-compose/src/commonMain/kotlin/dev/tonholo/s2c/domain/svg/SvgElementNode.kt
Summary by CodeRabbit
Refactor
Chores