From db85bf9ae17971643c105a14f7f94e5d25acaec2 Mon Sep 17 00:00:00 2001 From: VasilevNStas Date: Wed, 12 Aug 2026 16:12:23 +0300 Subject: [PATCH 1/2] feat(#748): add test-with-comment lint --- .../eolang/lints/tests/test-with-comment.xsl | 33 +++++++++++++++++++ .../eolang/motives/tests/test-with-comment.md | 24 ++++++++++++++ .../allows-test-without-comment.yaml | 10 ++++++ .../catches-test-with-comment.yaml | 12 +++++++ 4 files changed, 79 insertions(+) create mode 100644 src/main/resources/org/eolang/lints/tests/test-with-comment.xsl create mode 100644 src/main/resources/org/eolang/motives/tests/test-with-comment.md create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-with-comment/catches-test-with-comment.yaml diff --git a/src/main/resources/org/eolang/lints/tests/test-with-comment.xsl b/src/main/resources/org/eolang/lints/tests/test-with-comment.xsl new file mode 100644 index 000000000..5790304fd --- /dev/null +++ b/src/main/resources/org/eolang/lints/tests/test-with-comment.xsl @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + warning + The test object + + has a comment, which duplicates its name. Make the name self-explanatory and remove the comment + + + + + diff --git a/src/main/resources/org/eolang/motives/tests/test-with-comment.md b/src/main/resources/org/eolang/motives/tests/test-with-comment.md new file mode 100644 index 000000000..05b337c88 --- /dev/null +++ b/src/main/resources/org/eolang/motives/tests/test-with-comment.md @@ -0,0 +1,24 @@ +# Test with comment + +A test object must not have a comment before it. A comment usually just +duplicates the test name: if the test is named `checks-the-app`, a comment +like "This test checks the app" adds nothing. Instead of documenting a +test, make its name short and self-explanatory. + +Incorrect: + +```eo +# This test checks the app. + +[] +> checks-the-app + 42 > @ +``` + +Correct: + +```eo +[] +> checks-the-app + 42 > @ +``` + +The name says it all; the comment is redundant. diff --git a/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml new file mode 100644 index 000000000..23d07a929 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml @@ -0,0 +1,10 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-with-comment.xsl +asserts: + - /defects[count(defect[@severity='warning'])=0] +input: | + [] +> checks-the-app + 42 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/test-with-comment/catches-test-with-comment.yaml b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/catches-test-with-comment.yaml new file mode 100644 index 000000000..f3e35eecb --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/catches-test-with-comment.yaml @@ -0,0 +1,12 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-with-comment.xsl +asserts: + - /defects[count(defect[@severity='warning'])=1] +input: | + # This test checks the app. + + [] +> checks-the-app + 42 > @ From 29e881c14bd58641bf42ef9445a6f6bca90be704 Mon Sep 17 00:00:00 2001 From: VasilevNStas Date: Wed, 12 Aug 2026 16:26:20 +0300 Subject: [PATCH 2/2] fix(#748): nested test in allows pack to avoid R-6.5.3 --- .../test-with-comment/allows-test-without-comment.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml index 23d07a929..7b4572752 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-with-comment/allows-test-without-comment.yaml @@ -6,5 +6,7 @@ sheets: asserts: - /defects[count(defect[@severity='warning'])=0] input: | - [] +> checks-the-app - 42 > @ + [] > foo + + [] +> checks-the-app + 42 > @