From 5f984be4fb6f69e7d8040c139e3a74af963cb6e8 Mon Sep 17 00:00:00 2001 From: ZhangJian He Date: Mon, 20 May 2024 14:04:59 +0800 Subject: [PATCH] ci: introduce typo check (#38) Signed-off-by: ZhangJian He --- .github/workflows/line_lint.yml | 2 +- .github/workflows/typo_check.yml | 13 ++++++++ .../client/jdk/OpenGeminiJdkClient.java | 30 +++++++++---------- 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/typo_check.yml diff --git a/.github/workflows/line_lint.yml b/.github/workflows/line_lint.yml index 049eec2d..222e062e 100644 --- a/.github/workflows/line_lint.yml +++ b/.github/workflows/line_lint.yml @@ -4,7 +4,7 @@ on: branches: - main jobs: - build: + line_lint: name: line lint runs-on: ubuntu-latest steps: diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml new file mode 100644 index 00000000..b89a9f91 --- /dev/null +++ b/.github/workflows/typo_check.yml @@ -0,0 +1,13 @@ +name: typo check +on: + pull_request: + branches: + - main +jobs: + typo_check: + name: typo check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check typos + uses: crate-ci/typos@master diff --git a/opengemini-client-jdk/src/main/java/io/opengemini/client/jdk/OpenGeminiJdkClient.java b/opengemini-client-jdk/src/main/java/io/opengemini/client/jdk/OpenGeminiJdkClient.java index ce2b5d8d..0d1a445c 100644 --- a/opengemini-client-jdk/src/main/java/io/opengemini/client/jdk/OpenGeminiJdkClient.java +++ b/opengemini-client-jdk/src/main/java/io/opengemini/client/jdk/OpenGeminiJdkClient.java @@ -51,21 +51,21 @@ public CompletableFuture createDatabase(String database) { String command = "CREATE DATABASE \"%s\"".formatted(database); Query query = new Query(command); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); + return httpExecute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); } public CompletableFuture dropDatabase(String database) { String command = "DROP DATABASE \"%s\"".formatted(database); Query query = new Query(command); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); + return httpExecute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); } public CompletableFuture> showDatabases() { String command = "SHOW DATABASES"; Query query = new Query(command); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class) + return httpExecute(queryUrl, QueryResult.class) .thenApply(rsp -> rsp.getResults().get(0).getSeries().get(0).getValues().stream() .map(x -> String.valueOf(x.get(0))).toList()); } @@ -94,7 +94,7 @@ public CompletableFuture createRetentionPolicy(String database, RpConfig r } Query query = new Query(command.toString()); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); + return httpExecute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); } private List converseRps(List> queryRpValues) { @@ -126,7 +126,7 @@ public CompletableFuture> showRetentionPolicies(String dat query.setDatabase(database); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class) + return httpExecute(queryUrl, QueryResult.class) .thenApply(rsp -> converseRps(rsp.getResults().get(0).getSeries().get(0).getValues())); } @@ -134,19 +134,19 @@ public CompletableFuture dropRetentionPolicy(String database, String reten String command = "DROP RETENTION POLICY %s ON \"%s\"".formatted(retentionPolicy, database); Query query = new Query(command); String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); + return httpExecute(queryUrl, QueryResult.class, UrlConst.POST).thenApply(rsp -> null); } public CompletableFuture query(Query query) { String queryUrl = getQueryUrl(query); - return httpExcute(queryUrl, QueryResult.class); + return httpExecute(queryUrl, QueryResult.class); } public CompletableFuture write(String database, Point point) { String writeUrl = getWriteUrl(database); String body = point.toString(); - return httpExcute(writeUrl, Void.class, UrlConst.POST, HttpRequest.BodyPublishers.ofString(body)); + return httpExecute(writeUrl, Void.class, UrlConst.POST, HttpRequest.BodyPublishers.ofString(body)); } public CompletableFuture writeBatch(String database, List points) { @@ -154,19 +154,19 @@ public CompletableFuture writeBatch(String database, List points) { StringJoiner sj = new StringJoiner("\n"); points.forEach(point -> sj.add(point.toString())); - return httpExcute(writeUrl, Void.class, UrlConst.POST, HttpRequest.BodyPublishers.ofString(sj.toString())); + return httpExecute(writeUrl, Void.class, UrlConst.POST, HttpRequest.BodyPublishers.ofString(sj.toString())); } - private CompletableFuture httpExcute(String url, Class type) { - return httpExcute(url, type, UrlConst.GET); + private CompletableFuture httpExecute(String url, Class type) { + return httpExecute(url, type, UrlConst.GET); } - private CompletableFuture httpExcute(String url, Class type, String method) { - return httpExcute(url, type, method, HttpRequest.BodyPublishers.noBody()); + private CompletableFuture httpExecute(String url, Class type, String method) { + return httpExecute(url, type, method, HttpRequest.BodyPublishers.noBody()); } - private CompletableFuture httpExcute(String url, Class type, - String method, HttpRequest.BodyPublisher bodyPublisher) { + private CompletableFuture httpExecute(String url, Class type, + String method, HttpRequest.BodyPublisher bodyPublisher) { CompletableFuture> future; if (UrlConst.GET.equals(method)) { future = get(url);