Skip to content

Refactor codepoint parsers to use updated CSS selectors and CDN links, cover by tests#921

Merged
egorikftp merged 1 commit into
mainfrom
task/css-parser
Mar 1, 2026
Merged

Refactor codepoint parsers to use updated CSS selectors and CDN links, cover by tests#921
egorikftp merged 1 commit into
mainfrom
task/css-parser

Conversation

@egorikftp

Copy link
Copy Markdown
Member

📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

@coderabbitai

coderabbitai Bot commented Mar 1, 2026

Copy link
Copy Markdown

Walkthrough

Codepoint 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately summarizes the main changes: refactoring codepoint parsers to use updated CSS selectors and CDN links, with test coverage added.
Description check ✅ Passed The pull request description references the linked issue (#919) and includes the changelog template with unchecked boxes, though no changelog updates were made.
Linked Issues check ✅ Passed All requirements from issue #919 are met: BootstrapCodepointParser now extends RegexCssCodepointParser [BootstrapCodepointParser.kt], BootstrapRepository fetches CSS instead of JSON [BootstrapRepository.kt], and comprehensive test coverage is added [BootstrapCodepointParserTest.kt].
Out of Scope Changes check ✅ Passed Additional improvements beyond the linked issue scope were made: CDN migration from UNPKG to jsDelivr for all icon providers [BootstrapRepository.kt, BoxIconsRepository.kt, LucideRepository.kt], regex pattern refinements for parsing accuracy [BoxCodepointParser.kt, LucideCodepointParser.kt, RemixCodepointParser.kt], test resource files added, and build.gradle.kts dependency updated for test support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task/css-parser

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e848dc7 and 6562218.

📒 Files selected for processing (18)
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParser.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
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParser.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxIconsRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParser.kt
  • 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/bootstrap/data/BootstrapCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParserTest.kt
  • tools/idea-plugin/src/test/resources/bootstrap-icons.min.css
  • tools/idea-plugin/src/test/resources/boxicons.min.css
  • tools/idea-plugin/src/test/resources/lucide.css
  • tools/idea-plugin/src/test/resources/remixicon.min.css

Comment thread tools/idea-plugin/src/test/resources/lucide.css

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6562218 and b115f49.

📒 Files selected for processing (18)
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/data/BootstrapCodepointParser.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
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParser.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxIconsRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParser.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideRepository.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParser.kt
  • 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/bootstrap/data/BootstrapCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/data/BoxCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/data/LucideCodepointParserTest.kt
  • tools/idea-plugin/src/test/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/remix/data/RemixCodepointParserTest.kt
  • tools/idea-plugin/src/test/resources/bootstrap-icons.min.css
  • tools/idea-plugin/src/test/resources/boxicons.min.css
  • tools/idea-plugin/src/test/resources/lucide.css
  • tools/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

Comment thread tools/idea-plugin/src/test/resources/boxicons.min.css
@egorikftp egorikftp merged commit 30af29b into main Mar 1, 2026
3 checks passed
@egorikftp egorikftp deleted the task/css-parser branch March 1, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Bootstrap codepoints to use CSS file

2 participants