Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1207] remove common-lang3 and update qulice #1920

Merged
merged 8 commits into from Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions pom.xml
Expand Up @@ -177,11 +177,6 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
Expand Down Expand Up @@ -833,13 +828,22 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.22.0</version>
<version>0.22.1</version>
<configuration>
<excludes combine.children="append">
<exclude>checkstyle:/src/main/js/.*</exclude>
<exclude>checkstyle:/src/main/scss/.*</exclude>
<exclude>checkstyle:/src/main/xsl/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/web/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/agents/daemons/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/agents/docker/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/agents/github/qtn/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/agents/req/.*</exclude>
<exclude>checkstyle:/src/main/resources/com/rultor/spi/upgrade/.*</exclude>
<exclude>checkstyle:/src/site/.*</exclude>
<exclude>checkstyle:/src/jekyll/guard-article.pdf</exclude>
<exclude>checkstyle:/src/jekyll/images/.*</exclude>
<exclude>checkstyle:/src/jekyll/favicon.ico</exclude>
<exclude>findbugs:.*</exclude>
<exclude>duplicatefinder:.*</exclude>
</excludes>
Expand Down
10 changes: 7 additions & 3 deletions src/jekyll/_layouts/default.html
Expand Up @@ -7,7 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" type="image/png" href="//img.rultor.com/logo-128x128.png">
<link rel="shortcut icon" href="//img.rultor.com/logo-128x128.png" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://doc.thindeck.com/rss.xml"/>
<link rel="alternate" type="application/rss+xml" title="RSS"
href="http://doc.thindeck.com/rss.xml"/>
<link rel="author" href="//plus.google.com/u/0/114792568016408327418?rel=author" />
<link rel="stylesheet" href="/css/layout.css?{{ site.data['hash'] }}"/>
<link rel="canonical" href="//doc.rultor.com{{ page.url }}" />
Expand Down Expand Up @@ -79,7 +80,9 @@ <h1 itemprop="headline">{{ page.title }}</h1>
</div>
</div>
<p>
<a href="https://github.com/yegor256/rultor/commit/{{ site.data['hash'] }}">{{ site.data['hash'] }}</a>
<a href="https://github.com/yegor256/rultor/commit/{{ site.data['hash'] }}">
{{ site.data['hash'] }}
</a>
</p>
</footer>
</div>
Expand All @@ -99,7 +102,8 @@ <h1 itemprop="headline">{{ page.title }}</h1>
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(); }
Expand Down
4 changes: 3 additions & 1 deletion src/jekyll/_posts/2014/jul/2014-07-13-basics.md
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/jekyll/_posts/2014/jul/2014-07-13-reference.md
Expand Up @@ -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."

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/rultor/agents/github/Answer.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> logins = new TreeSet<>();
logins.add(this.comment.author().login());
Expand Down
30 changes: 20 additions & 10 deletions src/main/java/com/rultor/agents/github/Understands.java
Expand Up @@ -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;
Expand All @@ -60,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 {

/**
Expand Down Expand Up @@ -200,7 +198,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;
Expand All @@ -225,4 +223,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.equals(root.getCause())) {
root = root.getCause();
}
return root.getMessage();
}
}
11 changes: 6 additions & 5 deletions src/main/java/com/rultor/agents/github/qtn/QnLock.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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()"
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/com/rultor/agents/req/DockerRun.java
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -176,8 +176,9 @@ private static Iterable<String> 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;
}

/**
Expand Down Expand Up @@ -250,10 +251,8 @@ private static Collection<String> 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")
)
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rultor/agents/shells/SmartHost.java
Expand Up @@ -42,7 +42,7 @@
*/
@Immutable
@ToString
@EqualsAndHashCode(of = { "host" })
@EqualsAndHashCode(of = "host")
@SuppressWarnings({"PMD.ShortMethodName",
"PMD.ConstructorOnlyInitializesOrCallOtherConstructors"})
final class SmartHost {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/rultor/web/TkAppFallback.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pnatashap I believe, this is not exactly what ExceptionUtils.getStackTrace does. We should use Logger.format("%[exception]s", req.throwable()) instead.

),
new RsVelocity.Pair("rev", TkAppFallback.REV)
),
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/com/rultor/agents/github/qtn/status.xsl
Expand Up @@ -133,7 +133,8 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<xsl:variable name="seconds" select="60"/>
<!--
<xsl:variable name="seconds"
select="number((current-dateTime() - xs:dateTime($time)) div xs:dayTimeDuration('PT1S'))"/>
select=
"number((current-dateTime() - xs:dateTime($time)) div xs:dayTimeDuration('PT1S'))"/>
-->
<xsl:choose>
<xsl:when test="$seconds &gt; 60 * 60">
Expand Down