#554: catch unused motive files via test#863
Merged
yegor256 merged 3 commits intoobjectionary:masterfrom May 8, 2026
Merged
Conversation
… a lint Add MotivesAreUsedTest, which walks every .md under src/main/resources/org/eolang/motives/ and fails if its filename (without .md) is not the name() of a lint produced by PkMono. Fails on master with the orphan motive files that objectionary#554 calls out.
…lint motive - Rename motives/errors/lt-incorrect-unlint.md to incorrect-unlint.md to match the lint name returned by LtIncorrectUnlint.name(), and update LtIncorrectUnlint.motive() to load the renamed resource. - Delete motive files that no lint in PkMono references: the empty units/unit-test-missing.md and units/unit-test-without-live-file.md leftovers, and the documented-but-unimplemented motives for same-line-names, noname-attribute, signed-binding-indexes, architect-duplicate, correct-package-meta, zero-version, one-high-level-object, test-object-is-not-verb-in-singular, and object-does-not-match-filename. - Drop the .vale.ini override for the deleted same-line-names motive. After this change, MotivesAreUsedTest passes against master.
jtcop expects each test class to have a same-named production class (RuleEveryTestHasProductionClass) and present-tense test names (RulePresentTense). Fold the new motive-coverage assertion into PkMonoTest as linksEveryMotiveFileToALint() and drop the standalone MotivesAreUsedTest.
af8c43e to
c5f32da
Compare
|
@bibonix Thanks for the contribution! You've earned +12 points for this: +16 as a basis, +0.05 points per hit-of-code (capped at +16), and -4 for exceeding 100 hits-of-code (258 >= 100). Please keep them coming while being mindful of contribution size. Your running score is +198; don't forget to check your Zerocracy account too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@yegor256 this PR addresses #554 by adding
PkMonoTest#linksEveryMotiveFileToALint, which walks every.mdundersrc/main/resources/org/eolang/motives/and asserts that the filename (without.md) is thename()of a lint produced byPkMono. Without this guard, motive files can drift from real lints — exactly what #554 calls out formotives/critical/same-line-names.md.Summary of changes
MotivesAreUsedTest); it fails onmasterlisting 11 orphan motive names (architect-duplicate,correct-package-meta,lt-incorrect-unlint,noname-attribute,object-does-not-match-filename,one-high-level-object,same-line-names,signed-binding-indexes,test-object-is-not-verb-in-singular,unit-test-without-live-file,zero-version).motives/errors/lt-incorrect-unlint.md→motives/errors/incorrect-unlint.md, sinceLtIncorrectUnlint.name()isincorrect-unlint; updateLtIncorrectUnlint.motive()to load the renamed resource.units/unit-test-missing.mdandunits/unit-test-without-live-file.mdleftovers from93e7006,critical/same-line-names.md,errors/noname-attribute.md,errors/signed-binding-indexes.md,metas/architect-duplicate.md,metas/correct-package-meta.md,metas/zero-version.md,misc/one-high-level-object.md,names/object-does-not-match-filename.md,misc/test-object-is-not-verb-in-singular.md(the disabledLtTestNotVerbper the @todo inPkMono.java),.vale.inioverride for the now-deletedsame-line-names.md.PkMonoTestso jtcop'sRuleEveryTestHasProductionClassandRulePresentTenseare happy (linksEveryMotiveFileToALint).Test plan
mvn -Dtest='PkMonoTest#linksEveryMotiveFileToALint' testpasses against this branch.mvn -Pqulice -DskipTests installis green locally — no qulice violations.MotivesAreUsedTestagainstmaster(before commit 2) lists the 11 orphan names from the bug.LtIncorrectUnlintTest,LtAsciiOnlyTest,LintTest,WithoutLintsTest,MonoLintNamesTestcontinue to pass after the rename.LtIncorrectUnlint.motive()references the renamed motive path.CI status note
The
mvn (ubuntu-24.04, macos-15, windows-2022),deep, andreservedjobs fail on this PR withMonoLintsTest.lintsProgramCorrectlyandPkByXslTest.doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLinetiming out at 45s — both pre-existing onmaster(#769) and on every PR (e.g. #862 was merged with the same matrix red), so they are not introduced by this change.ortalso reports failure here for reasons I can't pinpoint from the action's truncated output (the action exits 2 minutes in withProcess completed with exit code 1, no annotation text); the.ort.ymlexcludes are unchanged andreuse,qulice,vale,markdown-lint,pdd,xcop,typos,actionlint,yamllint,bashate,shellcheck,copyrights,labelerare all green. Happy to investigate further if you can share the run log.