-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORMAT - Add .clang-format and .pre-commit-config.yaml
Change-Id: Ia8e9779db328680031f219369287b66df64024ee Signed-off-by: Galantsev, Dmitrii <[email protected]>
- Loading branch information
1 parent
9bfdca2
commit c066360
Showing
22 changed files
with
3,258 additions
and
3,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
ColumnLimit: 100 | ||
IndentCaseBlocks: true | ||
IndentWidth: 4 | ||
MaxEmptyLinesToKeep: 2 | ||
SpaceAfterTemplateKeyword: false | ||
SpacesBeforeTrailingComments: 4 | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left | ||
ReferenceAlignment: Left | ||
Standard: Latest | ||
|
||
# These must go in order from most to least specific. | ||
# Priority number goes from lowest to highest. | ||
# Higher the number - lower the include position. | ||
IncludeCategories: | ||
# "*" | ||
- Regex: '^".*"' | ||
Priority: 1 | ||
CaseSensitive: false | ||
# <sys/*.h> and <*.h> together | ||
- Regex: '^<sys/.*\.h>' | ||
Priority: 2 | ||
CaseSensitive: false | ||
# <*/*.h> after <*> | ||
- Regex: '^<.*/.*\.h>' | ||
Priority: 4 | ||
CaseSensitive: false | ||
# <sys/*.h> and <*.h> together | ||
- Regex: '^<.*\.h>' | ||
Priority: 2 | ||
CaseSensitive: false | ||
# <*> | ||
- Regex: '^<.*' | ||
Priority: 3 | ||
CaseSensitive: false | ||
# * | ||
- Regex: '.*' | ||
Priority: 5 | ||
CaseSensitive: false | ||
|
||
IndentAccessModifiers: true | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# THIS FILE IS GENERATED FROM .clangd! | ||
# Run ./.update-clang-tidy.sh to regenerate. | ||
Checks: | ||
bugprone*, | ||
clang-analyzer*, | ||
google*, | ||
misc*, | ||
modernize*, | ||
-abseil*, | ||
-bugprone-easily-swappable-parameters, | ||
-bugprone-reserved-identifier, | ||
-clang-analyzer-security.insecureAPI.strcpy, | ||
-cppcoreguidelines*, | ||
-cppcoreguidelines-pro*, | ||
-misc-non-copyable-objects, | ||
-misc-use-anonymous-namespace, | ||
-modernize-avoid-c-arrays, | ||
-modernize-redundant-void-arg, | ||
-modernize-use-auto, | ||
-modernize-use-nodiscard, | ||
-modernize-use-noexcept, | ||
-modernize-use-trailing-return-type, | ||
-modernize-use-using, | ||
-performance*, | ||
-readability*, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
CompileFlags: | ||
Remove: -W* | ||
Add: [-Wall, -pedantic, -I/opt/rocm/include, -I/opt/rocm/include/hsa] | ||
Compiler: clang++ | ||
|
||
# list here: https://clang.llvm.org/extra/clang-tidy/checks/list.html | ||
Diagnostics: | ||
UnusedIncludes: Strict | ||
ClangTidy: | ||
Add: [ | ||
bugprone*, | ||
clang-analyzer*, | ||
google*, | ||
misc*, | ||
modernize*, | ||
] | ||
Remove: [ | ||
abseil*, | ||
bugprone-easily-swappable-parameters, | ||
bugprone-reserved-identifier, | ||
clang-analyzer-security.insecureAPI.strcpy, | ||
cppcoreguidelines*, | ||
cppcoreguidelines-pro*, | ||
misc-non-copyable-objects, | ||
misc-use-anonymous-namespace, | ||
modernize-avoid-c-arrays, | ||
modernize-redundant-void-arg, | ||
modernize-use-auto, | ||
modernize-use-nodiscard, | ||
modernize-use-noexcept, | ||
modernize-use-trailing-return-type, | ||
modernize-use-using, | ||
performance*, | ||
readability*, | ||
] | ||
#CheckOptions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# NOTE! Please use 'git ls-files -i --exclude-standard' | ||
# command after changing this file, to see if there are | ||
# any tracked files which get ignored after the change. | ||
|
||
# VisualStudioCode | ||
.vscode/ | ||
|
||
# Below files generated via CMake | ||
|
||
# Build directory | ||
build/ | ||
|
||
# CMake cache | ||
.cache/ | ||
|
||
# Simulated SYSFS - for early development or debug | ||
device/ | ||
|
||
# Misc | ||
__pycache__ | ||
README | ||
README.html | ||
|
||
# do NOT ignore these files | ||
!.clang-format | ||
!.clang-tidy | ||
!.clangd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# - How to use: | ||
# python3 -m pip install pre-commit | ||
# pre-commit install --install hooks | ||
# Upon a new commit - the hooks should automagically run | ||
# | ||
# - How to skip: | ||
# git commit --no-verify | ||
# or | ||
# SKIP=clang-format-docker git commit | ||
# SKIP=cpplint-docker git commit | ||
|
||
fail_fast: false | ||
repos: | ||
# For portability I decided to use Docker containers | ||
- repo: https://github.com/dmitrii-galantsev/pre-commit-docker-cpplint | ||
rev: 0.0.3 | ||
hooks: | ||
- id: clang-format-docker | ||
# - id: cpplint-docker | ||
# Below is a local way of running formatters and linters | ||
# NOTE: clang-tidy is not used in the above tests | ||
# - repo: https://github.com/pocc/pre-commit-hooks | ||
# rev: v1.3.5 | ||
# hooks: | ||
# - id: clang-format | ||
# args: [--no-diff, -i] | ||
# - id: clang-tidy | ||
# args: [-p=build, --quiet] | ||
# - id: cpplint | ||
# args: [--verbose=5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x # trace | ||
set -e # exit immediately if command fails | ||
set -u # exit if an undefined variable is found | ||
|
||
awk ' | ||
BEGIN { | ||
print "# THIS FILE IS GENERATED FROM .clangd!" | ||
print "# Run ./.update-clang-tidy.sh to regenerate." | ||
print "Checks:" | ||
} | ||
/Add: \[$/{ | ||
a=1 | ||
next | ||
} | ||
/]/{ | ||
a=0 | ||
} | ||
a{ | ||
gsub(/^\s+/," ") | ||
} | ||
/Remove: \[$/{ | ||
r=1 | ||
next | ||
} | ||
/]/{ | ||
r=0 | ||
} | ||
r{ | ||
gsub(/^\s+/," -") | ||
} | ||
' .clangd | tee .clang-tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.