-
Notifications
You must be signed in to change notification settings - Fork 5
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
refactor: Fix clang-tidy warnings in PyKeyValuePairLogEvent
.
#108
refactor: Fix clang-tidy warnings in PyKeyValuePairLogEvent
.
#108
Conversation
WalkthroughThis pull request introduces modifications to several files related to linting and code analysis in the CLP FFI Python project. The changes primarily focus on enhancing the static code checking process, updating naming conventions for Clang-Tidy, and adding new utility functions for Python string handling. The modifications aim to improve code quality, resolve specific linting warnings, and provide more flexible naming rules for Python-related code elements. Changes
Possibly related issues
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/clp_ffi_py/.clang-tidy (1)
10-12
: Consider correcting potential typographical inconsistency in regex pattern.
Although these updated patterns properly permit alphanumeric characters after “Py”, there's a minor inconsistency ata-zA-z0-9
(notice the second “z” is lowercase but the first is uppercase). Consider usinga-zA-Z0-9
to ensure uniform coverage of all letters.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
lint-tasks.yml
(2 hunks)src/clp_ffi_py/.clang-tidy
(1 hunks)src/clp_ffi_py/ir/native/PyKeyValuePairLogEvent.cpp
(10 hunks)src/clp_ffi_py/utils.cpp
(1 hunks)src/clp_ffi_py/utils.hpp
(1 hunks)src/wrapped_facade_headers/msgpack.hpp
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/clp_ffi_py/utils.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/clp_ffi_py/utils.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/wrapped_facade_headers/msgpack.hpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
src/clp_ffi_py/ir/native/PyKeyValuePairLogEvent.cpp (1)
Pattern **/*.{cpp,hpp,java,js,jsx,ts,tsx}
: - Prefer false == <expression>
rather than !<expression>
.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: linters
🔇 Additional comments (17)
src/wrapped_facade_headers/msgpack.hpp (1)
10-16
: The additional includes properly expand forward declarations.
These new headers help ensure that all MessagePack versions can be forward-declared correctly, preventing unintended linking or compilation issues. This adheres to best practises for modular code.src/clp_ffi_py/utils.cpp (1)
99-101
: New function provides safe and straightforward string construction.
construct_py_str_from_string_view
properly usesPyUnicode_FromStringAndSize
for memory-safety, returningnullptr
with an exception set upon failure. This aligns well with consistent error-handling in Python C-API usage.src/clp_ffi_py/utils.hpp (1)
87-92
: Documentation accurately reflects function behaviour.
The docstring precisely conveys the function purpose, parameter usage, and return semantics, ensuring clarity for maintainers interacting withconstruct_py_str_from_string_view
.src/clp_ffi_py/ir/native/PyKeyValuePairLogEvent.cpp (12)
30-30
: Looks correct. No issues identified with the new header inclusion for msgpack.
177-186
: No concerns. The addition of a constructed Python string object and the subsequent dictionary insertion logic appear well-structured.
273-273
: Method definition table is straightforward and aligns with Python C-API conventions.
Line range hint
283-294
: The type slot table is valid and follows the recommended approach for setting up Python types via C-API.
299-299
: The type specification for the PyKeyValuePairLogEvent Python type is properly defined.
438-438
: Utilizing get_c_str_from_constexpr_string_view here for error formatting is consistent with the rest of the code.
445-445
: The conditional check using “false == …” follows the coding guidelines, and the serializer call appears correct.
447-450
: Error handling is clear and sets the appropriate Python exception without issues.
466-466
: The error message correctly uses PyErr_Format and the custom string view utility. No concerns here.
479-481
: Exception handling and error message usage appear consistent with project conventions.
566-570
: Creation of the Python key string and the immediate null-check ensure robust error handling.
639-639
: Direct comparison with zero for PyDict_SetItem is consistent and helps clarify the success path.lint-tasks.yml (2)
105-109
: The newly added line filter for msgpack’s cpp11_zone.hpp effectively suppresses unrelated warnings. No issues noted.
118-119
: Including PyKeyValuePairLogEvent.cpp and .hpp in the clang-tidy sources helps ensure coverage of new code. No concerns.
Notice that we modified the clang-tidy command line argument to disable checks for the problematic line in the msgpack source code as a temporary solution for #109. |
Looks reasonable to me |
Co-authored-by: kirkrodrigues <[email protected]>
Description
This is one of the PR series trying to implement #96
This PR fixes all clang-tidy warnings in PyKeyValuePairLogEvent.hpp/cpp.
Validation performed
Summary by CodeRabbit
Release Notes
New Features
Improvements
Technical Updates