Skip to content

Commit

Permalink
sprint 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mweisgut authored and dey4ss committed Apr 18, 2023
1 parent 4caaa4f commit 79fd7a0
Show file tree
Hide file tree
Showing 57 changed files with 2,760 additions and 1 deletion.
94 changes: 94 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
# InsertBraces: true TODO(anyone): enable when clang15 is widely used.
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: false
SeparateDefinitionBlocks: Always
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...
133 changes: 133 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
Checks: '
*,
-*-default-arguments*,
-*braces-around-statements,
-google-build-using-namespace,
-clang-analyzer-security.insecureAPI.rand,
-readability-implicit-bool-conversion,
-cppcoreguidelines-pro-type-reinterpret-cast,
-modernize-pass-by-value,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-hicpp-no-array-decay,
-cert-dcl58-cpp,
-modernize-avoid-bind,
-cert-env33-c,
-misc-macro-parentheses,
-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,
-llvmlibc-*,
-altera-*,
-abseil-*,
-readability-use-anyofallof,
-readability-identifier-naming,
-misc-no-recursion,
-bugprone-easily-swappable-parameters,
-readability-function-cognitive-complexity,
-bugprone-suspicious-include,
-bugprone-unchecked-optional-access
'

WarningsAsErrors: '*'

# Explanation of disabled checks:
# - *-default-arguments* We do use default arguments (and like them)
# - google-build-using-namespace We use `using namespace` a lot (see anonymous namespaces and expression_functional)
# - 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
# - modernize-pass-by-value We don't trust people to properly use std::move
# - cppcoreguidelines-pro-bounds-constant-array-index "Do not use array subscript when the index is not an integer constant expression"?!
# - cppcoreguidelines-pro-type-static-cast-downcast We use static downcasts when we can safely obtain the type (e.g., static casts of LQPNodes via node->type)
# - cppcoreguidelines-pro-bounds-array-to-pointer-decay Weird stuff - it doesn't like `description_mode == DescriptionMode::MultiLine`
# - hicpp-no-array-decay (same)
# - cert-dcl58-cpp Adding a hash function to std is perfectly legal: https://en.cppreference.com/w/cpp/language/extending_std
# - modernize-avoid-bind meh, bind isn't thaaaat bad
# - cert-env33-c Yes, we do call system()
# - misc-macro-parentheses Causes weird problems with BOOST_PP_TUPLE_ELEM
# - 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]]
# - 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 swappable 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.
# - bugprone-suspicious-include Unity builds use `#include`s for cpp files. However, unity builds significantly improve the runtime of clang-tidy,
# which is otherwise the slowest step of the CI pipeline by a factor of two. Furthermore, the linter checks for
# these includes as well.
# - bugprone-unchecked-optional-access Too many false positives (with clang-tidy 14/15). TODO(anyone): Re-evaluate for future clang versions.


CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.ConstexprVariableCase, value: UPPER_CASE }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.GlobalFunctionCase, value: lower_case }
- { key: readability-identifier-naming.InlineNamespaceCase, value: lower_case }
- { key: readability-identifier-naming.LocalConstantCase, value: lower_case }
- { key: readability-identifier-naming.LocalVariableCase, value: lower_case }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: '_' }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: '_' }
- { key: readability-identifier-naming.PublicMemberCase, value: lower_case }
- { key: readability-identifier-naming.MethodCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMethodPrefix, value: '_' }
- { key: readability-identifier-naming.ProtectedMethodPrefix, value: '_' }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.ConstantParameterCase, value: lower_case }
- { key: readability-identifier-naming.ParameterPackCase, value: lower_case }
- { key: readability-identifier-naming.StaticConstantCase, value: lower_case }
- { key: readability-identifier-naming.StaticVariableCase, value: lower_case }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: UPPER_CASE }
- { key: readability-identifier-naming.TemplateTemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateUsingCase, value: lower_case }
- { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.UsingCase, value: lower_case }
- { key: readability-identifier-naming.ValueTemplateParameterCase, value: lower_case }
- { 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)$" }

115 changes: 115 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:

lint:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y parallel python3.10
- name: Run Lint Script
run: ./scripts/lint.sh


build:
name: ${{matrix.name}}
runs-on: ubuntu-22.04
env:
build_dir: cmake-build-ci
OPOSSUM_HEADLESS_SETUP: true
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: clangDebug
cc: clang
cxx: clang++
type: Debug

- name: gccDebug
cc: gcc
cxx: g++
type: Debug

- name: clangRelease
cc: clang
cxx: clang++
type: Release

- name: clangDebugTidy
cc: clang
cxx: clang++
type: Debug
build_options: -DCMAKE_UNITY_BUILD=ON -DCMAKE_CXX_CLANG_TIDY=clang-tidy

- name: clangDebugCoverage
cc: clang
cxx: clang++
type: Debug

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install Dependencies
# The install script installs clang-15 and gcc-11. If you want to update the compiler versions, update them there.
run: |
./install_dependencies.sh
sudo update-alternatives --config gcc
sudo update-alternatives --config clang
sudo update-alternatives --config clang++
sudo update-alternatives --config clang-tidy
sudo update-alternatives --config llvm-cov
- name: System Information
# Just ensure everything is set up correctly.
run: |
${{matrix.cc}} --version
${{matrix.cxx}} --version
clang-tidy --version
llvm-cov --version
- name: Setup CMake
run: cmake -B ${build_dir} -DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}} -DCMAKE_BUILD_TYPE=${{matrix.type}} ${{matrix.build_options}}

- name: Build the Library
if: matrix.name == 'clangDebugTidy'
run: make -C ${build_dir} opossum -j $(nproc) -k

- name: Build the Project
if: matrix.name != 'clangDebugTidy' && matrix.name != 'clangDebugCoverage'
run: make -C ${build_dir} -j $(nproc)

- name: Run Tests
if: matrix.name != 'clangDebugTidy' && matrix.name != 'clangDebugCoverage'
run: ${build_dir}/opossumTest

- name: Build and Run Tests for Coverage Report
if: matrix.name == 'clangDebugCoverage'
continue-on-error: true
run: |
make -C ${build_dir} opossumCoverage -j $(nproc)
./${build_dir}/opossumCoverage
- name: Create Coverage Report
if: matrix.name == 'clangDebugCoverage'
# We cannot use ./scripts/coverage.sh directly because we need to explicitly tell gcovr to use the clang version.
run: gcovr -s -r . --exclude="(.*types*.|.*test*.|.*\.pb\.|third_party)" --gcov-executable "llvm-cov gcov"
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
obj/*
.DS_STORE
build/*
build-*/*
cmake-build-*
*.make
Makefile*
coverage
.vscode
benchmark.json
*.sublime-*
.idea
*.xcodeproj
*.xcworkspace
.vscode
*.pyc
console.log
.repl_history
.queryplan.dot
queryplan.png
.lqp*.dot
lqp*.png
compile_times.txt
exported_table_statistics.json
version.hpp
provider.hpp

# Ignore cmake user files
*.txt.user

# Ignore generated TPC{CH} tables.
# Intentionally only for root dir, tests contain csv we check in
/*.csv
/*.csv.meta

# CLion cmake directory
cmake_build_*
gcoverage

# llvm coverage information
default.profdata
default.profraw
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "third_party/cpplint"]
path = third_party/cpplint
url = https://github.com/cpplint/cpplint.git
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
Loading

0 comments on commit 79fd7a0

Please sign in to comment.