Refactor codepoint parsers to use updated CSS selectors and CDN links, cover by tests#921
Conversation
WalkthroughCodepoint parsing was moved from JSON to CSS regex parsing: Bootstrap now extends RegexCssCodepointParser and no longer requires Json injection; BoxIcons, Lucide, and Remix parsers have tightened regexes. Package repositories (Bootstrap, BoxIcons, Lucide) switched CDN base from UNPKG to jsDelivr and updated related URLs. A test dependency was added to tools/idea-plugin/build.gradle.kts. Four unit tests and corresponding CSS test resources (bootstrap-icons.min.css, boxicons.min.css, lucide.css, remixicon.min.css) were added to validate parsing. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapRepository.kt`:
- Around line 19-22: The CDN_BASE constant uses the mutable "@latest" tag
causing nondeterministic imports; update CDN_BASE (and thus FONT_URL, CSS_URL,
ICONS_BASE_URL which derive from it) to use a pinned Bootstrap Icons version
(e.g., "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1") so the URLs become
immutable and reproducible; ensure you update the CDN_BASE string constant and
keep the existing FONT_URL, CSS_URL and ICONS_BASE_URL references unchanged so
they resolve to the pinned version.
In `@tools/idea-plugin/src/test/resources/lucide.css`:
- Around line 2-3: The CSS violates Stylelint: remove the unnecessary quotes in
the font-family declaration (change "lucide" to lucide), add a generic-family
fallback (e.g., lucide, sans-serif) to the font-family list, normalize the
comment spacing by adding a space after the /* in the src comment (/* IE9 */),
and make the same font-family/fallback change on the other occurrence referenced
(line 12); locate the font-family declaration(s) and the src comment in the
resource and update them accordingly.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
tools/idea-plugin/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/di/BootstrapModule.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxIconsRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixRepository.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParserTest.kttools/idea-plugin/src/test/resources/bootstrap-icons.min.csstools/idea-plugin/src/test/resources/boxicons.min.csstools/idea-plugin/src/test/resources/lucide.csstools/idea-plugin/src/test/resources/remixicon.min.css
6562218 to
b115f49
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kt (1)
7-7: Prefer a slightly more tolerant Lucide regex.The current pattern is stricter than necessary (
content:exact form + mandatory semicolon), which makes parsing fragile to harmless CSS formatting changes.♻️ Suggested regex adjustment
- Regex("""\.icon-([a-z0-9-]+)::before\s*\{\s*content:\s*"\\([a-fA-F0-9]+)";\s*}"""), + Regex("""\.icon-([a-z0-9-]+)::before\s*\{\s*content\s*:\s*"\\([A-Fa-f0-9]+)"\s*;?\s*}"""),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kt` at line 7, The regex in LucideCodepointParser that currently uses Regex("""\.icon-([a-z0-9-]+)::before\s*\{\s*content:\s*"\\([a-fA-F0-9]+)";\s*\}""") is too strict and should be made tolerant to harmless CSS variations; update that Regex in LucideCodepointParser to allow optional whitespace around the colon, accept either single or double quotes around the codepoint, make the trailing semicolon optional, and tolerate extra whitespace (e.g., use a pattern that matches content\s*:\s*['"]\\([A-Fa-f0-9]+)['"]\s*;?). Ensure you modify the Regex literal referenced in LucideCodepointParser so it still captures the icon name group and the hex codepoint group.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tools/idea-plugin/src/test/resources/boxicons.min.css`:
- Line 1: The upstream minified CSS fixture (contains `@font-face` and many .bx /
bxs / bxl rules) is being flagged by Stylelint; either update the lint config to
exclude this fixture path from stylelint checks, or add an in-file suppression
at the top of the fixture (for example a single-line "stylelint-disable" block)
to silence rules for the whole file; locate the fixture by looking for the
`@font-face` declaration and the .bx selector block near the top and apply one of
these two fixes so CI no longer fails on this vendored minified content.
---
Nitpick comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kt`:
- Line 7: The regex in LucideCodepointParser that currently uses
Regex("""\.icon-([a-z0-9-]+)::before\s*\{\s*content:\s*"\\([a-fA-F0-9]+)";\s*\}""")
is too strict and should be made tolerant to harmless CSS variations; update
that Regex in LucideCodepointParser to allow optional whitespace around the
colon, accept either single or double quotes around the codepoint, make the
trailing semicolon optional, and tolerate extra whitespace (e.g., use a pattern
that matches content\s*:\s*['"]\\([A-Fa-f0-9]+)['"]\s*;?). Ensure you modify the
Regex literal referenced in LucideCodepointParser so it still captures the icon
name group and the hex codepoint group.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
tools/idea-plugin/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/di/BootstrapModule.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxIconsRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParser.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixRepository.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParserTest.kttools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParserTest.kttools/idea-plugin/src/test/resources/bootstrap-icons.min.csstools/idea-plugin/src/test/resources/boxicons.min.csstools/idea-plugin/src/test/resources/lucide.csstools/idea-plugin/src/test/resources/remixicon.min.css
✅ Files skipped from review due to trivial changes (1)
- tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParserTest.kt
🚧 Files skipped from review as they are similar to previous changes (4)
- tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixRepository.kt
- tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParserTest.kt
- tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapRepository.kt
- tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/di/BootstrapModule.kt
📝 Changelog
If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs: