From 09f1d03888e5b2ffaf34f3584c51f1ecc8e5a58b Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 9 Mar 2024 19:26:43 -0500 Subject: [PATCH 1/8] [#1207] Remove common-lang3 --- pom.xml | 5 ----- .../java/com/rultor/agents/github/Answer.java | 9 +++++---- .../com/rultor/agents/github/Understands.java | 15 +++++++++++++-- .../java/com/rultor/agents/github/qtn/QnLock.java | 11 ++++++----- .../java/com/rultor/agents/req/DockerRun.java | 15 +++++++-------- src/main/java/com/rultor/web/TkAppFallback.java | 3 +-- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index b9374e244e..ef6248bab1 100644 --- a/pom.xml +++ b/pom.xml @@ -177,11 +177,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE. lombok 1.18.30 - - org.apache.commons - commons-lang3 - 3.14.0 - org.apache.commons commons-text diff --git a/src/main/java/com/rultor/agents/github/Answer.java b/src/main/java/com/rultor/agents/github/Answer.java index 091c93bf3f..455fd92b4d 100644 --- a/src/main/java/com/rultor/agents/github/Answer.java +++ b/src/main/java/com/rultor/agents/github/Answer.java @@ -44,10 +44,11 @@ import java.util.TreeSet; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.apache.commons.lang3.StringUtils; import org.cactoos.iterable.Mapped; import org.cactoos.iterable.Reversed; import org.cactoos.list.ListOf; +import org.cactoos.text.Abbreviated; +import org.cactoos.text.FormattedText; import org.cactoos.text.Joined; import org.cactoos.text.UncheckedText; import org.xembly.Xembler; @@ -133,16 +134,16 @@ private String msg(final boolean success, final String text) { final StringBuilder msg = new StringBuilder(100); try { msg.append( - String.format( + new FormattedText( "> %s\n\n", - StringUtils.abbreviate( + new Abbreviated( this.comment.body().replaceAll( "\\p{Space}", Answer.SPACE ), 100 ) - ) + ).asString() ); final Collection logins = new TreeSet<>(); logins.add(this.comment.author().login()); diff --git a/src/main/java/com/rultor/agents/github/Understands.java b/src/main/java/com/rultor/agents/github/Understands.java index e1baaa1b8a..834eaca6b6 100644 --- a/src/main/java/com/rultor/agents/github/Understands.java +++ b/src/main/java/com/rultor/agents/github/Understands.java @@ -47,7 +47,6 @@ import java.util.ResourceBundle; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.apache.commons.lang3.exception.ExceptionUtils; import org.cactoos.iterable.Joined; import org.xembly.Directive; import org.xembly.Directives; @@ -200,7 +199,7 @@ private Req parse(final Comment.Smart comment, final XML xml) false, String.format( Understands.PHRASES.getString("Understands.broken-profile"), - ExceptionUtils.getRootCauseMessage(ex) + Understands.rootCause(ex) ) ); req = Req.EMPTY; @@ -225,4 +224,16 @@ private static int seen(final XML xml) { return seen; } + /** + * Root cause exception message. + * @param exception Error + * @return Message + */ + private static String rootCause(final Profile.ConfigException exception) { + Throwable root = exception; + while (root.getCause() != root) { + root = root.getCause(); + } + return root.getMessage(); + } } diff --git a/src/main/java/com/rultor/agents/github/qtn/QnLock.java b/src/main/java/com/rultor/agents/github/qtn/QnLock.java index ac221d3f0f..2756577342 100644 --- a/src/main/java/com/rultor/agents/github/qtn/QnLock.java +++ b/src/main/java/com/rultor/agents/github/qtn/QnLock.java @@ -50,10 +50,11 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.StringUtils; import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; import org.cactoos.text.Joined; +import org.cactoos.text.Replaced; +import org.cactoos.text.TextOf; import org.cactoos.text.UncheckedText; import org.xembly.Directives; import org.xembly.Xembler; @@ -95,10 +96,10 @@ public Req understand(final Comment.Smart comment, users.addAll( new ListOf<>( new Mapped<>( - input -> StringUtils.stripStart( - input.trim().toLowerCase(Locale.ENGLISH), - "@" - ), + input -> new Replaced( + new TextOf(input.trim().toLowerCase(Locale.ENGLISH)), + "^@", "" + ).asString(), Arrays.asList( args.xpath( "//arg[@name='users']/text()" diff --git a/src/main/java/com/rultor/agents/req/DockerRun.java b/src/main/java/com/rultor/agents/req/DockerRun.java index 27f55d8dd9..200d4470e5 100644 --- a/src/main/java/com/rultor/agents/req/DockerRun.java +++ b/src/main/java/com/rultor/agents/req/DockerRun.java @@ -33,7 +33,6 @@ import com.jcabi.xml.XML; import com.rultor.spi.Profile; import java.io.IOException; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; @@ -42,11 +41,12 @@ import java.util.Map.Entry; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.apache.commons.lang3.StringUtils; import org.cactoos.iterable.Joined; import org.cactoos.iterable.Mapped; import org.cactoos.iterable.Sticky; import org.cactoos.list.ListOf; +import org.cactoos.text.Split; +import org.cactoos.text.Trimmed; /** * Docker run command. @@ -176,8 +176,9 @@ private static Iterable scripts(final XML xml, final String path) { * @return If hash is in quotes. */ private static boolean inquotes(final String item, final int pos) { - return StringUtils.countMatches(item.substring(0, pos), "\"") % 2 == 1 - || StringUtils.countMatches(item.substring(0, pos), "'") % 2 == 1; + final String sub = item.substring(0, pos); + return sub.chars().filter(c -> c == '"').count() % 2 == 1 + || sub.chars().filter(c -> c == '\'').count() % 2 == 1; } /** @@ -250,10 +251,8 @@ private static Collection lines(final XML node) { lines.addAll( new ListOf<>( new Mapped<>( - String::trim, - Arrays.asList( - StringUtils.split(node.xpath("text()").get(0), '\n') - ) + t -> new Trimmed(t).asString(), + new Split(node.xpath("text()").get(0), "\n") ) ) ); diff --git a/src/main/java/com/rultor/web/TkAppFallback.java b/src/main/java/com/rultor/web/TkAppFallback.java index 3f2f74e196..a9d120fb65 100644 --- a/src/main/java/com/rultor/web/TkAppFallback.java +++ b/src/main/java/com/rultor/web/TkAppFallback.java @@ -33,7 +33,6 @@ import io.sentry.Sentry; import java.io.IOException; import java.net.HttpURLConnection; -import org.apache.commons.lang3.exception.ExceptionUtils; import org.takes.Response; import org.takes.Take; import org.takes.facets.fallback.FbChain; @@ -105,7 +104,7 @@ private static Response fatal(final RqFallback req) throws IOException { TkAppFallback.class.getResource("error.html.vm"), new RsVelocity.Pair( "err", - ExceptionUtils.getStackTrace(req.throwable()) + req.throwable().getStackTrace() ), new RsVelocity.Pair("rev", TkAppFallback.REV) ), From fb7a2ea150b972d22d10056206e1de5012c01c1d Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Sat, 9 Mar 2024 21:08:27 -0500 Subject: [PATCH 2/8] [#1207] Update qulice version --- pom.xml | 7 +- src/jekyll/_layouts/default.html | 10 ++- .../_posts/2014/jul/2014-07-13-basics.md | 4 +- .../_posts/2014/jul/2014-07-13-reference.md | 3 +- .../com/rultor/agents/github/Understands.java | 15 ++-- .../com/rultor/agents/shells/SmartHost.java | 2 +- .../com/rultor/agents/github/qtn/status.xsl | 7 +- src/main/resources/com/rultor/spi/talk.xsd | 84 ++++++++++++++----- .../com/rultor/spi/upgrade/001-talks.xsl | 3 +- src/main/resources/phrases_en_US.properties | 8 +- src/main/xsl/daemon.xsl | 3 +- src/main/xsl/home.xsl | 12 ++- src/main/xsl/layout.xsl | 18 ++-- src/main/xsl/siblings.xsl | 3 +- src/main/xsl/talk.xsl | 3 +- src/site/site.xml | 6 +- .../rultor/agents/github/qtn/QnMergeTest.java | 4 +- .../rultor/agents/github/qtn/QnSafeTest.java | 2 +- .../com/rultor/agents/req/DockerRunTest.java | 7 +- .../profiles/GithubProfileValidationTest.java | 15 ++-- 20 files changed, 148 insertions(+), 68 deletions(-) diff --git a/pom.xml b/pom.xml index ef6248bab1..c579b670eb 100644 --- a/pom.xml +++ b/pom.xml @@ -828,13 +828,18 @@ OF THE POSSIBILITY OF SUCH DAMAGE. com.qulice qulice-maven-plugin - 0.22.0 + 0.22.1 checkstyle:/src/main/js/.* checkstyle:/src/main/scss/.* + checkstyle:/src/main/resources/com/rultor/web/.* + checkstyle:/src/main/resources/com/rultor/agents/daemons/.* + checkstyle:/src/main/resources/com/rultor/agents/docker/.* + checkstyle:/src/main/resources/com/rultor/agents/req/.* checkstyle:/src/jekyll/guard-article.pdf checkstyle:/src/jekyll/images/.* + checkstyle:/src/jekyll/favicon.ico findbugs:.* duplicatefinder:.* diff --git a/src/jekyll/_layouts/default.html b/src/jekyll/_layouts/default.html index 568dc282d3..3fad04e342 100644 --- a/src/jekyll/_layouts/default.html +++ b/src/jekyll/_layouts/default.html @@ -7,7 +7,8 @@ - + @@ -79,7 +80,9 @@

{{ page.title }}

- {{ site.data['hash'] }} + + {{ site.data['hash'] }} +

@@ -99,7 +102,8 @@

{{ page.title }}

f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; - s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; + s.src = (d.location.protocol == "https:" ? "https:" : "http:") + + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } diff --git a/src/jekyll/_posts/2014/jul/2014-07-13-basics.md b/src/jekyll/_posts/2014/jul/2014-07-13-basics.md index 253141c99b..2f5a6e55aa 100644 --- a/src/jekyll/_posts/2014/jul/2014-07-13-basics.md +++ b/src/jekyll/_posts/2014/jul/2014-07-13-basics.md @@ -115,7 +115,9 @@ Then, in your script you get `$tag` environment variable, which will be set to `1.7`. Your script should change the version of the product to 1.7 and build it. -This is how we do it in jcabi [`rultor.yml`](https://github.com/jcabi/jcabi/blob/master/.rultor.yml). For example: +This is how we do it in jcabi +[`rultor.yml`](https://github.com/jcabi/jcabi/blob/master/.rultor.yml). +For example: {% highlight yaml %} release: diff --git a/src/jekyll/_posts/2014/jul/2014-07-13-reference.md b/src/jekyll/_posts/2014/jul/2014-07-13-reference.md index 1306ebb439..4a1698baa4 100644 --- a/src/jekyll/_posts/2014/jul/2014-07-13-reference.md +++ b/src/jekyll/_posts/2014/jul/2014-07-13-reference.md @@ -295,7 +295,8 @@ release: echo "packaging..." {% endhighlight %} -`sensitive` option lists files that must not present in the branch after the release. It is recommended to list your sensitive config files there. +`sensitive` option lists files that must not present in the branch after the release. +It is recommended to list your sensitive config files there. `pre` option if set to `false` will automatically mark the release in GitHub as "final." diff --git a/src/main/java/com/rultor/agents/github/Understands.java b/src/main/java/com/rultor/agents/github/Understands.java index 834eaca6b6..e71fff65ab 100644 --- a/src/main/java/com/rultor/agents/github/Understands.java +++ b/src/main/java/com/rultor/agents/github/Understands.java @@ -59,14 +59,13 @@ @Immutable @ToString @EqualsAndHashCode(callSuper = false, of = { "github", "question" }) -@SuppressWarnings - ( - { - "PMD.CyclomaticComplexity", - "PMD.StdCyclomaticComplexity", - "PMD.ModifiedCyclomaticComplexity" - } - ) +@SuppressWarnings( + { + "PMD.CyclomaticComplexity", + "PMD.StdCyclomaticComplexity", + "PMD.ModifiedCyclomaticComplexity" + } +) public final class Understands extends AbstractAgent { /** diff --git a/src/main/java/com/rultor/agents/shells/SmartHost.java b/src/main/java/com/rultor/agents/shells/SmartHost.java index 00d3014d1e..82cd9ca213 100644 --- a/src/main/java/com/rultor/agents/shells/SmartHost.java +++ b/src/main/java/com/rultor/agents/shells/SmartHost.java @@ -42,7 +42,7 @@ */ @Immutable @ToString -@EqualsAndHashCode(of = { "host" }) +@EqualsAndHashCode(of = "host") @SuppressWarnings({"PMD.ShortMethodName", "PMD.ConstructorOnlyInitializesOrCallOtherConstructors"}) final class SmartHost { diff --git a/src/main/resources/com/rultor/agents/github/qtn/status.xsl b/src/main/resources/com/rultor/agents/github/qtn/status.xsl index c041c06c25..1927c625eb 100644 --- a/src/main/resources/com/rultor/agents/github/qtn/status.xsl +++ b/src/main/resources/com/rultor/agents/github/qtn/status.xsl @@ -28,7 +28,9 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + @@ -133,7 +135,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/main/resources/com/rultor/spi/talk.xsd b/src/main/resources/com/rultor/spi/talk.xsd index 79663a06ae..f9cf083033 100644 --- a/src/main/resources/com/rultor/spi/talk.xsd +++ b/src/main/resources/com/rultor/spi/talk.xsd @@ -195,7 +195,9 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This element has the type of the request. + + This element has the type of the request. + @@ -205,13 +207,17 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This element has the list arguments. + + This element has the list arguments. + - This type has an argument of the request. + + This type has an argument of the request. + @@ -231,7 +237,9 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This is an unique constraint over the argument name. + + This is an unique constraint over the argument name. + @@ -243,39 +251,53 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This type describes the specification of the wire task. + + This type describes the specification of the wire task. + - This element has the URI of the wire. + + This element has the URI of the wire. + - This element has the name of the repository in github. + + This element has the name of the repository in github. + - This element has the number of the issue in github. + + This element has the number of the issue in github. + - This element has the number of views of the issue. + + This element has the number of views of the issue. + - This type describes the specification of the archive task. + + This type describes the specification of the archive task. + - This element has the log specification for the archive task. + + This element has the log specification for the archive task. + @@ -291,7 +313,9 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This type describes the specification about the EC2. + + This type describes the specification about the EC2. + @@ -308,38 +332,52 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This element has the definition of the talk task. + + This element has the definition of the talk task. + - This element has the daemon definition. + + This element has the daemon definition. + - This element has the wire definition. + + This element has the wire definition. + - This element has the shell definition. + + This element has the shell definition. + - This element has the request definition. + + This element has the request definition. + - This element has the archive definition. + + This element has the archive definition. + - This element has the EC2 definition. + + This element has the EC2 definition. + @@ -350,14 +388,18 @@ OF THE POSSIBILITY OF SUCH DAMAGE. - This is an unique constraint over the id attribute of log in the element type archive + + This is an unique constraint over the id attribute of log in the element type archive + - Request ID can't be the same as already existing log ID + + Request ID can't be the same as already existing log ID + diff --git a/src/main/resources/com/rultor/spi/upgrade/001-talks.xsl b/src/main/resources/com/rultor/spi/upgrade/001-talks.xsl index f6e7b86d66..ee596bdb75 100644 --- a/src/main/resources/com/rultor/spi/upgrade/001-talks.xsl +++ b/src/main/resources/com/rultor/spi/upgrade/001-talks.xsl @@ -28,7 +28,8 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + diff --git a/src/main/resources/phrases_en_US.properties b/src/main/resources/phrases_en_US.properties index 2578b4a206..8e6197137c 100644 --- a/src/main/resources/phrases_en_US.properties +++ b/src/main/resources/phrases_en_US.properties @@ -84,14 +84,16 @@ QnVersion.intro=My current version is %s, \ Reports.success=Done! FYI, the full log is [here](%s) (took me %[ms]s) Reports.failure=Oops, I failed. You can see the full log [here](%s) (spent %[ms]s) -Reports.stop-fails=Sorry, I failed to stop the previous command, however it has the following result: +Reports.stop-fails=Sorry, I failed to stop the previous command, \ + however it has the following result: CommentsTag.duplicate=Release `%s` already exists! I can't duplicate it, \ but I posted a comment there. In the future, try to avoid duplicate releases QnByArchitect.denied=Thanks for your request; @%s please confirm this. -QnByArchitect.read-only=Unfortunately, either you or me don't have 'write' permissions to the repository, \ - I can't do what you're asking. Try to add me as a collaborator with 'write' access. +QnByArchitect.read-only=Unfortunately, either you or me don't have 'write' permissions \ + to the repository, I can't do what you're asking. \ + Try to add me as a collaborator with 'write' access. QnReferredTo.mentioned=I see you're talking about me, but I don't understand it. \ If you want to say something to me directly, start a message with %s diff --git a/src/main/xsl/daemon.xsl b/src/main/xsl/daemon.xsl index f3aeaf6961..29b065750f 100644 --- a/src/main/xsl/daemon.xsl +++ b/src/main/xsl/daemon.xsl @@ -28,7 +28,8 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + diff --git a/src/main/xsl/home.xsl b/src/main/xsl/home.xsl index dde703e6cf..3ee60319a4 100644 --- a/src/main/xsl/home.xsl +++ b/src/main/xsl/home.xsl @@ -28,7 +28,8 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + @@ -102,21 +103,24 @@ OF THE POSSIBILITY OF SUCH DAMAGE. powered by
- docker logo + docker logo
operates at
- github logo + github logo
hosted by
- heroku logo + heroku logo
diff --git a/src/main/xsl/layout.xsl b/src/main/xsl/layout.xsl index 9792b47533..49a1786e8b 100644 --- a/src/main/xsl/layout.xsl +++ b/src/main/xsl/layout.xsl @@ -28,18 +28,25 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + - + - - + +