Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update presets and add a basic clang-tidy config #2056

Merged
merged 2 commits into from
Sep 20, 2024
Merged
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
16 changes: 16 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Checks:
- clang-diagnostic-*
- clang-analyzer-*
- clang-analyzer-core.*
- clang-analyzer-cplusplus.*
- clang-analyzer-nullability.*
- clang-analyzer-unix.*
- performance-*
- bugprone-use-after-move
- bugprone-move-forwarding-reference
- cppcoreguidelines-rvalue-reference-param-not-moved
- misc-unused-parameters
WarningsAsErrors: 'bugprone-use-after-move'
# UseColor true causes sarif conversion and reviewdog fail
UseColor: false
ExtraArgsBefore: ['-Wno-unknown-warning-option']
82 changes: 43 additions & 39 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
{
"version": 3,
"configurePresets": [
{
"name": "scap-drivers",
"displayName": "Build scap drivers and their tests",
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-scap-drivers",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_BPF": "ON",
"BUILD_DRIVER": "ON",
"USE_BUNDLED_DEPS": "ON",
"ENABLE_DRIVERS_TESTS": "ON",
"MODERN_BPF_DEBUG_MODE": "ON",
"BUILD_LIBSCAP_MODERN_BPF": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"CREATE_TEST_TARGETS": "ON",
"ENABLE_LIBSCAP_TESTS": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
},
{
"name": "sinsp-minimal",
"displayName": "Build sinsp in minimal build",
"description": "Build sinsp in minimal build with its tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-sinsp-minimal",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"USE_BUNDLED_DEPS": "ON",
"CREATE_TEST_TARGETS": "ON",
"MINIMAL_BUILD": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF"
}
}
]
"version": 3,
"configurePresets": [
{
"name": "scap-drivers",
"displayName": "Build scap drivers and their tests",
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-scap-drivers",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_BPF": "ON",
"BUILD_DRIVER": "ON",
"USE_BUNDLED_DEPS": "ON",
"ENABLE_DRIVERS_TESTS": "ON",
"MODERN_BPF_DEBUG_MODE": "ON",
"BUILD_LIBSCAP_MODERN_BPF": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"CREATE_TEST_TARGETS": "ON",
"ENABLE_LIBSCAP_TESTS": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
},
{
"name": "sinsp-minimal",
"displayName": "Build sinsp in minimal build",
"description": "Build sinsp in minimal build with its tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-sinsp-minimal",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"USE_BUNDLED_DEPS": "ON",
"CREATE_TEST_TARGETS": "ON",
"MINIMAL_BUILD": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
}
Comment on lines +3 to +43
Copy link
Contributor

Choose a reason for hiding this comment

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

Not something for this PR, but we could create a default preset in order to reduce some of the configuration.

Suggested change
"configurePresets": [
{
"name": "scap-drivers",
"displayName": "Build scap drivers and their tests",
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-scap-drivers",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_BPF": "ON",
"BUILD_DRIVER": "ON",
"USE_BUNDLED_DEPS": "ON",
"ENABLE_DRIVERS_TESTS": "ON",
"MODERN_BPF_DEBUG_MODE": "ON",
"BUILD_LIBSCAP_MODERN_BPF": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"CREATE_TEST_TARGETS": "ON",
"ENABLE_LIBSCAP_TESTS": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
},
{
"name": "sinsp-minimal",
"displayName": "Build sinsp in minimal build",
"description": "Build sinsp in minimal build with its tests",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build-sinsp-minimal",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"USE_BUNDLED_DEPS": "ON",
"CREATE_TEST_TARGETS": "ON",
"MINIMAL_BUILD": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
}
"configurePresets": [
{
"name": "default",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"BUILD_DRIVER": "ON",
"BUILD_BPF": "ON",
"USE_BUNDLED_DEPS": "ON",
"CREATE_TEST_TARGETS": "ON",
"MINIMAL_BUILD": "ON",
"SCAP_FILES_SUITE_ENABLE": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"BUILD_WARNINGS_AS_ERRORS": "ON"
}
},
{
"name": "scap-drivers",
"displayName": "Build scap drivers and their tests",
"description": "Build all scap drivers (modern eBPF, legacy eBPF, kmod) and their tests",
"inherits": "default",
"binaryDir": "${sourceDir}/build-scap-drivers",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ENABLE_DRIVERS_TESTS": "ON",
"MODERN_BPF_DEBUG_MODE": "ON",
"BUILD_LIBSCAP_MODERN_BPF": "ON",
"BUILD_LIBSCAP_GVISOR": "OFF",
"ENABLE_LIBSCAP_TESTS": "ON"
}
},
{
"name": "sinsp-minimal",
"displayName": "Build sinsp in minimal build",
"description": "Build sinsp in minimal build with its tests",
"inherits": "default",
"binaryDir": "${sourceDir}/build-sinsp-minimal"
}

You might need to also specify binaryDir for the default profile, I haven't tested the change.

]
}
Loading