Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #664 from book000/feat/check-system-print
Browse files Browse the repository at this point in the history
ci: Added Check using System.out/err.print Action
  • Loading branch information
book000 authored Jan 24, 2022
2 parents cf08a42 + 0a86e41 commit 465da16
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/check-system-print.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check using System.out/err.print

on: [ push, pull_request_target ]

jobs:
check-system-print:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup reviewdog
uses: reviewdog/action-setup@v1

- name: Check using System.out.print
run: |
COUNT=`grep -rE "System\.(out|err)\.print" --include=*.java src/main > ../system-prints.txt || true`
cat ../system-prints.txt | reviewdog -efm="%f:%l" -name="Check using System.out/err.print" -reporter=github-pr-review -level=warning
cat ../system-prints.txt
if [ "$COUNT" != "0" ]; then
echo "Found System.out/err.print in Java source files"
exit 1
fi
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void run() {
JSONObject json;
try (Response response = client.newCall(request).execute()) {
if (response.code() != 200) {
System.out.printf("OnLoginAfterCheck: APIサーバへの接続に失敗: %s -> %d%n", url, response.code());
Main.getMyMaidLogger().info("OnLoginAfterCheck: APIサーバへの接続に失敗: %s -> %d%n".formatted(url, response.code()));
response.close();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ public void run() {

Response response = client.newCall(request).execute();
if (response.code() != 200 && response.code() != 302) {
System.out.printf("NewPlayerAutoBlMap: APIサーバへの接続に失敗: %d %s\nhttps://jaoafa.com/cp/?uuid=%s%n", response.code(), Objects.requireNonNull(response.body()).string(), player.getUniqueId());
Main.getMyMaidLogger().info("NewPlayerAutoBlMap: APIサーバへの接続に失敗: %d %s\nhttps://jaoafa.com/cp/?uuid=%s".formatted(response.code(), Objects.requireNonNull(response.body()).string(), player.getUniqueId()));
response.close();
return;
}
if (response.body() == null) {
System.out.printf("NewPlayerAutoBlMap: APIサーバへの接続に失敗: response.body() is null.\nhttps://jaoafa.com/cp/?uuid=%s%n", player.getUniqueId());
Main.getMyMaidLogger().info("NewPlayerAutoBlMap: APIサーバへの接続に失敗: response.body() is null.\nhttps://jaoafa.com/cp/?uuid=%s".formatted(player.getUniqueId()));
response.close();
return;
}
Main.getMyMaidLogger().info("NewPlayerAutoBlMap: ブロック編集マップ取得完了");

ResponseBody body = response.body();
if (body == null) {
System.out.printf("NewPlayerAutoBlMap: ブロック編集マップ取得失敗: body is null.\nhttps://jaoafa.com/cp/?uuid=%s%n", player.getUniqueId());
Main.getMyMaidLogger().info("NewPlayerAutoBlMap: ブロック編集マップ取得失敗: body is null.\nhttps://jaoafa.com/cp/?uuid=%s".formatted(player.getUniqueId()));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jaoafa/mymaid4/lib/MyMaidLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public static void debug(String message) {
if (!Main.getMyMaidConfig().isDevelopmentServer()) {
return;
}
System.out.printf("DEBUG -> %s%n", message);
Main.getMyMaidLogger().info("DEBUG -> %s".formatted(message));
}

public static NamedTextColor getNamedTextColor(String color) {
Expand Down

0 comments on commit 465da16

Please sign in to comment.