objectionary / objectionary/lints

test-with-comment flags any test when any comment exists anywhere in the document

Open
#1,375 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
14
Forks
39
Avg merge
22h 54m
Merged PRs (30d)
90

Description

Problem

test-with-comment flags any top-level test whenever any comment exists anywhere in the document — the relation between a comment and the test it documents is not checked at all.

Root cause

src/main/resources/org/eolang/lints/tests/test-with-comment.xsl:14:

<xsl:for-each select="/object/o[eo:test-name(@name) and /object/comments/comment]">

The second conjunct is a document-global existential check: if the document contains a comment (e.g. documenting an ordinary object app), every top-level test gets a defect "must have a comment".

Minimal example

+package x
+architect yegor@256.com
+version 0.0.1
+home https://github.com/objectionary
+spdx SPDX-FileCopyrightText: Copyright (c) 2026 Objectionary.com
+spdx SPDX-License-Identifier: MIT

# This is app.
[] > app
  x > @

[] > +can-add-test
  42 > @

+can-add-test is reported as missing a comment, even though the comment clearly documents app, not the test.

Expected behavior

A comment should be attributed to the object it precedes/belongs to (by position/line or by adjacency), and the lint should flag only tests that have no comment of their own.

Related

  • src/test/resources/org/eolang/lints/packs/single/test-with-comment/*.yaml — existing packs only cover the happy paths.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/main/resources/org/eolang/lints/tests/test-with-comment.xsl, especially the selection at line 14, and review the existing cases under src/test/resources/org/eolang/lints/packs/single/test-with-comment/. Add a regression case based on the reported example, then verify that only tests without their own comment are flagged and that the existing happy paths still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.