-
Notifications
You must be signed in to change notification settings - Fork 905
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(falco): apply code formatting #3350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a silly question but is the code formatter configured with the correct definition ?
Many of the changes are moving the opening curly bracket to the end of the line rather than to a new line as is the usual in the code base.
cmake/modules/static-analysis.cmake
Outdated
add_custom_target( | ||
cppcheck | ||
COMMAND | ||
${CPPCHECK} "--enable=all" "--force" "--inconclusive" "--inline-suppr" # allows to | ||
# specify | ||
# suppressions | ||
# directly in | ||
# source code | ||
"--xml" # we want to generate a report | ||
"--output-file=${CMAKE_CURRENT_BINARY_DIR}/static-analysis-reports/cppcheck/cppcheck.xml" # generate | ||
# the report | ||
# under the | ||
# reports | ||
# folder in | ||
# the build | ||
# folder | ||
"-i${CMAKE_CURRENT_BINARY_DIR}" # exclude the build folder | ||
"${CMAKE_SOURCE_DIR}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block would require better formatting than what is suggested.
message(STATUS "cppcheck command not found, static code analysis using cppcheck will not be available.") | ||
message( | ||
STATUS | ||
"cppcheck command not found, static code analysis using cppcheck will not be available." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would align it to STATUS
"cppcheck command not found, static code analysis using cppcheck will not be available." | |
"cppcheck command not found, static code analysis using cppcheck will not be available." |
add_definitions(-DHAVE_STRLCAT) | ||
message( | ||
STATUS | ||
"Existing strlcpy and strlcat found, will *not* use local definition by setting -DHAVE_STRLCPY and -DHAVE_STRLCAT." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Existing strlcpy and strlcat found, will *not* use local definition by setting -DHAVE_STRLCPY and -DHAVE_STRLCAT." | |
"Existing strlcpy and strlcat found, will *not* use local definition by setting -DHAVE_STRLCPY and -DHAVE_STRLCAT." |
_HAS_STD_BYTE=0 | ||
_CRT_SECURE_NO_WARNINGS | ||
WIN32 | ||
MINIMAL_BUILD | ||
WIN32_LEAN_AND_MEAN | ||
NOMINMAX | ||
_HAS_STD_BYTE=0 _CRT_SECURE_NO_WARNINGS WIN32 MINIMAL_BUILD WIN32_LEAN_AND_MEAN NOMINMAX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, I'd rather keep the column variant.
falco/app/actions/test_configure_interesting_sets.cpp | ||
falco/app/actions/test_configure_syscall_buffer_num.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
falco/app/actions/test_configure_interesting_sets.cpp | |
falco/app/actions/test_configure_syscall_buffer_num.cpp | |
falco/app/actions/test_configure_interesting_sets.cpp | |
falco/app/actions/test_configure_syscall_buffer_num.cpp |
unit_tests/CMakeLists.txt
Outdated
${CMAKE_BINARY_DIR}/userspace/falco # we need it to include indirectly `config_falco.h` | ||
# file | ||
${CMAKE_SOURCE_DIR}/userspace/engine # we need it to include indirectly `falco_common.h` | ||
# file | ||
${CMAKE_CURRENT_BINARY_DIR} # we need it to include `falco_test_var.h` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we put the comments above each line ?
${CMAKE_BINARY_DIR}/userspace/falco # we need it to include indirectly `config_falco.h` | |
# file | |
${CMAKE_SOURCE_DIR}/userspace/engine # we need it to include indirectly `falco_common.h` | |
# file | |
${CMAKE_CURRENT_BINARY_DIR} # we need it to include `falco_test_var.h` | |
# we need it to include indirectly `config_falco.h` file | |
${CMAKE_BINARY_DIR}/userspace/falco | |
# we need it to include indirectly `falco_common.h` file | |
${CMAKE_SOURCE_DIR}/userspace/engine | |
# we need it to include `falco_test_var.h` | |
${CMAKE_CURRENT_BINARY_DIR} |
#define FALCO_ENGINE_VERSION \ | ||
__FALCO_ENGINE_STRINGIFY(FALCO_ENGINE_VERSION_MAJOR) \ | ||
"." __FALCO_ENGINE_STRINGIFY(FALCO_ENGINE_VERSION_MINOR) "." __FALCO_ENGINE_STRINGIFY( \ | ||
FALCO_ENGINE_VERSION_PATCH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this one less clear to parse. I would rather keep the original.
15eaa13
to
6a1a33b
Compare
@sgaist yep there might be something wrong with this PR since the |
Some lint was not applied correctly, and also it looks like CI is still failing. Will probably need some tweaking 🤔 |
Yep I've done the same for libs. There are usually 2/3 places where clang format cannot converge without your help, so probably you need to change these lines manually... Moreover probably is better to run it more than once to be sure a convergence is reached (maybe just run the CI jobs some times before merging the PR) For what concern the style I would keep the same we used in libs, with the same clang-format, cmake-format, but of course this is just my opinion |
This would make a big change in Falco but I am all for a consistent code style across repositories. |
I don't, since it is the same formatting we now follow in libs, it's ok for me. |
6a1a33b
to
36078f4
Compare
Ok for me. It's a start to have a code style :) |
Signed-off-by: Poiana <poiana.bot@gmail.com>
36078f4
to
b671a6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 355da5b3177a66870377abbc4d30b7ebadc37d6a
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, poiana The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/milestone 0.39.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as most the concerns have been fixed by an actual run of the linter.
Details will be fixed in followup work.
What type of PR is this?
/kind cleanup
Any specific area of the project related to this PR?
/area build
/area engine
/area tests
/area CI
What this PR does / why we need it:
As per title and linting files in the repo.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: