objectionary / objectionary/lints

test-word reports false positives for names containing the substring 'test'

Open Beginner friendly
#1,376 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-word reports a defect for names that merely contain the substring "test" (latest, contest, attest, protester), even though the rule is about the word "test".

Root cause

src/main/resources/org/eolang/lints/tests/test-word.xsl:15:

<xsl:for-each select="//o[@name and not(@name='φ') and matches(@name, 'test', 'i') and not(generate-id() = generate-id($top))]">

matches(@name, 'test', 'i') is a substring search, not a word-boundary match. Verified against real EO: a legitimate test named +can-use-latest is flagged with "must not contain the word 'test'".

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

[] > main
  [] > +can-use-latest
    42 > @

+can-use-latest contains the substring "test" inside "latest" and is wrongly reported.

Expected behavior

Match the word "test" at token boundaries, e.g. matches(@name, '(^|-)test(-|$)', 'i') (or \btest\b), so that latest/contest/protester are allowed.

Related

  • tests/bad-test-name.xsl — sibling rule that uses eo:test-name() and per-kind prefixes.
  • Existing packs under packs/single/test-word/ use can-test-add / tests-helper and miss the false-positive case.

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-word.xsl:15 and inspect the existing cases under packs/single/test-word/. Add a regression case for names such as can-use-latest while preserving detection of the standalone word "test", then run the test-word pack to verify both outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.