Skip to content

Commit

Permalink
Initial commit of clang tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
SalusaSecondus committed Apr 14, 2022
1 parent 2e9ec9e commit e15da39
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
BasedOnStyle: WebKit
---
Language: Cpp
AlignConsecutiveMacros: true
AlignOperands: Align
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: false
ColumnLimit: 120
IncludeCategories:
- Regex: '^<openssl/'
Priority: 2
SortPriority: 0
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 3
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 4
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
MaxEmptyLinesToKeep: 3
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- TO_STRING
- TO_STRING_0
- CONCAT2
- CONCAT2_INTERNAL
...

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Current values are:
* External integration tests now skip certificate validation for expired certificates.
This is to work around external sites which may have allowed their certificates to expire.
[PR #190](https://github.com/corretto/amazon-corretto-crypto-provider/pull/189)
* Allows developers to run `clang-tidy` against the source by passing `-DUSE_CLANG_TIDY=true` to gradlew.
Example: `./gradlew -DUSE_CLANG_TIDY=true build`
This may require deleting `build/cmake` prior to running.
[PR #191](https://github.com/corretto/amazon-corretto-crypto-provider/pull/191)

### Patches
* Improve zeroization of DRBG output. [PR #162](https://github.com/corretto/amazon-corretto-crypto-provider/pull/162)
Expand Down
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ set(FORCE_DISABLE_RDRAND NO CACHE BOOL "Force CPUID detection of rdrand support
set(TEST_DATA_DIR ${PROJECT_SOURCE_DIR}/test-data/ CACHE STRING "Path to directory containing test data")
set(ORIG_SRCROOT ${PROJECT_SOURCE_DIR} CACHE STRING "Path to root of original package")
set(PROVIDER_VERSION_STRING "" CACHE STRING "X.Y.Z formatted version of the provider")
if (USE_CLANG_TIDY)
# https://releases.llvm.org/9.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html
# https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics
# TODO: Make this enforcing with "-warnings-as-errors=*;" once we're happy with the state
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=-*")
# Categories we want
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},bugprone-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},cert-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},cppcoreguidelines-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},clang-analyzer-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},performance-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},portability-*)
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},readability-*)

# Things we don't want
# We must use reinterpret cast to move things across the JNI boundary
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-pro-type-reinterpret-cast)
# We intentionally omit the parameters for jclass
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},-readability-named-parameter)
# We target older styles of C++. We can revisit these after checking all build chains
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY},-cppcoreguidelines-macro-usage)
# Anything referencing gsl:: (Guidelines support library) is too new for us
endif()

if (NOT DEFINED JACOCO_AGENT_JAR)
set(JACOCO_AGENT_JAR ${JACOCO_ROOT}/jacocoagent.jar)
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ task executeCmake(type: Exec) {
if (System.properties['TEST_JAVA_MAJOR_VERSION'] != null) {
args '-DTEST_JAVA_MAJOR_VERSION=' + System.properties['TEST_JAVA_MAJOR_VERSION']
}

if (System.properties['SINGLE_TEST'] != null) {
args '-DSINGLE_TEST=' + System.properties['SINGLE_TEST']

}
if (System.properties['USE_CLANG_TIDY'] != null) {
args '-DUSE_CLANG_TIDY=' + System.properties['USE_CLANG_TIDY']

}
args projectDir
}
Expand Down

0 comments on commit e15da39

Please sign in to comment.