Skip to content

Commit

Permalink
Update CI and clang-tidy adaptions (hyrise#2402)
Browse files Browse the repository at this point in the history
Use Ubuntu 22.04 for the Docker CI image.
We now use the following compilers in the CI: (i) clang11 and clang 14 and (ii) GCC 9 and GCC 11.
Moreover,  many small adaptions to make clang-tidy14 happy.
  • Loading branch information
Bouncner authored Aug 30, 2022
1 parent 3228b77 commit 49f2199
Show file tree
Hide file tree
Showing 274 changed files with 2,157 additions and 1,729 deletions.
7 changes: 1 addition & 6 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
Expand Down Expand Up @@ -36,8 +35,6 @@ BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
# BreakAfterJavaFieldAnnotations: false
# BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
Expand All @@ -56,12 +53,9 @@ IncludeCategories:
Priority: 2
- Regex: '.*'
Priority: 3
# IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# InsertBraces: true TODO(anyone): enable when clang15 is widely used.
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
Expand All @@ -79,6 +73,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: false
SeparateDefinitionBlocks: Always
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
Expand Down
151 changes: 108 additions & 43 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,50 +1,108 @@
HeaderFilterRegex: '.*cpp$' # https://gitlab.kitware.com/cmake/cmake/issues/20058

Checks: '*,-*-default-arguments*,-*braces-around-statements,-google-build-using-namespace,-clang-analyzer-security.insecureAPI.rand,-readability-implicit-bool-conversion,-cppcoreguidelines-pro-type-reinterpret-cast,-readability-misleading-indentation,-modernize-pass-by-value,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-static-cast-downcast,-misc-unused-parameters,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-hicpp-no-array-decay,-readability-named-parameter,-cert-dcl58-cpp,-clang-analyzer-optin.cplusplus.VirtualCall,-modernize-avoid-bind,-hicpp-no-assembler,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-cert-env33-c,-misc-macro-parentheses,-readability-else-after-return,-fuchsia-overloaded-operator,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-google-runtime-references,-cert-err58-cpp,-llvm-include-order,-clang-analyzer-cplusplus.NewDelete*,-cert-msc32-c,-cert-msc51-cpp,-fuchsia-statically-constructed-objects,-bugprone-exception-escape,-*-uppercase-literal-suffix,-cert-dcl16-c,-*-magic-numbers,-*-non-private-member-variables-in-classes,-modernize-use-trailing-return-type,-clang-diagnostic-unknown-warning-option,-modernize-use-nodiscard,-cppcoreguidelines-init-variables'
Checks: '
*,
-*-default-arguments*,
-*braces-around-statements,
-google-build-using-namespace,
-clang-analyzer-security.insecureAPI.rand,
-readability-implicit-bool-conversion,
-cppcoreguidelines-pro-type-reinterpret-cast,
-readability-misleading-indentation,
-modernize-pass-by-value,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-static-cast-downcast,
-misc-unused-parameters,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-hicpp-no-array-decay,
-readability-named-parameter,
-cert-dcl58-cpp,
-clang-analyzer-optin.cplusplus.VirtualCall,
-modernize-avoid-bind,
-hicpp-no-assembler,
-cppcoreguidelines-pro-type-vararg,
-hicpp-vararg,
-cert-env33-c,
-misc-macro-parentheses,
-readability-else-after-return,
-fuchsia-overloaded-operator,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-google-runtime-references,
-cert-err58-cpp,
-llvm-include-order,
-clang-analyzer-cplusplus.NewDelete*,
-cert-msc32-c,
-cert-msc51-cpp,
-fuchsia-statically-constructed-objects,
-bugprone-exception-escape,
-*-uppercase-literal-suffix,
-cert-dcl16-c,
-*-magic-numbers,
-*-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type,
-clang-diagnostic-unknown-warning-option,
-modernize-use-nodiscard,
-cppcoreguidelines-init-variables,
-llvmlibc-*,
-altera-*,
-abseil-*,
-readability-use-anyofallof,
-readability-identifier-naming,
-misc-no-recursion,
-bugprone-easily-swappable-parameters,
-readability-function-cognitive-complexity
'

WarningsAsErrors: '*'

# Explanation of disabled checks:
# *-default-arguments* We do use default arguments (and like them)
# *braces-around-statements We do allow then blocks without braces if they are in the same line
# google-build-using-namespace While we discourage its use, in some cases, using namespace makes sense
# clang-analyzer-security.insecureAPI.rand We don't care about cryptographically unsafe rand() calls
# readability-implicit-bool-conversion Doesn't like if(map.count(foo))
# cppcoreguidelines-pro-type-reinterpret-cast We use reinterpret_cast
# readability-misleading-indentation Doesn't like if constexpr
# modernize-pass-by-value We don't trust people to properly use std::move
# cppcoreguidelines-pro-bounds-constant-array-index Weird stuff. "do not use array subscript when the index is not an integer constant expression"?!
# cppcoreguidelines-pro-type-static-cast-downcast We do allow static downcasts for performance reasons
# misc-unused-parameters We don't care about unused parameters
# cppcoreguidelines-pro-bounds-array-to-pointer-decay Weird stuff - it doesn't like `description_mode == DescriptionMode::MultiLine`
# hicpp-no-array-decay (same)
# readability-named-parameter Unused parameters don't need names
# cert-dcl58-cpp Adding a hash function to std is perfectly legal: https://en.cppreference.com/w/cpp/language/extending_std
# clang-analyzer-optin.cplusplus.VirtualCall false positive in boost::lexical_cast
# modernize-avoid-bind meh, bind isn't thaaaat bad
# hicpp-no-assembler Sometimes we need assembler...
# cppcoreguidelines-pro-type-vararg We use old C functions for ncurses
# hicpp-vararg (same)
# cert-env33-c Yes, we do call system()
# misc-macro-parentheses Causes weird problems with BOOST_PP_TUPLE_ELEM
# readability-else-after-return "do not use 'else' after 'return'" - no idea who originally came up with that...
# fuchsia-overloaded-operator We are not supposed to overload operator()?!
# cppcoreguidelines-pro-bounds-pointer-arithmetic Doesn't like DebugAssert
# google-runtime-references Doesn't like mutable references
# cert-err58-cpp We reeeeeally don't care about uncaught exceptions
# llvm-include-order Handled by cpplint.py which is way faster
# clang-analyzer-cplusplus.NewDelete* False positives with shared_ptr::operator=
# cert-msc32-c, -cert-msc51-cpp Ok, so our generated tables are not cryptographically safe
# fuchsia-statically-constructed-objects We have too many static objects
# bugprone-exception-escape We throw exceptions in many places (even destructors) and are completely fine with std::terminate
# *-uppercase-literal-suffix Don't really care if it's 1.0f or 1.0F
# cert-dcl16-c (same)
# *-magic-numbers Too many false positives
# *-non-private-member-variables-in-classes We like making things public
# modernize-use-trailing-return-type https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-trailing-return-type.html - no that is way too weird
# clang-diagnostic-unknown-warning-option Don't complain about gcc warning options
# modernize-use-nodiscard Don't want to tag everything [[nodiscard]]
# cppcoreguidelines-init-variables If a variable is only declared and initialized in two different branches, we do not want to initialize it first
# - *-default-arguments* We do use default arguments (and like them)
# - google-build-using-namespace While we discourage its use, in some cases, using namespace makes sense
# - clang-analyzer-security.insecureAPI.rand We don't care about cryptographically unsafe rand() calls
# - readability-implicit-bool-conversion Doesn't like if(map.count(foo))
# - cppcoreguidelines-pro-type-reinterpret-cast We use reinterpret_cast
# - readability-misleading-indentation Doesn't like if constexpr
# - modernize-pass-by-value We don't trust people to properly use std::move
# - cppcoreguidelines-pro-bounds-constant-array-index Weird stuff. "do not use array subscript when the index is not an integer constant expression"?!
# - cppcoreguidelines-pro-type-static-cast-downcast We do allow static downcasts for performance reasons
# - misc-unused-parameters We don't care about unused parameters
# - cppcoreguidelines-pro-bounds-array-to-pointer-decay Weird stuff - it doesn't like `description_mode == DescriptionMode::MultiLine`
# - hicpp-no-array-decay (same)
# - readability-named-parameter Unused parameters don't need names
# - cert-dcl58-cpp Adding a hash function to std is perfectly legal: https://en.cppreference.com/w/cpp/language/extending_std
# - clang-analyzer-optin.cplusplus.VirtualCall false positive in boost::lexical_cast
# - modernize-avoid-bind meh, bind isn't thaaaat bad
# - hicpp-no-assembler Sometimes we need assembler...
# - cppcoreguidelines-pro-type-vararg We use old C functions for ncurses
# - hicpp-vararg (same)
# - cert-env33-c Yes, we do call system()
# - misc-macro-parentheses Causes weird problems with BOOST_PP_TUPLE_ELEM
# - readability-else-after-return "do not use 'else' after 'return'" - no idea who originally came up with that...
# - fuchsia-overloaded-operator We are not supposed to overload operator()?!
# - cppcoreguidelines-pro-bounds-pointer-arithmetic Doesn't like DebugAssert
# - google-runtime-references Doesn't like mutable references
# - cert-err58-cpp We reeeeeally don't care about uncaught exceptions
# - llvm-include-order Handled by cpplint.py which is way faster
# - clang-analyzer-cplusplus.NewDelete* False positives with shared_ptr::operator=
# - cert-msc32-c, -cert-msc51-cpp Ok, so our generated tables are not cryptographically safe
# - fuchsia-statically-constructed-objects We have too many static objects
# - bugprone-exception-escape We throw exceptions in many places (even destructors) and are completely fine with std::terminate
# - *-uppercase-literal-suffix Don't really care if it's 1.0f or 1.0F
# - cert-dcl16-c (same)
# - *-magic-numbers Too many false positives
# - *-non-private-member-variables-in-classes We like making things public
# - modernize-use-trailing-return-type https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-trailing-return-type.html - no that is way too weird
# - clang-diagnostic-unknown-warning-option Don't complain about gcc warning options
# - modernize-use-nodiscard Don't want to tag everything [[nodiscard]]
# - cppcoreguidelines-init-variables If a variable is only declared and initialized in two different branches, we do not want to initialize it first
# - -llvmlibc-* LLVM-internal development guidelines.
# - altera-* Checks related to OpenCL programming for FPGAs.
# - abseil-* Checks related to Google's abseil library (not used in Hyrise).
# - readability-use-anyofallof We prefer `for (auto item : items)` over `std::ranges::all_of()` with a lambda.
# - readability-identifier-naming Error spamming on non-Hyrise code. LLVM Bug. TODO(anyone): test renabling with newer LLVM versions which fixes
# https://github.com/llvm/llvm-project/issues/46097
# - misc-no-recursion Ignore general recommendation to avoid recursion, which we commonly use when working with query plans.
# - bugprone-easily-swappable-parameters Ignore issues with swapple parameters as we found them to be of no help.
# - readability-function-cognitive-complexity When appropriate, long functions with a sequential data flow (which is sometimes easier to read) are fine. In many
# places, the rule catches functions where the code could be improved, but will likely not be due to a lack of time.


CheckOptions:
Expand Down Expand Up @@ -143,3 +201,10 @@ CheckOptions:

- key: readability-identifier-naming.VariableCase
value: lower_case

# Iff(!) the context is clear, 'it' for iterator, 'op' for operator, or 'fd' for functional dependency are fine.
- key: readability-identifier-length.IgnoredParameterNames
value: "^(it|fd|op)$"
- key: readability-identifier-length.IgnoredVariableNames
value: "^(it|fd|op)$"

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
url = https://github.com/skarupke/flat_hash_map.git
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/abseil/googletest.git
url = https://github.com/google/googletest.git
[submodule "third_party/jcch-dbgen"]
path = third_party/jcch-dbgen
url = https://github.com/mrks/dbgen.JCC-H.git
Expand Down
10 changes: 5 additions & 5 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
| ------------------------- | ---------------- | -------- | ------------------------------------- |
| autoconf | >= 2.69 | All | No |
| boost | >= 1.70.0 | All | No |
| clang | >= 9.0 | All | Yes, if gcc installed |
| clang-format | >= 9.0 | All | Yes (formatting) |
| clang-tidy | >= 9.0 | All | Yes (linting) |
| clang | >= 11.0 | All | Yes, if gcc installed |
| clang-format | >= 11.0 | All | Yes (formatting) |
| clang-tidy | >= 11.0 | All | Yes (linting) |
| coreutils | any | Mac | Yes (scripts) |
| cmake | >= 3.9 | All | No |
| dos2unix | any | All | Yes (linting) |
Expand All @@ -20,11 +20,11 @@
| parallel | any | All | Yes |
| pexpect | >= 4 | All | Yes (tests in CI) |
| postgresql-server-dev-all | >= 154 | Linux | No |
| python | 3 | All | Yes (linting and tests in CI) |
| python | >= 3.6 | All | Yes (linting and tests in CI) |
| readline | >= 7 | All | No |
| sqlite3 | >= 3 | All | No |
| tbb/libtbb-dev | any | All | No |
| valgrind | any | All | Yes, memory checking in CI |


For dependencies that are integrated in our build process via git submodules, please check .gitmodules
For dependencies that are integrated in our build process via git submodules, please check .gitmodules
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
# You need to build and push it manually, see the wiki for details:
# https://github.com/hyrise/hyrise/wiki/Docker-Image

FROM ubuntu:20.04
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y \
autoconf \
bash-completion \
bc \
clang-9 \
clang-10 \
clang-format-9 \
clang-format-10 \
clang-tidy-9 \
clang-tidy-10 \
clang-11 \
clang-14 \
clang-format-14 \
clang-tidy-14 \
cmake \
curl \
dos2unix \
g++-9 \
g++-11 \
gcc-9 \
gcc-11 \
gcovr \
git \
graphviz \
libboost1.71-all-dev \
libboost-all-dev \
libhwloc-dev \
libncurses5-dev \
libnuma-dev \
Expand All @@ -44,6 +44,7 @@ RUN apt-get update \
valgrind \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& ln -sf /usr/bin/llvm-symbolizer-3.8 /usr/bin/llvm-symbolizer
&& ln -sf /usr/bin/llvm-symbolizer-14 /usr/bin/llvm-symbolizer \
&& pip3 install scipy pandas matplotlib # preload large Python packages (installs numpy and others)

ENV HYRISE_HEADLESS_SETUP=true
Loading

0 comments on commit 49f2199

Please sign in to comment.