Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Checks: 'clang-diagnostic-*,
clang-analyzer-*,
cppcoreguidelines-*,
modernize-*,
performance-*,
readability-*,
bugprone-*,
misc-*,
-modernize-use-trailing-return-type,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-avoid-c-arrays,
-modernize-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-readability-named-parameter,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-bugprone-easily-swappable-parameters,
-misc-non-private-member-variables-in-classes,
-cppcoreguidelines-non-private-member-variables-in-classes,
-readability-braces-around-statements,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-no-malloc,
-modernize-use-nodiscard,
-readability-else-after-return,
-readability-implicit-bool-conversion,
-readability-uppercase-literal-suffix,
-bugprone-branch-clone,
-bugprone-signed-char-misuse,
-misc-unused-parameters,
-cppcoreguidelines-special-member-functions
'

WarningsAsErrors: ''
HeaderFilterRegex: '.*/flashinfer/(include|csrc)/.*'
FormatStyle: file

CheckOptions:
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.ConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The value lower_case_ for MemberCase seems incorrect, especially in combination with PrivateMemberSuffix: '_'. This configuration implies that non-private member variables must end with an underscore (e.g., var_), and private member variables must end with a double underscore (e.g., var__) to pass the linter. This is likely not the intended style.

This is also inconsistent with VariableCase and ParameterCase which are set to lower_case.

For a more conventional style where private members are suffixed with an underscore and public members are not, you should set MemberCase to lower_case.

    value: lower_case

- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ repos:
exclude: |
(?x)^(3rdparty/.* flashinfer/jit/aot_config.py)$

# Clang-tidy linter for C++ code
- repo: local
hooks:
- id: clang-tidy
name: clang-tidy
entry: bash -c 'clang-tidy "$@" -- -I./include -I./csrc -std=c++17' --
language: system
types_or: [c++, c, cuda]
files: ^(include|csrc)/
exclude: ^3rdparty/
require_serial: true

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.17.1' # Use the sha / tag you want to point at
hooks:
Expand Down
Loading