Skip to content

feat(#1271): run Java lints from YAML packs via lint key - #1277

Merged
rultor merged 5 commits into
objectionary:masterfrom
VasilevNStas:fix/issue-1271-lint-packs
Sep 3, 2026
Merged

rultor merged 5 commits into
objectionary:masterfrom
VasilevNStas:fix/issue-1271-lint-packs

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

fix #1271

What

Adds support for running Java-implemented lints from the same YAML pack
format that XSL lints use, instead of requiring a bespoke Lt*Test.java
class per lint.

A pack can now reference a lint by name:

lint: ascii-only
asserts:
  - /defects[count(defect[@severity='warning'])=1]
document: |
  <object author="tests">
    <comments>
      <comment line="1">привет</comment>
    </comments>
  </object>

How

  • New XtLint (a Xtory): reads the lint: key from the pack YAML,
    resolves the lint via PkMono, runs defects(XML) and serializes the
    result into the <defects> document. It plugs into the existing
    Xsline/XtoryMatcher/DefectsMatcher machinery by returning a
    Shift that produces the defects, so XtDefects (the defects: N
    shorthand) and all existing assertions work unchanged.
  • LtByXslTest:
    • new testsAllLintsByLintName parameterized test runs packs with a
      lint: key;
    • testsAllLintsByEo and checksLocationsOfYamlPacks skip such packs
      (they have no sheets/XSL counterpart).

Demo packs

The following Java lints are now covered declaratively:

  • ascii-only — catches-cyrillic-comment
  • reserved-name — allows-custom-name
  • incorrect-unlint — catches-unknown-lint
  • syntax-version — catches-newer-syntax, allows-older-syntax

This is the pattern @volodya-lombrozo proposed for LtSyntaxVersion and
friends, so future Java lints (and the existing ones) can drop their
hand-written JUnit boilerplate.

Both mvn test (1011 tests) and mvn clean install -Pqulice pass.

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 @volodya-lombrozo plz review

Comment thread src/test/java/org/eolang/lints/LtByXslTest.java Outdated
Comment thread src/test/java/org/eolang/lints/LtByXslTest.java Outdated
Comment thread src/test/java/org/eolang/lints/XtLint.java Outdated
@VasilevNStas
VasilevNStas force-pushed the fix/issue-1271-lint-packs branch from 182e372 to e02c670 Compare August 30, 2026 20:27
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@volodya-lombrozo
re-review plz

@volodya-lombrozo

Copy link
Copy Markdown
Member

@rultor merge

@rultor

rultor commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@rultor merge

@volodya-lombrozo OK, I'll try to merge now. You can check the progress of the merge here.

@rultor
rultor merged commit 728ae50 into objectionary:master Sep 3, 2026
24 checks passed
@rultor

rultor commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@rultor merge

@volodya-lombrozo Done! FYI, the full log is here (took me 4min).

@0crat

0crat commented Sep 9, 2026

Copy link
Copy Markdown

@VasilevNStas Thanks for the contribution! You've earned +12 points for this: +16 as a basis; -4 for too many hits-of-code (247 >= 100). Please, keep them coming. Your running score is +638; don't forget to check your Zerocracy account too).

@0crat

0crat commented Sep 17, 2026

Copy link
Copy Markdown

@volodya-lombrozo Thanks for the review! You've earned +7 points for this: +12 as a basis; -5 for very few (5) comments. Your running score is +410; don't forget to check your Zerocracy account too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YAML fixtures limited to XSL-based lints, leading to unnecessary JUnit classes for Java-implemented lints

4 participants