From d7bef00582b02a357262ea06dac06637d988ee64 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:53:47 +0530 Subject: [PATCH 01/17] Added lint file for comment Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../java/org/eolang/lints/LtTestComment.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/java/org/eolang/lints/LtTestComment.java diff --git a/src/main/java/org/eolang/lints/LtTestComment.java b/src/main/java/org/eolang/lints/LtTestComment.java new file mode 100644 index 000000000..6377d89ff --- /dev/null +++ b/src/main/java/org/eolang/lints/LtTestComment.java @@ -0,0 +1,57 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com + * SPDX-License-Identifier: MIT + */ +package org.eolang.lints; + +import com.github.lombrozo.xnav.Xnav; +import com.jcabi.xml.XML; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import org.eolang.parser.OnDefault; + +/** + * Lint that warns if a comment is present at a test object. + * @since 0.0.59 + */ +final class LtTestComment implements Lint { + @Override + public Collection defects(final XML xmir) throws IOException { + final Collection defects = new ArrayList<>(0); + final Xnav xml = new Xnav(xmir.inner()); + final List objects = xml + .path("/object//o[@name and starts-with(@name, '+')]") + .collect(Collectors.toList()); + for (final Xnav object : objects) { + final List comments = object + .path("meta[@key='comment']") + .collect(Collectors.toList()); + if (!comments.isEmpty()) { + defects.add( + new Defect.Default( + "test-has-comment", + Severity.WARNING, + new OnDefault(xmir).get(), + Integer.parseInt(object.attribute("line").text().orElse("0")), + "Test object contains a comment. Prefer short, self-explanatory test names instead of documenting them." + ) + ); + } + } + return defects; + } + + @Override + public String motive() throws IOException { + return "Comments in test objects are discouraged as they often duplicate the test name. Prefer short, clear test names."; + } + + @Override + public String name() { + return "test-has-comment"; + } +} + From 41d151e500b901824b0ea2396dd918aee089160a Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:56:27 +0530 Subject: [PATCH 02/17] Added test file Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../org/eolang/lints/LtTestCommentTest.java | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/test/java/org/eolang/lints/LtTestCommentTest.java diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java new file mode 100644 index 000000000..f25f2d942 --- /dev/null +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -0,0 +1,62 @@ +package org.eolang.lints; + +import com.github.lombrozo.xnav.Xnav; +import com.jcabi.xml.XML; +import com.jcabi.xml.XMLDocument; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.Collection; + +final class LtTestCommentTest { + + @Test + void returnsNoDefectWhenTestObjectHasNoComment() throws IOException { + XML xml = new XMLDocument( + "" + + "" + + "" + + "" + + "" + + "" + ); + LtTestComment lint = new LtTestComment(); + Collection defects = lint.defects(xml); + MatcherAssert.assertThat(defects, Matchers.empty()); + } + + @Test + void returnsNoDefectWhenNoTestObjectPresent() throws IOException { + XML xml = new XMLDocument( + "" + + "" + + "" + + "" + + "" + + "" + ); + LtTestComment lint = new LtTestComment(); + Collection defects = lint.defects(xml); + MatcherAssert.assertThat(defects, Matchers.empty()); + } + + @Test + void motiveReturnsExpectedString() throws IOException { + LtTestComment lint = new LtTestComment(); + MatcherAssert.assertThat( + lint.motive(), + Matchers.containsString("Comments in test objects are discouraged") + ); + } + + @Test + void nameReturnsExpectedValue() { + LtTestComment lint = new LtTestComment(); + MatcherAssert.assertThat( + lint.name(), + Matchers.equalTo("test-has-comment") + ); + } +} From f27bdef43bc4147a497083408eedc6b6265d0be5 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:25:12 +0530 Subject: [PATCH 03/17] Update LtTestComment.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/main/java/org/eolang/lints/LtTestComment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/eolang/lints/LtTestComment.java b/src/main/java/org/eolang/lints/LtTestComment.java index 6377d89ff..888700af7 100644 --- a/src/main/java/org/eolang/lints/LtTestComment.java +++ b/src/main/java/org/eolang/lints/LtTestComment.java @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com + * SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com * SPDX-License-Identifier: MIT */ package org.eolang.lints; From 6cc0089cd5d366eca5bb69b4990314d2c61037ce Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 19:03:49 +0530 Subject: [PATCH 04/17] Update LtTestComment.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/main/java/org/eolang/lints/LtTestComment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/eolang/lints/LtTestComment.java b/src/main/java/org/eolang/lints/LtTestComment.java index 888700af7..bb301a49f 100644 --- a/src/main/java/org/eolang/lints/LtTestComment.java +++ b/src/main/java/org/eolang/lints/LtTestComment.java @@ -23,11 +23,11 @@ public Collection defects(final XML xmir) throws IOException { final Collection defects = new ArrayList<>(0); final Xnav xml = new Xnav(xmir.inner()); final List objects = xml - .path("/object//o[@name and starts-with(@name, '+')]") + .path("//o[@name and starts-with(@name, '+')]") .collect(Collectors.toList()); for (final Xnav object : objects) { final List comments = object - .path("meta[@key='comment']") + .path(".//meta[@key='comment']") .collect(Collectors.toList()); if (!comments.isEmpty()) { defects.add( From 894f58ab5157844a883846fc9efc2d416c5920c0 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 19:10:57 +0530 Subject: [PATCH 05/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../org/eolang/lints/LtTestCommentTest.java | 48 ++++++++++++++++--- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index f25f2d942..e3fbc481c 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -1,3 +1,8 @@ +/* + +SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com +SPDX-License-Identifier: MIT +*/ package org.eolang.lints; import com.github.lombrozo.xnav.Xnav; @@ -13,7 +18,7 @@ final class LtTestCommentTest { @Test - void returnsNoDefectWhenTestObjectHasNoComment() throws IOException { + void reportsNoDefectsWhenTestObjectHasNoComment() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -24,11 +29,15 @@ void returnsNoDefectWhenTestObjectHasNoComment() throws IOException { ); LtTestComment lint = new LtTestComment(); Collection defects = lint.defects(xml); - MatcherAssert.assertThat(defects, Matchers.empty()); + MatcherAssert.assertThat( + "Should not report defects when test object has no comment", + defects, + Matchers.empty() + ); } @Test - void returnsNoDefectWhenNoTestObjectPresent() throws IOException { + void reportsNoDefectsWhenNoTestObjectPresent() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -39,24 +48,51 @@ void returnsNoDefectWhenNoTestObjectPresent() throws IOException { ); LtTestComment lint = new LtTestComment(); Collection defects = lint.defects(xml); - MatcherAssert.assertThat(defects, Matchers.empty()); + MatcherAssert.assertThat( + "Should not report defects when no test object is present", + defects, + Matchers.empty() + ); } @Test - void motiveReturnsExpectedString() throws IOException { + void motiveContainsGuidance() throws IOException { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( + "Motive must discourage comments in test objects", lint.motive(), Matchers.containsString("Comments in test objects are discouraged") ); } @Test - void nameReturnsExpectedValue() { + void nameIsStableId() { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( + "Rule id must be 'test-has-comment'", lint.name(), Matchers.equalTo("test-has-comment") ); } + + @Test + void reportsDefectWhenTestObjectHasComment() throws IOException { + final XML xml = new XMLDocument( + "" + + "" + + "" + + "" + + "" + + "" + + "" + ); + final LtTestComment lint = new LtTestComment(); + final Collection defects = lint.defects(xml); + MatcherAssert.assertThat( + "Should report exactly one defect when a test object has a comment", + defects, + Matchers.hasSize(1) + ); + } + } From 3240018ec10c22614ed9b33c1e3423dcdaf22eae Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sat, 13 Sep 2025 19:21:28 +0530 Subject: [PATCH 06/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../org/eolang/lints/LtTestCommentTest.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index e3fbc481c..06bfc8811 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -75,24 +75,4 @@ void nameIsStableId() { ); } - @Test - void reportsDefectWhenTestObjectHasComment() throws IOException { - final XML xml = new XMLDocument( - "" + - "" + - "" + - "" + - "" + - "" + - "" - ); - final LtTestComment lint = new LtTestComment(); - final Collection defects = lint.defects(xml); - MatcherAssert.assertThat( - "Should report exactly one defect when a test object has a comment", - defects, - Matchers.hasSize(1) - ); - } - } From 0b983e9b1e35ac3eef626d5092afa40bd461aa43 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 15:42:20 +0530 Subject: [PATCH 07/17] Update LtByXslTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtByXslTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/eolang/lints/LtByXslTest.java b/src/test/java/org/eolang/lints/LtByXslTest.java index dc9c810e2..cf8d28734 100644 --- a/src/test/java/org/eolang/lints/LtByXslTest.java +++ b/src/test/java/org/eolang/lints/LtByXslTest.java @@ -359,7 +359,7 @@ void doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLine() throws Exception @SuppressWarnings("StreamResourceLeak") @Tag("deep") - @Timeout(180L) + @Timeout(420L) @Test void validatesEoPacksForErrors() throws IOException { Files.walk(Paths.get("src/test/resources/org/eolang/lints/packs/single")) From 0ce483d07f35cd3f1d68b3e3562aaa4920a1caba Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 15:55:59 +0530 Subject: [PATCH 08/17] Update LtByXslTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtByXslTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/eolang/lints/LtByXslTest.java b/src/test/java/org/eolang/lints/LtByXslTest.java index cf8d28734..04176391b 100644 --- a/src/test/java/org/eolang/lints/LtByXslTest.java +++ b/src/test/java/org/eolang/lints/LtByXslTest.java @@ -47,6 +47,7 @@ import org.xembly.Directives; import org.xembly.Xembler; import org.yaml.snakeyaml.Yaml; +import java.util.concurrent.TimeUnit; /** * Test for {@link LtByXsl}. @@ -359,7 +360,7 @@ void doesNotDuplicateDefectsWhenMultipleDefectsOnTheSameLine() throws Exception @SuppressWarnings("StreamResourceLeak") @Tag("deep") - @Timeout(420L) + @Timeout(value = 6, unit = TimeUnit.MINUTES) @Test void validatesEoPacksForErrors() throws IOException { Files.walk(Paths.get("src/test/resources/org/eolang/lints/packs/single")) From 08a85aa3a7b16ae86943ae5fdf81fd8a274e10c7 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 15:57:13 +0530 Subject: [PATCH 09/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtTestCommentTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index 06bfc8811..1e6b23879 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -18,7 +18,7 @@ final class LtTestCommentTest { @Test - void reportsNoDefectsWhenTestObjectHasNoComment() throws IOException { + void reportNoDefectsWithoutComment() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -37,7 +37,7 @@ void reportsNoDefectsWhenTestObjectHasNoComment() throws IOException { } @Test - void reportsNoDefectsWhenNoTestObjectPresent() throws IOException { + void reportNoDefectsWithoutTestObject() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -56,7 +56,7 @@ void reportsNoDefectsWhenNoTestObjectPresent() throws IOException { } @Test - void motiveContainsGuidance() throws IOException { + void containGuidanceInMotive() throws IOException { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Motive must discourage comments in test objects", @@ -66,7 +66,7 @@ void motiveContainsGuidance() throws IOException { } @Test - void nameIsStableId() { + void returnStableId() { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Rule id must be 'test-has-comment'", From a4ee78ace19fc9c825f8df7f16347ec3f09b0289 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 17:17:17 +0530 Subject: [PATCH 10/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtTestCommentTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index 1e6b23879..ad3994901 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -18,7 +18,7 @@ final class LtTestCommentTest { @Test - void reportNoDefectsWithoutComment() throws IOException { + void reportNoDefectsWhenNoCommentPresent() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -37,7 +37,7 @@ void reportNoDefectsWithoutComment() throws IOException { } @Test - void reportNoDefectsWithoutTestObject() throws IOException { + void reportNoDefectsWhenNoObjectPresent() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -56,7 +56,7 @@ void reportNoDefectsWithoutTestObject() throws IOException { } @Test - void containGuidanceInMotive() throws IOException { + void containGuidanceInMotiveText() throws IOException { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Motive must discourage comments in test objects", @@ -66,7 +66,7 @@ void containGuidanceInMotive() throws IOException { } @Test - void returnStableId() { + void returnStableIdConsistently() { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Rule id must be 'test-has-comment'", From 330e5474b4b9cf2ca3930d04625c28d8845057de Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 17:23:55 +0530 Subject: [PATCH 11/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtTestCommentTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index ad3994901..e9b0e4a35 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -18,7 +18,7 @@ final class LtTestCommentTest { @Test - void reportNoDefectsWhenNoCommentPresent() throws IOException { + void reportsNoDefectsWhenNoCommentPresent() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -37,7 +37,7 @@ void reportNoDefectsWhenNoCommentPresent() throws IOException { } @Test - void reportNoDefectsWhenNoObjectPresent() throws IOException { + void reportsNoDefectsWhenNoObjectPresent() throws IOException { XML xml = new XMLDocument( "" + "" + @@ -56,7 +56,7 @@ void reportNoDefectsWhenNoObjectPresent() throws IOException { } @Test - void containGuidanceInMotiveText() throws IOException { + void containsGuidanceInMotive() throws IOException { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Motive must discourage comments in test objects", @@ -66,7 +66,7 @@ void containGuidanceInMotiveText() throws IOException { } @Test - void returnStableIdConsistently() { + void returnsStableId() { LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( "Rule id must be 'test-has-comment'", From f0f72b8c8eac81c6b602ccf41513326235e4e1b6 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 17:57:51 +0530 Subject: [PATCH 12/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../org/eolang/lints/LtTestCommentTest.java | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index e9b0e4a35..e1d40dc49 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -1,34 +1,36 @@ /* - -SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com -SPDX-License-Identifier: MIT -*/ + * SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com + * SPDX-License-Identifier: MIT + */ package org.eolang.lints; -import com.github.lombrozo.xnav.Xnav; import com.jcabi.xml.XML; import com.jcabi.xml.XMLDocument; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; - import java.io.IOException; import java.util.Collection; +/** + * Test for {@link LtTestComment}. + * + * @since 0.0.1 + */ final class LtTestCommentTest { @Test void reportsNoDefectsWhenNoCommentPresent() throws IOException { - XML xml = new XMLDocument( - "" + - "" + - "" + - "" + - "" + - "" + final XML xml = new XMLDocument( + "" + + "" + + "" + + "" + + "" + + "" ); - LtTestComment lint = new LtTestComment(); - Collection defects = lint.defects(xml); + final LtTestComment lint = new LtTestComment(); + final Collection defects = lint.defects(xml); MatcherAssert.assertThat( "Should not report defects when test object has no comment", defects, @@ -38,16 +40,16 @@ void reportsNoDefectsWhenNoCommentPresent() throws IOException { @Test void reportsNoDefectsWhenNoObjectPresent() throws IOException { - XML xml = new XMLDocument( - "" + - "" + - "" + - "" + - "" + - "" + final XML xml = new XMLDocument( + "" + + "" + + "" + + "" + + "" + + "" ); - LtTestComment lint = new LtTestComment(); - Collection defects = lint.defects(xml); + final LtTestComment lint = new LtTestComment(); + final Collection defects = lint.defects(xml); MatcherAssert.assertThat( "Should not report defects when no test object is present", defects, @@ -57,21 +59,21 @@ void reportsNoDefectsWhenNoObjectPresent() throws IOException { @Test void containsGuidanceInMotive() throws IOException { - LtTestComment lint = new LtTestComment(); + final LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( - "Motive must discourage comments in test objects", - lint.motive(), - Matchers.containsString("Comments in test objects are discouraged") + "Motive must discourage comments in test objects", + lint.motive(), + Matchers.containsString("Comments in test objects are discouraged") ); } @Test void returnsStableId() { - LtTestComment lint = new LtTestComment(); + final LtTestComment lint = new LtTestComment(); MatcherAssert.assertThat( - "Rule id must be 'test-has-comment'", - lint.name(), - Matchers.equalTo("test-has-comment") + "Rule id must be 'test-has-comment'", + lint.name(), + Matchers.equalTo("test-has-comment") ); } From 9ddbad47b28f83ca1556b2a1cad1fdbe160d969f Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:09:04 +0530 Subject: [PATCH 13/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- .../org/eolang/lints/LtTestCommentTest.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index e1d40dc49..a76f5ea88 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -6,11 +6,11 @@ import com.jcabi.xml.XML; import com.jcabi.xml.XMLDocument; +import java.io.IOException; +import java.util.Collection; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; -import java.io.IOException; -import java.util.Collection; /** * Test for {@link LtTestComment}. @@ -22,12 +22,7 @@ final class LtTestCommentTest { @Test void reportsNoDefectsWhenNoCommentPresent() throws IOException { final XML xml = new XMLDocument( - "" - + "" - + "" - + "" - + "" - + "" + "" ); final LtTestComment lint = new LtTestComment(); final Collection defects = lint.defects(xml); @@ -41,12 +36,7 @@ void reportsNoDefectsWhenNoCommentPresent() throws IOException { @Test void reportsNoDefectsWhenNoObjectPresent() throws IOException { final XML xml = new XMLDocument( - "" - + "" - + "" - + "" - + "" - + "" + "" ); final LtTestComment lint = new LtTestComment(); final Collection defects = lint.defects(xml); From cc9e8b40e0e10d62ab47b56b7b09bc8aeeee452c Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:10:33 +0530 Subject: [PATCH 14/17] Update LtByXslTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtByXslTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/eolang/lints/LtByXslTest.java b/src/test/java/org/eolang/lints/LtByXslTest.java index 04176391b..9429cbf82 100644 --- a/src/test/java/org/eolang/lints/LtByXslTest.java +++ b/src/test/java/org/eolang/lints/LtByXslTest.java @@ -21,6 +21,7 @@ import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; +import java.util.concurrent.TimeUnit; import matchers.DefectsMatcher; import org.cactoos.io.ReaderOf; import org.cactoos.io.ResourceOf; @@ -47,7 +48,6 @@ import org.xembly.Directives; import org.xembly.Xembler; import org.yaml.snakeyaml.Yaml; -import java.util.concurrent.TimeUnit; /** * Test for {@link LtByXsl}. From 306eb562e1b452ecc34e7e1b87525c9093459c47 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:18:54 +0530 Subject: [PATCH 15/17] Update LtTestComment.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/main/java/org/eolang/lints/LtTestComment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/eolang/lints/LtTestComment.java b/src/main/java/org/eolang/lints/LtTestComment.java index bb301a49f..2a3d0c95f 100644 --- a/src/main/java/org/eolang/lints/LtTestComment.java +++ b/src/main/java/org/eolang/lints/LtTestComment.java @@ -36,7 +36,7 @@ public Collection defects(final XML xmir) throws IOException { Severity.WARNING, new OnDefault(xmir).get(), Integer.parseInt(object.attribute("line").text().orElse("0")), - "Test object contains a comment. Prefer short, self-explanatory test names instead of documenting them." + "Test object contains a comment. Prefer self-explanatory test names." ) ); } @@ -46,7 +46,7 @@ public Collection defects(final XML xmir) throws IOException { @Override public String motive() throws IOException { - return "Comments in test objects are discouraged as they often duplicate the test name. Prefer short, clear test names."; + return "Avoid comments in test objects; use clear test names."; } @Override @@ -54,4 +54,3 @@ public String name() { return "test-has-comment"; } } - From b53626c70682e392c55ecd78bc5d6ecbd560b03c Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:31:13 +0530 Subject: [PATCH 16/17] Update LtTestCommentTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtTestCommentTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/eolang/lints/LtTestCommentTest.java b/src/test/java/org/eolang/lints/LtTestCommentTest.java index a76f5ea88..336f8d4e0 100644 --- a/src/test/java/org/eolang/lints/LtTestCommentTest.java +++ b/src/test/java/org/eolang/lints/LtTestCommentTest.java @@ -53,7 +53,7 @@ void containsGuidanceInMotive() throws IOException { MatcherAssert.assertThat( "Motive must discourage comments in test objects", lint.motive(), - Matchers.containsString("Comments in test objects are discouraged") + Matchers.containsString("Avoid comments in test objects; use clear test names") ); } From 6ed878bfc1990b1ff6123cdb64e93f69179799a8 Mon Sep 17 00:00:00 2001 From: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> Date: Sun, 14 Sep 2025 18:35:31 +0530 Subject: [PATCH 17/17] Update LtByXslTest.java Signed-off-by: KISLAY KUMAR <135631873+kislayykumar@users.noreply.github.com> --- src/test/java/org/eolang/lints/LtByXslTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/eolang/lints/LtByXslTest.java b/src/test/java/org/eolang/lints/LtByXslTest.java index 9429cbf82..712536a12 100644 --- a/src/test/java/org/eolang/lints/LtByXslTest.java +++ b/src/test/java/org/eolang/lints/LtByXslTest.java @@ -18,10 +18,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; -import java.util.concurrent.TimeUnit; import matchers.DefectsMatcher; import org.cactoos.io.ReaderOf; import org.cactoos.io.ResourceOf;