From cacca838393c791bbd091173da02b62bd87f9300 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 8 Aug 2020 04:39:08 +0300 Subject: [PATCH 1/7] Added a tool to check for typos; added dictionaries. --- utils/check-style/check-typos | 13 +++++++++++++ utils/check-style/codespell-ignore-files.list | 9 +++++++++ utils/check-style/codespell-ignore-words.list | 7 +++++++ 3 files changed, 29 insertions(+) create mode 100755 utils/check-style/check-typos create mode 100644 utils/check-style/codespell-ignore-files.list create mode 100644 utils/check-style/codespell-ignore-words.list diff --git a/utils/check-style/check-typos b/utils/check-style/check-typos new file mode 100755 index 00000000000..00c216b9cdc --- /dev/null +++ b/utils/check-style/check-typos @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Check for typos in code. + +ROOT_PATH=$(git rev-parse --show-toplevel) +CURDIR=$(dirname "${BASH_SOURCE[0]}") + +codespell \ + --skip '*generated*,*gperf*,*.bin,*.mrk*,*.idx,checksums.txt,*.dat,*.pyc,*.kate-swp' \ + --ignore-words "${CURDIR}/codespell-ignore-words.list" \ + --quiet-level 2 \ + "$ROOT_PATH"/{src,base,programs,utils} \ + $@ | grep -v -F --file="${CURDIR}/codespell-ignore-files.list" diff --git a/utils/check-style/codespell-ignore-files.list b/utils/check-style/codespell-ignore-files.list new file mode 100644 index 00000000000..203cbc2d630 --- /dev/null +++ b/utils/check-style/codespell-ignore-files.list @@ -0,0 +1,9 @@ +base/common/iostream_debug_helpers.h:156 +base/common/preciseExp10.cpp:54 +base/common/preciseExp10.cpp:87 +base/common/preciseExp10.cpp:88 +base/glibc-compatibility/musl/COPYRIGHT:49 +base/glibc-compatibility/musl/COPYRIGHT:82 +base/glibc-compatibility/musl/COPYRIGHT:83 +programs/server/Server.cpp:359 +utils/github/query.py:144 diff --git a/utils/check-style/codespell-ignore-words.list b/utils/check-style/codespell-ignore-words.list new file mode 100644 index 00000000000..4433e9917e3 --- /dev/null +++ b/utils/check-style/codespell-ignore-words.list @@ -0,0 +1,7 @@ +thenn +fpr +creat +parsering +nd +ect +pullrequest From 0688e1671f4d077bbcfc4e97358d6ebc33d3eaa4 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 8 Aug 2020 04:42:00 +0300 Subject: [PATCH 2/7] Run check-typos within check-style --- utils/check-style/check-style | 4 ++++ utils/check-style/check-typos | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/check-style/check-style b/utils/check-style/check-style index 939eb3ecca8..c3d923595db 100755 --- a/utils/check-style/check-style +++ b/utils/check-style/check-style @@ -68,3 +68,7 @@ find $ROOT_PATH -name '.gitmodules' | while read i; do grep -F 'url = ' $i | gre # There shouldn't be any code snippets under GPL or LGPL find $ROOT_PATH/{src,base,programs} -name '*.h' -or -name '*.cpp' 2>/dev/null | xargs grep -i -F 'General Public License' && echo "There shouldn't be any code snippets under GPL or LGPL" + +# Check for typos in code +CURDIR=$(dirname "${BASH_SOURCE[0]}") +"${CURDIR}"/check-typos diff --git a/utils/check-style/check-typos b/utils/check-style/check-typos index 00c216b9cdc..c61512200fd 100755 --- a/utils/check-style/check-typos +++ b/utils/check-style/check-typos @@ -10,4 +10,5 @@ codespell \ --ignore-words "${CURDIR}/codespell-ignore-words.list" \ --quiet-level 2 \ "$ROOT_PATH"/{src,base,programs,utils} \ - $@ | grep -v -F --file="${CURDIR}/codespell-ignore-files.list" + $@ | grep -v -F --file="${CURDIR}/codespell-ignore-files.list" \ + && echo "\nFound some typos in code.\nSee the files utils/check-style/codespell* if you want to add an exception." From 6c4df0f27ac26b4833def6df82d6aa9d44c0e171 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 8 Aug 2020 04:52:28 +0300 Subject: [PATCH 3/7] Better tool --- programs/server/Server.cpp | 2 +- utils/check-style/check-typos | 5 +++-- utils/check-style/codespell-ignore-files.list | 9 --------- utils/check-style/codespell-ignore-lines.list | 5 +++++ 4 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 utils/check-style/codespell-ignore-files.list create mode 100644 utils/check-style/codespell-ignore-lines.list diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index ddc5ec080fb..563ff8116bd 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -356,7 +356,7 @@ int Server::main(const std::vector & /*args*/) std::string path = getCanonicalPath(config().getString("path", DBMS_DEFAULT_PATH)); std::string default_database = config().getString("default_database", "default"); - /// Check that the process' user id matches the owner of the data. + /// Check that the process user id matches the owner of the data. const auto effective_user_id = geteuid(); struct stat statbuf; if (stat(path.c_str(), &statbuf) == 0 && effective_user_id != statbuf.st_uid) diff --git a/utils/check-style/check-typos b/utils/check-style/check-typos index c61512200fd..14deb039059 100755 --- a/utils/check-style/check-typos +++ b/utils/check-style/check-typos @@ -8,7 +8,8 @@ CURDIR=$(dirname "${BASH_SOURCE[0]}") codespell \ --skip '*generated*,*gperf*,*.bin,*.mrk*,*.idx,checksums.txt,*.dat,*.pyc,*.kate-swp' \ --ignore-words "${CURDIR}/codespell-ignore-words.list" \ + --exclude-file "${CURDIR}/codespell-ignore-lines.list" \ --quiet-level 2 \ "$ROOT_PATH"/{src,base,programs,utils} \ - $@ | grep -v -F --file="${CURDIR}/codespell-ignore-files.list" \ - && echo "\nFound some typos in code.\nSee the files utils/check-style/codespell* if you want to add an exception." + $@ | grep -P '.' \ + && echo -e "\nFound some typos in code.\nSee the files utils/check-style/codespell* if you want to add an exception." diff --git a/utils/check-style/codespell-ignore-files.list b/utils/check-style/codespell-ignore-files.list deleted file mode 100644 index 203cbc2d630..00000000000 --- a/utils/check-style/codespell-ignore-files.list +++ /dev/null @@ -1,9 +0,0 @@ -base/common/iostream_debug_helpers.h:156 -base/common/preciseExp10.cpp:54 -base/common/preciseExp10.cpp:87 -base/common/preciseExp10.cpp:88 -base/glibc-compatibility/musl/COPYRIGHT:49 -base/glibc-compatibility/musl/COPYRIGHT:82 -base/glibc-compatibility/musl/COPYRIGHT:83 -programs/server/Server.cpp:359 -utils/github/query.py:144 diff --git a/utils/check-style/codespell-ignore-lines.list b/utils/check-style/codespell-ignore-lines.list new file mode 100644 index 00000000000..526418377a5 --- /dev/null +++ b/utils/check-style/codespell-ignore-lines.list @@ -0,0 +1,5 @@ +/// https://groups.google.com/forum/#!searchin/kona-dev/variadic$20macro%7Csort:date/kona-dev/XMA-lDOqtlI/GCzdfZsD41sJ +Jo-Philipp Wich +The TRE regular expression implementation (src/regex/reg* and +src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed + pullRequests(first: {min_page_size} baseRefName: "{base}" headRefName: "{head}") {{ From 726f5b082ae70799011f25f2ccc9f15bb4af7651 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 8 Aug 2020 07:56:13 +0300 Subject: [PATCH 4/7] Fix build --- utils/check-style/codespell-ignore-lines.list | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/check-style/codespell-ignore-lines.list b/utils/check-style/codespell-ignore-lines.list index 526418377a5..7c2959e9468 100644 --- a/utils/check-style/codespell-ignore-lines.list +++ b/utils/check-style/codespell-ignore-lines.list @@ -3,3 +3,4 @@ Jo-Philipp Wich The TRE regular expression implementation (src/regex/reg* and src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed pullRequests(first: {min_page_size} baseRefName: "{base}" headRefName: "{head}") {{ + uint64_t time_to_wait = nanoseconds * timebase_info.denom / timebase_info.numer; From 47889b0f2b14c2d5f074880c8da9548dae123169 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 16 Aug 2020 14:59:16 +0300 Subject: [PATCH 5/7] Install codespell --- docker/test/style/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/test/style/Dockerfile b/docker/test/style/Dockerfile index 0f5c8d35fa9..1a4356caced 100644 --- a/docker/test/style/Dockerfile +++ b/docker/test/style/Dockerfile @@ -1,7 +1,7 @@ -# docker build -t yandex/clickhouse-style-test . +# docker build -t yandex/clickhouse-style-test . FROM ubuntu:20.04 -RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes shellcheck libxml2-utils git +RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes shellcheck libxml2-utils git python3-pip && pip3 install codespell CMD cd /ClickHouse/utils/check-style && ./check-style -n | tee /test_output/style_output.txt && \ From 09846a92cd28861df72b62a9e3bbbceeda29a8c2 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 16 Aug 2020 15:09:41 +0300 Subject: [PATCH 6/7] Fix typos --- src/Common/tests/gtest_thread_pool_schedule_exception.cpp | 2 +- src/Processors/Pipe.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Common/tests/gtest_thread_pool_schedule_exception.cpp b/src/Common/tests/gtest_thread_pool_schedule_exception.cpp index 73fdce1cad8..95b983cc3bb 100644 --- a/src/Common/tests/gtest_thread_pool_schedule_exception.cpp +++ b/src/Common/tests/gtest_thread_pool_schedule_exception.cpp @@ -20,7 +20,7 @@ static bool check() /// as soon as the throwing thread executed. /// This innocent thread may or may not be executed, the following possibilities exist: - /// 1. The throwing thread has already throwed exception and the attempt to schedule the innocent thread will rethrow it. + /// 1. The throwing thread has already thrown exception and the attempt to schedule the innocent thread will rethrow it. /// 2. The throwing thread has not executed, the innocent thread will be scheduled and executed. /// 3. The throwing thread has not executed, the innocent thread will be scheduled but before it will be executed, /// the throwing thread will be executed and throw exception and it will prevent starting of execution of the innocent thread diff --git a/src/Processors/Pipe.cpp b/src/Processors/Pipe.cpp index e6749827efe..93dcd561c00 100644 --- a/src/Processors/Pipe.cpp +++ b/src/Processors/Pipe.cpp @@ -74,7 +74,7 @@ static OutputPort * uniteTotals(const OutputPortRawPtrs & ports, const Block & h if (ports.size() == 1) return ports.front(); - /// Calculate totals fro several streams. + /// Calculate totals from several streams. /// Take totals from first sources which has any, skip others. /// ->> Concat -> Limit From ea611e8f73d41d6a8f1eb21db05ef56d112ac3d3 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 16 Aug 2020 15:11:02 +0300 Subject: [PATCH 7/7] Fix typos --- benchmark/monetdb/usability.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/monetdb/usability.md b/benchmark/monetdb/usability.md index 20eaf37f9e8..741079b5663 100644 --- a/benchmark/monetdb/usability.md +++ b/benchmark/monetdb/usability.md @@ -2,7 +2,7 @@ Go to https://www.monetdb.org/ The graphical design of the website is a bit old-fashioned but I do not afraid. -Dowload now. +Download now. Latest binary releases. Ubuntu & Debian. @@ -1103,7 +1103,7 @@ Ok, it's doing something at least for twenty minues... clk: 28:02 min ``` -Finally it has loaded data successfuly in 28 minutes. It's not fast - just below 60 000 rows per second. +Finally it has loaded data successfully in 28 minutes. It's not fast - just below 60 000 rows per second. But the second query from the test does not work: