From cb3d48732714f9abab3f62ac6b43c7828d798506 Mon Sep 17 00:00:00 2001 From: Rinat Date: Wed, 22 Apr 2026 17:43:30 +0500 Subject: [PATCH 1/2] #805 Ignore @todo and @fixme markers in comment-not-capitalized lint The lint previously flagged any comment that didn't begin with an uppercase letter, including conventional tracker markers such as `@todo` and `@fixme`. These markers are structural, not prose, so they should be exempt. Extend the XSL predicate to skip comments matching `^@(todo|fixme)\b` (case-insensitive). The `\b` word boundary prevents accidental exemption of words like `@todolist`. Add three pack tests: - `allows-todo-marker`: standard `# @todo #NNN:NNmin ...` form - `allows-fixme-marker`: `@fixme` variant - `allows-todo-case-insensitive`: `@TODO` uppercase variant Update the motive doc with an example. Co-Authored-By: Claude Sonnet 4.6 --- .../eolang/lints/comments/comment-not-capitalized.xsl | 2 +- .../motives/comments/comment-not-capitalized.md | 9 +++++++++ .../comment-not-capitalized/allows-fixme-marker.yaml | 11 +++++++++++ .../allows-todo-case-insensitive.yaml | 11 +++++++++++ .../comment-not-capitalized/allows-todo-marker.yaml | 11 +++++++++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-fixme-marker.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-case-insensitive.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-marker.yaml diff --git a/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl b/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl index 822b6afd1..53849a2d5 100644 --- a/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl +++ b/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl @@ -10,7 +10,7 @@ - + diff --git a/src/main/resources/org/eolang/motives/comments/comment-not-capitalized.md b/src/main/resources/org/eolang/motives/comments/comment-not-capitalized.md index 5c81d4c54..40a2ffab6 100644 --- a/src/main/resources/org/eolang/motives/comments/comment-not-capitalized.md +++ b/src/main/resources/org/eolang/motives/comments/comment-not-capitalized.md @@ -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 > @ +``` diff --git a/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-fixme-marker.yaml b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-fixme-marker.yaml new file mode 100644 index 000000000..aa3dd0fee --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-fixme-marker.yaml @@ -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 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-case-insensitive.yaml b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-case-insensitive.yaml new file mode 100644 index 000000000..85af68476 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-case-insensitive.yaml @@ -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 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-marker.yaml b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-marker.yaml new file mode 100644 index 000000000..96508ec1a --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/comment-not-capitalized/allows-todo-marker.yaml @@ -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 > @ From c44a95c6aaa636a178a7de205f58f872ef62dd2c Mon Sep 17 00:00:00 2001 From: Rinat Date: Mon, 27 Apr 2026 11:26:37 +0500 Subject: [PATCH 2/2] #805 Fix XPath-incompatible \b in comment-not-capitalized regex Saxon's XPath 2.0 regex engine does not support \b (word boundary). Replace with [^A-Z]\$ (with the i flag) which matches the same semantics: the marker must be followed by a non-letter or be at end of string, so '@todofoo' still triggers the lint while '@todo bar' and '@TODO #1234' do not. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../org/eolang/lints/comments/comment-not-capitalized.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl b/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl index 53849a2d5..7b218c496 100644 --- a/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl +++ b/src/main/resources/org/eolang/lints/comments/comment-not-capitalized.xsl @@ -10,7 +10,7 @@ - +