Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe compound-name lint now exempts idiomatic EO naming patterns: names starting with Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 are two exceptions for idiomatic prefixes used in EO standard library: | ||
| the `as-` prefix for type conversions (such as `as-bytes`, `as-i64`, `as-number`) | ||
| and the `is-` prefix for boolean predicates (such as `is-empty`, `is-nan`, `is-finite`). |
There was a problem hiding this comment.
🚫 [vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'boolean'?
There was a problem hiding this comment.
Pull request overview
Updates the compound-name lint rule to allow idiomatic as- and is- prefixed names (common in EO stdlib), and documents/tests this exception.
Changes:
- Added an XSL exception for names starting with
as-andis-in the compound-name lint. - Added documentation describing the idiomatic prefix exceptions.
- Added a YAML regression test ensuring these idiomatic names do not trigger warnings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/test/resources/org/eolang/lints/packs/single/compound-name/allows-idiomatic-as-and-is-prefixes.yaml | Adds a test case asserting no warnings for as-* / is-* names. |
| src/main/resources/org/eolang/motives/names/compound-name.md | Documents the new idiomatic exceptions for compound names. |
| src/main/resources/org/eolang/lints/names/compound-name.xsl | Implements the idiomatic-prefix exemption in the lint rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <xsl:function name="eo:idiomatic" as="xs:boolean"> | ||
| <xsl:param name="name"/> | ||
| <xsl:sequence select="starts-with($name, 'as-') or starts-with($name, 'is-')"/> | ||
| </xsl:function> | ||
| <xsl:template match="/"> | ||
| <defects> | ||
| <xsl:for-each select="//o[@base and @name and not(eo:special(@name)) and eo:compound(@name)]"> | ||
| <xsl:for-each select="//o[@base and @name and not(eo:special(@name)) and eo:compound(@name) and not(eo:idiomatic(@name))]"> |
There was a problem hiding this comment.
The exemption is currently overly broad: any compound name starting with as- or is- bypasses the lint (e.g., as-very-long-compound-name), which undermines the rule and makes it easy to evade. Consider tightening eo:idiomatic($name) to only allow the intended idiomatic form (e.g., a single hyphen with a simple suffix via a regex like ^(as|is)-[a-z0-9]+$, or another clearly bounded pattern consistent with EO stdlib naming).
| sheets: | ||
| - /org/eolang/lints/names/compound-name.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=0] |
There was a problem hiding this comment.
This assertion only guarantees there are no warning defects; the test could still pass if the lint emits defects with a different severity (e.g., error). If the intent is to ensure no defects at all for these names, consider asserting count(defect)=0 (or explicitly covering all severities expected in this lint pack) to make the regression test more robust.
| - /defects[count(defect[@severity='warning'])=0] | |
| - /defects[count(defect)=0] |
| read file | ||
| ``` | ||
|
|
||
| There are exceptions for idiomatic prefixes and suffixes used in EO standard library: |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
|
@yegor256 Great work on your contribution! 🎉 You've earned +4 points (+16 base, -8 for missing code review, -4 for 35 hits-of-code). Your running score is now +39! Please keep the momentum going and don't forget to check your Zerocracy account. |
fixes #806
Summary by CodeRabbit
as-,is-, and suffix-of) and no longer flags them as violations.as-conversion,is-predicate, and-ofextractor naming patterns with examples.