Skip to content

Commit

Permalink
chore: clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
aucker committed Apr 18, 2024
1 parent 8bb6c61 commit c9fa880
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BasedOnStyle: Google
DerivePointerAlignment: false
# PointerAlignment: Right
# ColumnLimit: 120

# Default for clang-8, changed in later clangs. Set explicitly for forwards
# compatibility for students with modern clangs
IncludeBlocks: Preserve
97 changes: 97 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Modified from the Apache Arrow project for the Terrier project.
#
---
Checks: '
bugprone-*,
clang-analyzer-*,
google-*,
modernize-*,
performance-*,
portability-*,
readability-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-narrowing-conversions,
-bugprone-reserved-identifier,
-bugprone-signed-char-misuse,
-bugprone-suspicious-include,
-bugprone-unhandled-self-assignment,
-clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-cplusplus.NewDeleteLeaks,
-clang-analyzer-security.insecureAPI.rand,
-clang-diagnostic-implicit-int-float-conversion,
-google-readability-avoid-underscore-in-googletest-name,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
-readability-convert-member-functions-to-static,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-magic-numbers,
-readability-make-member-function-const,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-bugprone-exception-escape,
'
CheckOptions:
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.MemberSuffix, value: _ }
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
WarningsAsErrors: '*'
HeaderFilterRegex: '/(src|test)/include'
AnalyzeTemporaryDtors: true

#### Disabled checks and why: #####
#
# -readability-convert-member-functions-to-static,
# This check started going off in the upgrade from clang-tidy-8 to clang-tidy-12. It is not always correct because
# we hide the reference implementation in another repository.
# -clang-analyzer-security.insecureAPI.rand, -clang-analyzer-security.insecureAPI.rand, -bugprone-unhandled-self-assignment,
# -bugprone-implicit-widening-of-multiplication-result
# These have not been investigated yet.
# -bugprone-reserved-identifier,
# Fails due to use of some __SHORT_FILE__ symbol, originating from very old code.
# -bugprone-suspicious-include,
# False positive due to GTest code.
# -bugprone-too-small-loop-variable,
# Complains about uint8_t or uint16_t when the limit on the loop is a container's .size() (size_t).
# We usually do this when we know the maximum size of the container though, so propose leaving disabled.
# -clang-analyzer-cplusplus.NewDelete,
# Seems to generate false positives. Suggest relying on ASAN and valgrind for memory stuff.
# -clang-analyzer-cplusplus.NewDeleteLeaks,
# Seems to generate false positives. Suggest relying on ASAN and valgrind for memory stuff.
# -modernize-use-nodiscard,
# New C++17 feature, slightly polarizing. Would clutter codebase.
# -modernize-avoid-c-arrays,
# We use C-style arrays in page.h, type.h and logger.h. They're a little more ergonomic than std::array. Thoughts?
# -readability-magic-numbers,
# Let's not deal with people doing ridiculous things to hack around this. If it bites them, it bites them.
# -bugprone-signed-char-misuse, -clang-diagnostic-implicit-int-float-conversion, -readability-make-member-function-const,
# -readability-qualified-auto, -readability-redundant-access-specifiers
# These were previously disabled for not being available in clang-tidy-8. They are now available on our clang-tidy-12,
# and potentially worth investigating/fixing.
# -bugprone-exception-escape
# Weird. No idea how to resolve.

0 comments on commit c9fa880

Please sign in to comment.