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

refactor: Fix clang-tidy warnings in PyDeserializer. #111

Merged
merged 1 commit into from
Jan 7, 2025
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
2 changes: 2 additions & 0 deletions lint-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ tasks:
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/api_decoration.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/error_messages.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ExceptionFFI.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PyDeserializer.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PyDeserializer.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PyKeyValuePairLogEvent.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PyKeyValuePairLogEvent.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PySerializer.cpp"
Expand Down
14 changes: 9 additions & 5 deletions src/clp_ffi_py/ir/native/PyDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CLP_FFI_PY_METHOD auto PyDeserializer_deserialize_log_event(PyDeserializer* self
*/
CLP_FFI_PY_METHOD auto PyDeserializer_dealloc(PyDeserializer* self) -> void;

// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays)
// NOLINTNEXTLINE(*-avoid-c-arrays, cppcoreguidelines-avoid-non-const-global-variables)
PyMethodDef PyDeserializer_method_table[]{
{"deserialize_log_event",
py_c_function_cast(PyDeserializer_deserialize_log_event),
Expand All @@ -82,7 +82,8 @@ PyMethodDef PyDeserializer_method_table[]{
{nullptr}
};

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays, cppcoreguidelines-pro-type-*-cast)
// NOLINTBEGIN(cppcoreguidelines-pro-type-*-cast)
// NOLINTNEXTLINE(*-avoid-c-arrays, cppcoreguidelines-avoid-non-const-global-variables)
PyType_Slot PyDeserializer_slots[]{
{Py_tp_alloc, reinterpret_cast<void*>(PyType_GenericAlloc)},
{Py_tp_dealloc, reinterpret_cast<void*>(PyDeserializer_dealloc)},
Expand All @@ -92,11 +93,12 @@ PyType_Slot PyDeserializer_slots[]{
{Py_tp_doc, const_cast<void*>(static_cast<void const*>(cPyDeserializerDoc))},
{0, nullptr}
};
// NOLINTEND(cppcoreguidelines-avoid-c-arrays, cppcoreguidelines-pro-type-*-cast)
// NOLINTEND(cppcoreguidelines-pro-type-*-cast)

/**
* `PyDeserializer`'s Python type specifications.
*/
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
PyType_Spec PyDeserializer_type_spec{
"clp_ffi_py.ir.native.Deserializer",
sizeof(PyDeserializer),
Expand Down Expand Up @@ -197,7 +199,7 @@ auto PyDeserializer::init(
if (deserializer_result.has_error()) {
PyErr_Format(
PyExc_RuntimeError,
cDeserializerCreateErrorFormatStr.data(),
get_c_str_from_constexpr_string_view(cDeserializerCreateErrorFormatStr),
deserializer_result.error().message().c_str()
);
return false;
Expand Down Expand Up @@ -232,7 +234,9 @@ auto PyDeserializer::deserialize_log_event() -> PyObject* {
if (std::errc::result_out_of_range != err) {
PyErr_Format(
PyExc_RuntimeError,
cDeserializerDeserializeNextIrUnitErrorFormatStr.data(),
get_c_str_from_constexpr_string_view(
cDeserializerDeserializeNextIrUnitErrorFormatStr
),
err.message().c_str()
);
return nullptr;
Expand Down
1 change: 0 additions & 1 deletion src/clp_ffi_py/ir/native/PyDeserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <wrapped_facade_headers/Python.hpp> // Must be included before any other header files

#include <functional>
#include <system_error>
#include <utility>

#include <clp/ffi/ir_stream/decoding_methods.hpp>
Expand Down
Loading