From 7df261e046f42f8bdf7d29cedd359adcd4b484bb Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:25:00 +0300 Subject: [PATCH 01/23] add cmd dir --- .../tagrelease/command/package-info.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/io/github/artemget/tagrelease/command/package-info.java diff --git a/src/main/java/io/github/artemget/tagrelease/command/package-info.java b/src/main/java/io/github/artemget/tagrelease/command/package-info.java new file mode 100644 index 0000000..1f3f12e --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/command/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Commands directory. + */ +package io.github.artemget.tagrelease.command; From f08b74d74f7643e52273e545d99757ede6568ffc Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:25:42 +0300 Subject: [PATCH 02/23] add cmd dir --- .../tagrelease/domain/package-info.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/io/github/artemget/tagrelease/domain/package-info.java diff --git a/src/main/java/io/github/artemget/tagrelease/domain/package-info.java b/src/main/java/io/github/artemget/tagrelease/domain/package-info.java new file mode 100644 index 0000000..e60804e --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/domain/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Domain directory. + */ +package io.github.artemget.tagrelease.domain; From 062013edba7db0def047e065418247190e3376b5 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:26:16 +0300 Subject: [PATCH 03/23] add entry dir --- .../tagrelease/entry/package-info.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/io/github/artemget/tagrelease/entry/package-info.java diff --git a/src/main/java/io/github/artemget/tagrelease/entry/package-info.java b/src/main/java/io/github/artemget/tagrelease/entry/package-info.java new file mode 100644 index 0000000..96b6892 --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/entry/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Entry directory. + */ +package io.github.artemget.tagrelease.entry; From 52f3852d6ae836a8a0d0fd9d41866c7195337cce Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:29:01 +0300 Subject: [PATCH 04/23] add match dir --- .../tagrelease/match/package-info.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/io/github/artemget/tagrelease/match/package-info.java diff --git a/src/main/java/io/github/artemget/tagrelease/match/package-info.java b/src/main/java/io/github/artemget/tagrelease/match/package-info.java new file mode 100644 index 0000000..47a911d --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/match/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Match directory. + */ +package io.github.artemget.tagrelease.match; From e0c842273723fcc6b2cd9cc1de621338078d52eb Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:38:39 +0300 Subject: [PATCH 05/23] add docs to service --- .../artemget/tagrelease/domain/Service.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Service.java b/src/main/java/io/github/artemget/tagrelease/domain/Service.java index 073e11b..8512715 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Service.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Service.java @@ -26,10 +26,31 @@ import org.cactoos.Scalar; +/** + * Application's source code in git. + * + * @since 0.1.0 + */ public interface Service { + /** + * Returns application name. + * + * @return Name + */ String name(); + /** + * Returns application's tag. + * + * @return + */ String tag(); - Service tagged(Scalar tag); + /** + * Builds new tag. + * + * @param tag Build by rule + * @return Service with a new tag + */ + Service tagged(final Scalar tag); } From ed5d30aadc6207f5ea8e742edbf20c66356acd9e Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:43:32 +0300 Subject: [PATCH 06/23] add tag exception --- .../tagrelease/exception/TagException.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/main/java/io/github/artemget/tagrelease/exception/TagException.java diff --git a/src/main/java/io/github/artemget/tagrelease/exception/TagException.java b/src/main/java/io/github/artemget/tagrelease/exception/TagException.java new file mode 100644 index 0000000..3ba1d89 --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/exception/TagException.java @@ -0,0 +1,49 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package io.github.artemget.tagrelease.exception; + +import java.io.Serial; + +/** + * Throws at build/get tag. + * + * @since 0.1.0 + */ +public class TagException extends Exception { + @Serial + private static final long serialVersionUID = 4172661814037122452L; + + public TagException(String message) { + super(message); + } + + public TagException(String message, Throwable cause) { + super(message, cause); + } + + public TagException(Throwable cause) { + super(cause); + } +} From 0ac63617a7d2c1d3065557a188a2b6aeaabb7010 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 13:45:53 +0300 Subject: [PATCH 07/23] throw tag exception at failing to build tag --- .../artemget/tagrelease/domain/Service.java | 5 ++-- .../tagrelease/domain/ServiceGitlabEager.java | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Service.java b/src/main/java/io/github/artemget/tagrelease/domain/Service.java index 8512715..5e8e827 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Service.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Service.java @@ -24,6 +24,7 @@ package io.github.artemget.tagrelease.domain; +import io.github.artemget.tagrelease.exception.TagException; import org.cactoos.Scalar; /** @@ -42,7 +43,7 @@ public interface Service { /** * Returns application's tag. * - * @return + * @return Tag */ String tag(); @@ -52,5 +53,5 @@ public interface Service { * @param tag Build by rule * @return Service with a new tag */ - Service tagged(final Scalar tag); + Service tagged(final Scalar tag) throws TagException; } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java b/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java index 9e06ac0..8c35577 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java @@ -24,12 +24,30 @@ package io.github.artemget.tagrelease.domain; +import io.github.artemget.tagrelease.exception.TagException; import org.cactoos.Scalar; -public class ServiceGitlabEager implements Service { +/** + * Application's source code in gitlab. + * + * @since 0.1.0 + */ +public final class ServiceGitlabEager implements Service { + /** + * Application name. + */ private final String name; + /** + * Application tag. + */ private final String tag; + /** + * Main ctor. + * + * @param name Of application + * @param tag Of application + */ public ServiceGitlabEager(final String name, final String tag) { this.name = name; this.tag = tag; @@ -46,12 +64,11 @@ public String tag() { } @Override - public Service tagged(Scalar tag) { - //todo: req to gitlab + public Service tagged(final Scalar tag) throws TagException { try { return new ServiceGitlabEager(this.name, tag.value()); - } catch (Exception exception) { - throw new UnsupportedOperationException(exception); + } catch (final Exception exception) { + throw new TagException(String.format("Failed to create tag for service: %s", this.name), exception); } } } From 533bb9992a740ed7d9b76a2636f2a687ca44b4c1 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:02:51 +0300 Subject: [PATCH 08/23] add services docs, changed text signatures --- .../artemget/tagrelease/domain/Services.java | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Services.java b/src/main/java/io/github/artemget/tagrelease/domain/Services.java index 3d56c1c..f5e04de 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Services.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Services.java @@ -26,21 +26,52 @@ import java.util.List; import java.util.stream.Collectors; +import org.cactoos.Text; +/** + * Applications. + * + * @since 0.1.0 + */ public interface Services { + /** + * Returns all services from stand. + * + * @return Services + */ List services(); - Service service(String name); + /** + * Returns service from stand by it's name. + * + * @param name Of service + * @return Service + */ + Service service(final String name); - final class Text { + /** + * Printed Services. + * Format: ```java %s:%s```\n + * + * @since 0.1.0 + */ + final class Printed implements Text { + /** + * Services. + */ private final Services services; - public Text(final Services services) { + /** + * Main ctor. + * + * @param services Services + */ + public Printed(final Services services) { this.services = services; } @Override - public String toString() { + public String asString() { return this.services.services().stream() .map(service -> String.format("```java %s:%s```\n ", service.name(), service.tag())) .collect(Collectors.joining()); From bdc04e360ce31d6c6c0e78475a1355b854d706de Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:04:28 +0300 Subject: [PATCH 09/23] add services gitlab docs --- .../github/artemget/tagrelease/domain/ServicesGitlab.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java index 7c55e7b..c0d45e8 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java @@ -26,7 +26,12 @@ import java.util.List; -public class ServicesGitlab implements Services { +/** + * Applications from gitlab. + * + * @since 0.1.0 + */ +public final class ServicesGitlab implements Services { @Override public List services() { throw new UnsupportedOperationException(); From d36e0d30d7baaf4b75c3d9c939f1b8af3d8f88dc Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:06:09 +0300 Subject: [PATCH 10/23] add stand docs --- .../artemget/tagrelease/domain/Stand.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Stand.java b/src/main/java/io/github/artemget/tagrelease/domain/Stand.java index 7c00770..3724b33 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Stand.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Stand.java @@ -24,9 +24,24 @@ package io.github.artemget.tagrelease.domain; +/** + * Server. + * + * @since 0.1.0 + */ public interface Stand { + /** + * Returns server name. + * + * @return Name + */ String name(); + /** + * Returns server's services. + * + * @return Services + */ Services services(); final class Text { @@ -45,7 +60,7 @@ public String toString() { %s """, this.stand.name(), - new Services.Text(this.stand.services()) + new Services.Printed(this.stand.services()) ); } } From 01e6f45c26217d86f074cc225cb576cb61417ac9 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:09:00 +0300 Subject: [PATCH 11/23] add printed stand docs --- .../artemget/tagrelease/domain/Stand.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Stand.java b/src/main/java/io/github/artemget/tagrelease/domain/Stand.java index 3724b33..66b445d 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Stand.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Stand.java @@ -24,6 +24,8 @@ package io.github.artemget.tagrelease.domain; +import org.cactoos.Text; + /** * Server. * @@ -44,15 +46,32 @@ public interface Stand { */ Services services(); - final class Text { + /** + * Printed server. + * Format: + * Стенд: %s + * Сервисы: + * %s + * + * @since 0.1.0 + */ + final class Printed implements Text { + /** + * Server. + */ private final Stand stand; - public Text(final Stand stand) { + /** + * Main ctor. + * + * @param stand Stand + */ + public Printed(final Stand stand) { this.stand = stand; } @Override - public String toString() { + public String asString() { return String.format( """ Стенд: %s From 3391f16307c77b299c3ff04a4315e97bdc6ac6ac Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:10:22 +0300 Subject: [PATCH 12/23] add stands docs --- .../artemget/tagrelease/domain/Stands.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java index 6534cdf..71aae46 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java @@ -27,10 +27,26 @@ import java.util.List; import java.util.stream.Collectors; +/** + * Servers. + * + * @since 0.1.0 + */ public interface Stands { + /** + * Returns available servers. + * + * @return Servers + */ List stands(); - Stand stand(String name); + /** + * Returns server by it's name. + * + * @param name Name + * @return Server + */ + Stand stand(final String name); final class Text { private final Stands stands; @@ -42,7 +58,7 @@ public Text(final Stands stands) { @Override public String toString() { return stands.stands().stream() - .map(st -> new Stand.Text(st).toString()) + .map(st -> new Stand.Printed(st).toString()) .collect(Collectors.joining()); } } From faffd22123ee7fd01ffd74bdac1f80965b4fbfe5 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:12:01 +0300 Subject: [PATCH 13/23] add printed stands docs --- .../artemget/tagrelease/domain/Stands.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java index 71aae46..06b0cad 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.stream.Collectors; +import org.cactoos.Text; /** * Servers. @@ -48,15 +49,27 @@ public interface Stands { */ Stand stand(final String name); - final class Text { + /** + * Printed servers. + * + * @since 0.1.0 + */ + final class Printed implements Text { + /** + * Stands. + */ private final Stands stands; - public Text(final Stands stands) { + /** + * Main ctor. + * @param stands Stands + */ + public Printed(final Stands stands) { this.stands = stands; } @Override - public String toString() { + public String asString() { return stands.stands().stream() .map(st -> new Stand.Printed(st).toString()) .collect(Collectors.joining()); From 7d55a70646c4e1870610e3122005929377926696 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:13:57 +0300 Subject: [PATCH 14/23] add gitlab stand docs --- .../io/github/artemget/tagrelease/domain/StandGitlab.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java index 1b81184..4868361 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java @@ -24,6 +24,11 @@ package io.github.artemget.tagrelease.domain; +/** + * Servers at gitlab. + * + * @since 0.1.0 + */ public class StandGitlab implements Stand { @Override public String name() { From eec2567fc5f2b08a014ce99c4f538af216e1dc6d Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:16:51 +0300 Subject: [PATCH 15/23] add gitlab stands docs --- .../io/github/artemget/tagrelease/domain/StandGitlab.java | 2 +- .../io/github/artemget/tagrelease/domain/StandsGitlab.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java index 4868361..58e0534 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java @@ -25,7 +25,7 @@ package io.github.artemget.tagrelease.domain; /** - * Servers at gitlab. + * Server at gitlab. * * @since 0.1.0 */ diff --git a/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java index 5e01440..0355673 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java @@ -25,6 +25,12 @@ package io.github.artemget.tagrelease.domain; import java.util.List; + +/** + * Servers. + * + * @since 0.1.0 + */ public class StandsGitlab implements Stands { @Override public List stands() { From a3f71032008a7483035af08c090188712414ea0f Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:20:34 +0300 Subject: [PATCH 16/23] fix --- .../io/github/artemget/tagrelease/command/CmdListStand.java | 2 +- .../io/github/artemget/tagrelease/command/CmdListStands.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java b/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java index 0aff317..3989d7f 100644 --- a/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java +++ b/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java @@ -62,7 +62,7 @@ public Send execute(final Update update) throws CmdException { try { message = new SendMessage( update.getMessage().getChatId().toString(), - new Stand.Text( + new Stand.Printed( this.stands.stand( new Trimmed( new Replaced( diff --git a/src/main/java/io/github/artemget/tagrelease/command/CmdListStands.java b/src/main/java/io/github/artemget/tagrelease/command/CmdListStands.java index 6c7ed2c..c877735 100644 --- a/src/main/java/io/github/artemget/tagrelease/command/CmdListStands.java +++ b/src/main/java/io/github/artemget/tagrelease/command/CmdListStands.java @@ -26,7 +26,6 @@ import io.github.artemget.tagrelease.domain.Stands; import io.github.artemget.teleroute.command.Cmd; -import io.github.artemget.teleroute.command.CmdException; import io.github.artemget.teleroute.send.Send; import io.github.artemget.teleroute.telegrambots.send.SendMessageWrap; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; @@ -56,7 +55,7 @@ public CmdListStands(final Stands stands) { public Send execute(final Update update) { final SendMessage message = new SendMessage( update.getMessage().getChatId().toString(), - new Stands.Text(this.stands).toString() + new Stands.Printed(this.stands).toString() ); message.setReplyToMessageId(update.getMessage().getMessageId()); message.enableMarkdownV2(true); From d8d07f8208e2b4fb196e758399deee78366b512c Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:24:41 +0300 Subject: [PATCH 17/23] fix MatchAdmin --- .../io/github/artemget/tagrelease/match/MatchAdmin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java b/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java index f6b0ff7..8f61cf6 100644 --- a/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java +++ b/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java @@ -53,9 +53,12 @@ public MatchAdmin(final Entry> admins) { } @Override - public boolean test(final Wrap updateWrap) { + public boolean test(final Wrap update) { try { - return this.admins.value().contains(updateWrap.src().getMessage().getFrom().getId().toString()); + return this.admins.value() + .contains( + update.src().getMessage().getFrom().getId().toString() + ); } catch (final EntryException exception) { throw new EntryExceptionUnchecked(exception); } From ac6fe2775a133e1e69f54edbe5d62d18d1dc8032 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:42:30 +0300 Subject: [PATCH 18/23] fix MatchChats --- .../io/github/artemget/tagrelease/match/MatchAdmin.java | 4 +--- .../io/github/artemget/tagrelease/match/MatchChats.java | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java b/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java index 8f61cf6..2eae29d 100644 --- a/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java +++ b/src/main/java/io/github/artemget/tagrelease/match/MatchAdmin.java @@ -56,9 +56,7 @@ public MatchAdmin(final Entry> admins) { public boolean test(final Wrap update) { try { return this.admins.value() - .contains( - update.src().getMessage().getFrom().getId().toString() - ); + .contains(update.src().getMessage().getFrom().getId().toString()); } catch (final EntryException exception) { throw new EntryExceptionUnchecked(exception); } diff --git a/src/main/java/io/github/artemget/tagrelease/match/MatchChats.java b/src/main/java/io/github/artemget/tagrelease/match/MatchChats.java index 13957f8..4684eb1 100644 --- a/src/main/java/io/github/artemget/tagrelease/match/MatchChats.java +++ b/src/main/java/io/github/artemget/tagrelease/match/MatchChats.java @@ -37,7 +37,7 @@ * * @since 0.1.0 */ -public class MatchChats implements Predicate> { +public final class MatchChats implements Predicate> { /** * Chat ids. */ @@ -53,9 +53,10 @@ public MatchChats(final Entry> chats) { } @Override - public boolean test(final Wrap updateWrap) { + public boolean test(final Wrap update) { try { - return this.chats.value().contains(updateWrap.src().getMessage().getChatId().toString()); + return this.chats.value() + .contains(update.src().getMessage().getChatId().toString()); } catch (final EntryException exception) { throw new EntryExceptionUnchecked(exception); } From c5ec0e1f5a640f28346c7626b974b6f78389bef5 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:43:46 +0300 Subject: [PATCH 19/23] fix ESplit --- .../io/github/artemget/tagrelease/entry/ESplit.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/entry/ESplit.java b/src/main/java/io/github/artemget/tagrelease/entry/ESplit.java index f98e47e..2b343fb 100644 --- a/src/main/java/io/github/artemget/tagrelease/entry/ESplit.java +++ b/src/main/java/io/github/artemget/tagrelease/entry/ESplit.java @@ -36,11 +36,12 @@ */ public final class ESplit implements Entry> { /** - * Origin string entry + * Origin string entry. */ private final Entry origin; + /** - * Split delimiter + * Split delimiter. */ private final String delimiter; @@ -69,9 +70,13 @@ public Set value() throws EntryException { final String value = this.origin.value(); try { return Set.of(value.split(this.delimiter)); - } catch (PatternSyntaxException exception) { + } catch (final PatternSyntaxException exception) { throw new EntryException( - String.format("Wrong pattern delimiter: %s for entry value: %s", this.delimiter, value), + String.format( + "Wrong pattern delimiter: %s for entry value: %s", + this.delimiter, + value + ), exception ); } From 2d6a53022bac1ee9066ed68d952863f38afeab0c Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:47:19 +0300 Subject: [PATCH 20/23] fix checkstyle CmdListStand --- .../artemget/tagrelease/command/CmdListStand.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java b/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java index 3989d7f..8b96ffd 100644 --- a/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java +++ b/src/main/java/io/github/artemget/tagrelease/command/CmdListStand.java @@ -42,7 +42,7 @@ * * @since 0.1.0 */ -public class CmdListStand implements Cmd { +public final class CmdListStand implements Cmd { /** * Available stands. */ @@ -56,6 +56,8 @@ public CmdListStand(final Stands stands) { this.stands = stands; } + // @checkstyle IllegalCatchCheck (50 lines) + @SuppressWarnings("PMD.AvoidCatchingGenericException") @Override public Send execute(final Update update) throws CmdException { final SendMessage message; @@ -66,12 +68,15 @@ public Send execute(final Update update) throws CmdException { this.stands.stand( new Trimmed( new Replaced( - new TextOf(update.getMessage().getText()), "Покажи сервис", "") + new TextOf(update.getMessage().getText()), + "Покажи сервис", + "" + ) ).asString() ) ).toString() ); - } catch (Exception exception) { + } catch (final Exception exception) { throw new CmdException( String.format("Failed to eject value from cmd %s", update.getMessage().getText()), exception From d146a2a9c866bfe9ddf1c26398ced210c1991100 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:48:15 +0300 Subject: [PATCH 21/23] fix checkstyle --- .../io/github/artemget/tagrelease/domain/ServicesGitlab.java | 2 +- .../java/io/github/artemget/tagrelease/domain/StandGitlab.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java index c0d45e8..7ab47fb 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/ServicesGitlab.java @@ -38,7 +38,7 @@ public List services() { } @Override - public Service service(String name) { + public Service service(final String name) { throw new UnsupportedOperationException(); } } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java index 58e0534..f8135c4 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/StandGitlab.java @@ -29,7 +29,7 @@ * * @since 0.1.0 */ -public class StandGitlab implements Stand { +public final class StandGitlab implements Stand { @Override public String name() { throw new UnsupportedOperationException(); From 31f35989b84b318eaad7ac1aff3b6ad578c90da4 Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:56:30 +0300 Subject: [PATCH 22/23] fix checkstyle --- .../artemget/tagrelease/domain/Service.java | 4 +-- .../tagrelease/domain/ServiceGitlabEager.java | 13 +++++++-- .../artemget/tagrelease/domain/Services.java | 11 ++++++-- .../artemget/tagrelease/domain/Stands.java | 4 +-- .../tagrelease/domain/StandsGitlab.java | 4 +-- .../tagrelease/exception/TagException.java | 6 ++-- .../tagrelease/exception/package-info.java | 28 +++++++++++++++++++ 7 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 src/main/java/io/github/artemget/tagrelease/exception/package-info.java diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Service.java b/src/main/java/io/github/artemget/tagrelease/domain/Service.java index 5e8e827..b1cf289 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Service.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Service.java @@ -50,8 +50,8 @@ public interface Service { /** * Builds new tag. * - * @param tag Build by rule + * @param rule To build tag * @return Service with a new tag */ - Service tagged(final Scalar tag) throws TagException; + Service tagged(Scalar rule) throws TagException; } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java b/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java index 8c35577..91410ab 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/ServiceGitlabEager.java @@ -32,11 +32,13 @@ * * @since 0.1.0 */ +@SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName") public final class ServiceGitlabEager implements Service { /** * Application name. */ private final String name; + /** * Application tag. */ @@ -63,12 +65,17 @@ public String tag() { return this.tag; } + // @checkstyle IllegalCatchCheck (50 lines) + @SuppressWarnings("PMD.AvoidCatchingGenericException") @Override - public Service tagged(final Scalar tag) throws TagException { + public Service tagged(final Scalar rule) throws TagException { try { - return new ServiceGitlabEager(this.name, tag.value()); + return new ServiceGitlabEager(this.name, rule.value()); } catch (final Exception exception) { - throw new TagException(String.format("Failed to create tag for service: %s", this.name), exception); + throw new TagException( + String.format("Failed to create tag for service: %s", this.name), + exception + ); } } } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Services.java b/src/main/java/io/github/artemget/tagrelease/domain/Services.java index f5e04de..183a171 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Services.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Services.java @@ -47,7 +47,7 @@ public interface Services { * @param name Of service * @return Service */ - Service service(final String name); + Service service(String name); /** * Printed Services. @@ -73,7 +73,14 @@ public Printed(final Services services) { @Override public String asString() { return this.services.services().stream() - .map(service -> String.format("```java %s:%s```\n ", service.name(), service.tag())) + .map( + service -> + String.format( + "```java %s:%s```\n ", + service.name(), + service.tag() + ) + ) .collect(Collectors.joining()); } } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java index 06b0cad..78120af 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/Stands.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/Stands.java @@ -47,7 +47,7 @@ public interface Stands { * @param name Name * @return Server */ - Stand stand(final String name); + Stand stand(String name); /** * Printed servers. @@ -70,7 +70,7 @@ public Printed(final Stands stands) { @Override public String asString() { - return stands.stands().stream() + return this.stands.stands().stream() .map(st -> new Stand.Printed(st).toString()) .collect(Collectors.joining()); } diff --git a/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java b/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java index 0355673..e5fd2ec 100644 --- a/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java +++ b/src/main/java/io/github/artemget/tagrelease/domain/StandsGitlab.java @@ -31,14 +31,14 @@ * * @since 0.1.0 */ -public class StandsGitlab implements Stands { +public final class StandsGitlab implements Stands { @Override public List stands() { throw new UnsupportedOperationException(); } @Override - public Stand stand(String name) { + public Stand stand(final String name) { throw new UnsupportedOperationException(); } } diff --git a/src/main/java/io/github/artemget/tagrelease/exception/TagException.java b/src/main/java/io/github/artemget/tagrelease/exception/TagException.java index 3ba1d89..56d0123 100644 --- a/src/main/java/io/github/artemget/tagrelease/exception/TagException.java +++ b/src/main/java/io/github/artemget/tagrelease/exception/TagException.java @@ -35,15 +35,15 @@ public class TagException extends Exception { @Serial private static final long serialVersionUID = 4172661814037122452L; - public TagException(String message) { + public TagException(final String message) { super(message); } - public TagException(String message, Throwable cause) { + public TagException(final String message, final Throwable cause) { super(message, cause); } - public TagException(Throwable cause) { + public TagException(final Throwable cause) { super(cause); } } diff --git a/src/main/java/io/github/artemget/tagrelease/exception/package-info.java b/src/main/java/io/github/artemget/tagrelease/exception/package-info.java new file mode 100644 index 0000000..b695bbd --- /dev/null +++ b/src/main/java/io/github/artemget/tagrelease/exception/package-info.java @@ -0,0 +1,28 @@ +/* + * MIT License + * + * Copyright (c) 2024-2025. Artem Getmanskii + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * Exception directory. + */ +package io.github.artemget.tagrelease.exception; From 8a019038de0090971a648a8ee52693e52ed17d4b Mon Sep 17 00:00:00 2001 From: Artem Getmanskii Date: Tue, 13 May 2025 14:57:09 +0300 Subject: [PATCH 23/23] enable qulice profile in maven gha --- .github/workflows/maven.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 3a326c5..fb14674 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -20,4 +20,4 @@ jobs: distribution: 'temurin' cache: maven - name: Build with Maven - run: mvn clean install --batch-mode --update-snapshots + run: mvn clean install -Pqulice --batch-mode --update-snapshots