Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<xsl:template match="/">
<xsl:variable name="min" select="32"/>
<defects>
<xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]'))]">
<xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]')) and not(matches(., '^@(todo|fixme)\b', 'i'))]">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for XPath regex word-boundary escapes in XSL files and for `@todolist` boundary coverage.

# Expect: no remaining '\b' in XSL regex patterns after the fix.
rg -n -C2 '\\b' -g '*.xsl'

# Expect: a negative fixture asserting `@todolist` still produces a warning.
rg -n -C3 '@todolist|todolist' src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized

Repository: objectionary/lints

Length of output: 725


🌐 Web query:

In XPath/XSLT fn:matches regular expression syntax, is \b a supported word-boundary escape without Saxon’s Java-regex ;j flag?

💡 Result:

No, the \b word-boundary escape is not supported in the standard XPath/XSLT fn:matches regular expression syntax. The XPath regex dialect, based on XML Schema regex with extensions, does not include \b as a predefined escape sequence for word boundaries. Multiple sources confirm \b is invalid and causes errors in standard mode (e.g., MarkLogic throws "Invalid regular expression"; StackOverflow notes "\b isn't available in XPath"). Saxon provides \b support only as an extension when using the non-standard ;j flag to switch to Java regex engine.

Citations:


Replace \b with an XPath-compatible expression.

Line 13 uses \b in a regex pattern, but the word-boundary escape is not supported in standard XPath/XSLT fn:matches syntax. This will raise a regex error at runtime instead of producing lint results. Replace with an expression that explicitly checks for end-of-string or non-word characters to preserve the exemption behavior for @todolist.

Proposed fix
-      <xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]')) and not(matches(., '^@(todo|fixme)\b', 'i'))]">
+      <xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]')) and not(matches(., '^@(todo|fixme)($|[^A-Za-z0-9_])', 'i'))]">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]')) and not(matches(., '^@(todo|fixme)\b', 'i'))]">
<xsl:for-each select="/object/comments/comment[not(matches(., '^[A-Z]')) and not(matches(., '^@(todo|fixme)($|[^A-Za-z0-9_])', 'i'))]">
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl` at
line 13, The regex uses \b which XPath/XSLT fn:matches doesn't support; update
the predicate in the xsl:for-each (the fn:matches call) to avoid \b by
explicitly matching end-of-string or a non-word character — replace
"^@(todo|fixme)\b" with "^@(todo|fixme)($|[^A-Za-z0-9_])" (keep the 'i' flag) so
the exemption for `@todo/`@fixme still works without using \b.

<xsl:element name="defect">
<xsl:variable name="line" select="eo:lineno(@line)"/>
<xsl:attribute name="line">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ Correct:
[] > foo
42 > @
```

Comments that begin with a tracker marker such as `@todo` or `@fixme`
(case-insensitive) are exempt from this rule:

```eo
# @todo #123:30min Add validation for negative input.
[] > foo
42 > @
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
- /org/eolang/lints/comments/comment-not-capitalized.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
# @fixme this needs revisiting once the parser supports X.
[] > foo
42 > @
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
- /org/eolang/lints/comments/comment-not-capitalized.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
# @TODO #999:30min uppercase marker is also accepted.
[] > foo
42 > @
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
- /org/eolang/lints/comments/comment-not-capitalized.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
# @todo #4475:35min Enable this feature after resize is implemented.
[] > foo
42 > @
Loading