From 057dc6ceb5e0d56cb4b1d39009a4c1d5631c8fce Mon Sep 17 00:00:00 2001 From: volodya-lombrozo Date: Mon, 13 Jan 2025 15:57:04 +0300 Subject: [PATCH] feat(#946): fix all the code offences --- .../directives/DirectivesMetas.java | 8 ++++---- .../jeo/representation/xmir/JcabiXmlNode.java | 16 +++++++++------- .../representation/XmirRepresentationTest.java | 11 ++++------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/eolang/jeo/representation/directives/DirectivesMetas.java b/src/main/java/org/eolang/jeo/representation/directives/DirectivesMetas.java index d672c2c3c..0ee812546 100644 --- a/src/main/java/org/eolang/jeo/representation/directives/DirectivesMetas.java +++ b/src/main/java/org/eolang/jeo/representation/directives/DirectivesMetas.java @@ -55,8 +55,8 @@ public Iterator iterator() { if (!this.name.pckg().isEmpty()) { result.append(this.pckg()); } - result.append(this.unlint()); - result.append(this.version()); + result.append(DirectivesMetas.unlint()); + result.append(DirectivesMetas.version()); return result.up().iterator(); } @@ -90,7 +90,7 @@ private Directives pckg() { * The version directives of jeo-maven-plugin. * @return Version directives. */ - private Directives version() { + private static Directives version() { return new Directives() .add("meta") .add("head").set("version").up() @@ -102,7 +102,7 @@ private Directives version() { * Ignored XMIR checks. * @return Directives for ignored checks. */ - private Directives unlint() { + private static Directives unlint() { return new Directives() .add("meta") .add("head").set("unlint").up() diff --git a/src/main/java/org/eolang/jeo/representation/xmir/JcabiXmlNode.java b/src/main/java/org/eolang/jeo/representation/xmir/JcabiXmlNode.java index 88ebc43c7..caba83eda 100644 --- a/src/main/java/org/eolang/jeo/representation/xmir/JcabiXmlNode.java +++ b/src/main/java/org/eolang/jeo/representation/xmir/JcabiXmlNode.java @@ -157,13 +157,15 @@ public boolean hasAttribute(final String name, final String value) { @Override public void validate() { - final Collection ignore = new HashSet<>(Arrays.asList( - "mandatory-home", - "name-outside-of-abstract-object", - "empty-object", - "incorrect-package", - "object-does-not-match-filename" - )); + final Collection ignore = new HashSet<>( + Arrays.asList( + "mandatory-home", + "name-outside-of-abstract-object", + "empty-object", + "incorrect-package", + "object-does-not-match-filename" + ) + ); final Collection defects = new Program(new StrictXmir(this.doc)) .defects() .stream() diff --git a/src/test/java/org/eolang/jeo/representation/XmirRepresentationTest.java b/src/test/java/org/eolang/jeo/representation/XmirRepresentationTest.java index 03f30e139..638e5ba21 100644 --- a/src/test/java/org/eolang/jeo/representation/XmirRepresentationTest.java +++ b/src/test/java/org/eolang/jeo/representation/XmirRepresentationTest.java @@ -25,7 +25,6 @@ import com.jcabi.log.Logger; import com.jcabi.matchers.XhtmlMatchers; -import com.jcabi.xml.XML; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -62,13 +61,11 @@ final class XmirRepresentationTest { void retrievesName() { final String name = "Math"; final String expected = "j$org/j$eolang/j$foo/j$Math"; - final XML xml = new BytecodeProgram( - "org/eolang/foo", - new BytecodeClass(name) - ).xml(); - System.out.println(xml); final String actual = new XmirRepresentation( - xml + new BytecodeProgram( + "org/eolang/foo", + new BytecodeClass(name) + ).xml() ).name(); MatcherAssert.assertThat( String.format(