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

Added some clang-tidy checks #9566

Merged
merged 59 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
de67bd7
Added some clang-tidy checks
alexey-milovidov Mar 8, 2020
1cba0ea
Merge branch 'master' into clang-tidy
alexey-milovidov Mar 8, 2020
7a7e45e
clang-tidy, part 1
alexey-milovidov Mar 8, 2020
1657b9f
clang-tidy, part 2
alexey-milovidov Mar 8, 2020
b53ec30
clang-tidy, part 3
alexey-milovidov Mar 8, 2020
79c6bd5
clang-tidy, part 4
alexey-milovidov Mar 8, 2020
e8b3bac
clang-tidy, part 5
alexey-milovidov Mar 8, 2020
2a4d545
clang-tidy, part 6
alexey-milovidov Mar 8, 2020
c24333a
clang-tidy, part 7
alexey-milovidov Mar 8, 2020
889ae03
clang-tidy, part 8
alexey-milovidov Mar 8, 2020
63cf9f8
clang-tidy, part 9
alexey-milovidov Mar 9, 2020
48c92cc
clang-tidy, part 10
alexey-milovidov Mar 9, 2020
6320f59
clang-tidy, part 11
alexey-milovidov Mar 9, 2020
cde492a
clang-tidy, part 12
alexey-milovidov Mar 9, 2020
7334c13
clang-tidy, part 13
alexey-milovidov Mar 9, 2020
d3aa0e8
clang-tidy, part 14
alexey-milovidov Mar 9, 2020
04239a0
clang-tidy, part 15
alexey-milovidov Mar 9, 2020
d1025b2
clang-tidy, part 16
alexey-milovidov Mar 9, 2020
c079a1e
clang-tidy, part 17
alexey-milovidov Mar 9, 2020
71e5c0e
clang-tidy, part 18
alexey-milovidov Mar 9, 2020
2ef5026
clang-tidy, part 19
alexey-milovidov Mar 9, 2020
c5f2e95
clang-tidy, part 20
alexey-milovidov Mar 9, 2020
3f455a0
clang-tidy, part 21
alexey-milovidov Mar 9, 2020
66582d6
clang-tidy, part 22
alexey-milovidov Mar 9, 2020
7c188b8
clang-tidy, part 23
alexey-milovidov Mar 9, 2020
10e5550
clang-tidy, part 24
alexey-milovidov Mar 9, 2020
1ab05b2
Don't run clang-tidy when compiling with gcc (it will be confused wit…
alexey-milovidov Mar 9, 2020
7596402
Searching for more variants of clang-tidy
alexey-milovidov Mar 9, 2020
89101c7
Searching for more variants of clang-tidy
alexey-milovidov Mar 9, 2020
fdba150
clang-tidy, part 25
alexey-milovidov Mar 9, 2020
cf9ba26
Merge branch 'master' of github.com:yandex/ClickHouse into clang-tidy
alexey-milovidov Mar 9, 2020
651070d
Merge branch 'master' into clang-tidy
alexey-milovidov Mar 9, 2020
fea40a5
Fixed error
alexey-milovidov Mar 9, 2020
d416d21
Fixed error
alexey-milovidov Mar 10, 2020
38d2868
Trigget CI
alesapin Mar 10, 2020
1224866
Merge branch 'master' into clang-tidy
alexey-milovidov Mar 10, 2020
27d60c6
Added unneeded unrelated changes just in case
alexey-milovidov Mar 10, 2020
cfc4ed2
Fixes after merge
alexey-milovidov Mar 10, 2020
6ae012c
Fixes after merge
alexey-milovidov Mar 10, 2020
e9dfb4e
Fixed clang-tidy warning
alexey-milovidov Mar 10, 2020
63d8391
Fixed error in blockSerializedSize function
alexey-milovidov Mar 10, 2020
4f0d0dd
\Merge branch 'master' into clang-tidy
alexey-milovidov Mar 10, 2020
0358be0
Merge branch 'master' of github.com:ClickHouse/ClickHouse into clang-…
alexey-milovidov Mar 10, 2020
bac6348
Merge branch 'master' of github.com:yandex/ClickHouse into clang-tidy
alexey-milovidov Mar 10, 2020
6107a53
Workaround for clang-tidy
alexey-milovidov Mar 11, 2020
59417db
Merge branch 'clang-tidy' of github.com:yandex/ClickHouse into clang-…
alexey-milovidov Mar 11, 2020
beed841
Merge branch 'master' into clang-tidy
alexey-milovidov Mar 11, 2020
9f38cb7
Fixed build
alexey-milovidov Mar 11, 2020
37d8a9d
Merge branch 'clang-tidy' of github.com:yandex/ClickHouse into clang-…
alexey-milovidov Mar 11, 2020
002f9e0
Merge branch 'master' of github.com:yandex/ClickHouse into clang-tidy
alexey-milovidov Mar 11, 2020
b130d2f
Changed repository address
alexey-milovidov Mar 11, 2020
5b2c750
Fixed build
alexey-milovidov Mar 11, 2020
268c360
Fixed build
alexey-milovidov Mar 11, 2020
8f78741
Fixed build
alexey-milovidov Mar 11, 2020
b024731
Fixed style
alexey-milovidov Mar 11, 2020
ec4794d
Better wording
alexey-milovidov Mar 11, 2020
3332048
Disable clang-tidy by default (it will be enabled on per-build basis)
alexey-milovidov Mar 11, 2020
1013fb9
Fixed minor issue in integration test
alexey-milovidov Mar 11, 2020
4543bca
Fixed error
alexey-milovidov Mar 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Checks: '-*,google-readability-avoid-underscore-in-googletest-name,misc-throw-by-value-catch-by-reference,misc-misplaced-const,misc-unconventional-assign-operator,modernize-avoid-bind,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-random-shuffle,modernize-use-bool-literals,modernize-use-nullptr,modernize-use-using,performance-faster-string-find,performance-for-range-copy,readability-avoid-const-params-in-decls,readability-const-return-type,readability-container-size-empty,readability-convert-member-functions-to-static,readability-delete-null-pointer,readability-deleted-default,readability-make-member-function-const,readability-misplaced-array-index,readability-non-const-parameter,readability-qualified-auto,readability-redundant-access-specifiers,readability-redundant-control-flow,readability-redundant-function-ptr-dereference,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,modernize-use-equals-default,modernize-use-equals-delete,bugprone-undelegated-constructor,readability-redundant-member-init,readability-simplify-subscript-expr,readability-simplify-boolean-expr,readability-inconsistent-declaration-parameter-name'
WarningsAsErrors: '*'
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Now user's profile in `users.xml` can inherit multiple profiles. [#8343](https://github.com/ClickHouse/ClickHouse/pull/8343) ([Mikhail f. Shiryaev](https://github.com/Felixoid))
* Added `system.stack_trace` table that allows to look at stack traces of all server threads. This is useful for developers to introspect server state. This fixes [#7576](https://github.com/ClickHouse/ClickHouse/issues/7576). [#8344](https://github.com/ClickHouse/ClickHouse/pull/8344) ([alexey-milovidov](https://github.com/alexey-milovidov))
* Add `DateTime64` datatype with configurable sub-second precision. [#7170](https://github.com/ClickHouse/ClickHouse/pull/7170) ([Vasily Nemkov](https://github.com/Enmk))
* Add table function `clusterAllReplicas` which allows to query all the nodes in the cluster. [#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari))
* Add table function `clusterAllReplicas` which allows to query all the nodes in the cluster. [#8493](https://github.com/ClickHouse/ClickHouse/pull/8493) ([kiran sunkari](https://github.com/kiransunkari))
* Add aggregate function `categoricalInformationValue` which calculates the information value of a discrete feature. [#8117](https://github.com/ClickHouse/ClickHouse/pull/8117) ([hcz](https://github.com/hczhcz))
* Speed up parsing of data files in `CSV`, `TSV` and `JSONEachRow` format by doing it in parallel. [#7780](https://github.com/ClickHouse/ClickHouse/pull/7780) ([Alexander Kuzmenkov](https://github.com/akuzm))
* Add function `bankerRound` which performs banker's rounding. [#8112](https://github.com/ClickHouse/ClickHouse/pull/8112) ([hcz](https://github.com/hczhcz))
Expand Down Expand Up @@ -718,7 +718,7 @@ fix comments to make obvious that it may throw.
* Add `LIMIT` option to `SHOW` query. [#6944](https://github.com/ClickHouse/ClickHouse/pull/6944) ([Philipp Malkovsky](https://github.com/malkfilipp))
* Add `bitmapSubsetLimit(bitmap, range_start, limit)` function, that returns subset of the smallest `limit` values in set that is no smaller than `range_start`. [#6957](https://github.com/ClickHouse/ClickHouse/pull/6957) ([Zhichang Yu](https://github.com/yuzhichang))
* Add `bitmapMin` and `bitmapMax` functions. [#6970](https://github.com/ClickHouse/ClickHouse/pull/6970) ([Zhichang Yu](https://github.com/yuzhichang))
* Add function `repeat` related to [issue-6648](https://github.com/yandex/ClickHouse/issues/6648) [#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL))
* Add function `repeat` related to [issue-6648](https://github.com/ClickHouse/ClickHouse/issues/6648) [#6999](https://github.com/ClickHouse/ClickHouse/pull/6999) ([flynn](https://github.com/ucasFL))

#### Experimental Feature
* Implement (in memory) Merge Join variant that does not change current pipeline. Result is partially sorted by merge key. Set `partial_merge_join = 1` to use this feature. The Merge Join is still in development. [#6940](https://github.com/ClickHouse/ClickHouse/pull/6940) ([Artem Zuikov](https://github.com/4ertus2))
Expand Down
19 changes: 1 addition & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ project(ClickHouse)
include (cmake/arch.cmake)
include (cmake/target.cmake)
include (cmake/tools.cmake)
include (cmake/analysis.cmake)

# Ignore export() since we don't use it,
# but it gets broken with a global targets via link_libraries()
Expand Down Expand Up @@ -285,24 +286,6 @@ if (USE_INCLUDE_WHAT_YOU_USE)
endif()
endif ()

# Using clang-tidy static analyzer http://mariobadr.com/using-clang-tidy-with-cmake-36.html https://cmake.org/cmake/help/v3.6/prop_tgt/LANG_CLANG_TIDY.html
option (ENABLE_CLANG_TIDY "Use 'clang-tidy' static analyzer" OFF)
if (ENABLE_CLANG_TIDY)
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
message(FATAL_ERROR "clang-tidy requires CMake version at least 3.6.")
endif()
find_program (CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable")
if (NOT CLANG_TIDY_EXE)
set (USE_CLANG_TIDY 0)
message (STATUS "clang-tidy not found.")
else ()
set (USE_CLANG_TIDY 1)
message (STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set (DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*")
# You can enable it within a directory by: set (CMAKE_CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif ()
endif ()

if (ENABLE_TESTS)
message (STATUS "Tests are enabled")
endif ()
Expand Down
4 changes: 4 additions & 0 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if (USE_CLANG_TIDY)
set (CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_PATH}")
endif ()

add_subdirectory (common)
add_subdirectory (loggers)
add_subdirectory (daemon)
Expand Down
2 changes: 1 addition & 1 deletion base/common/DateLUTImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
time_t start_of_day = DATE_LUT_MIN;

cctz::time_zone cctz_time_zone;
if (!cctz::load_time_zone(time_zone.data(), &cctz_time_zone))
if (!cctz::load_time_zone(time_zone, &cctz_time_zone))
throw Poco::Exception("Cannot load time zone " + time_zone_);

cctz::time_zone::absolute_lookup start_of_epoch_lookup = cctz_time_zone.lookup(std::chrono::system_clock::from_time_t(start_of_day));
Expand Down
4 changes: 2 additions & 2 deletions base/common/JSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ JSON::Pos JSON::skipArray() const
if (*pos == ']')
return ++pos;

while (1)
while (true)
{
pos = JSON(pos, ptr_end, level + 1).skipElement();

Expand Down Expand Up @@ -373,7 +373,7 @@ JSON::Pos JSON::skipObject() const
if (*pos == '}')
return ++pos;

while (1)
while (true)
{
pos = JSON(pos, ptr_end, level + 1).skipNameValuePair();

Expand Down
4 changes: 2 additions & 2 deletions base/common/getMemoryAmount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ uint64_t getMemoryAmountOrZero()
#endif
uint64_t size = 0; /* 64-bit */
size_t len = sizeof(size);
if (sysctl(mib, 2, &size, &len, NULL, 0) == 0)
if (sysctl(mib, 2, &size, &len, nullptr, 0) == 0)
return size;

return 0; /* Failed? */
Expand Down Expand Up @@ -88,7 +88,7 @@ uint64_t getMemoryAmountOrZero()
#endif
unsigned int size = 0; /* 32-bit */
size_t len = sizeof(size);
if (sysctl(mib, 2, &size, &len, NULL, 0) == 0)
if (sysctl(mib, 2, &size, &len, nullptr, 0) == 0)
return size;

return 0; /* Failed? */
Expand Down
2 changes: 1 addition & 1 deletion base/common/tests/date_lut_default_timezone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int argc, char ** argv)
{
const auto & date_lut = DateLUT::instance();
std::cout << "Detected default timezone: `" << date_lut.getTimeZone() << "'" << std::endl;
time_t now = time(NULL);
time_t now = time(nullptr);
std::cout << "Current time: " << date_lut.timeToString(now)
<< ", UTC: " << DateLUT::instance("UTC").timeToString(now) << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion base/common/tests/gtest_find_symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtest/gtest.h>


TEST(find_symbols, SimpleTest)
TEST(FindSymbols, SimpleTest)
{
std::string s = "Hello, world! Goodbye...";
const char * begin = s.data();
Expand Down