diff --git a/lint-tasks.yml b/lint-tasks.yml index f9f6e83..c1d25fa 100644 --- a/lint-tasks.yml +++ b/lint-tasks.yml @@ -117,6 +117,8 @@ tasks: - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ExceptionFFI.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" + - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PySerializer.hpp" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/modules" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.cpp" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.hpp" diff --git a/src/clp_ffi_py/ir/native/PySerializer.cpp b/src/clp_ffi_py/ir/native/PySerializer.cpp index b6878da..70b6145 100644 --- a/src/clp_ffi_py/ir/native/PySerializer.cpp +++ b/src/clp_ffi_py/ir/native/PySerializer.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -147,7 +148,7 @@ CLP_FFI_PY_METHOD auto PySerializer_exit(PySerializer* self, PyObject* args, PyO */ CLP_FFI_PY_METHOD auto PySerializer_dealloc(PySerializer* self) -> void; -// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) +// NOLINTNEXTLINE(*-avoid-c-arrays, cppcoreguidelines-avoid-non-const-global-variables) PyMethodDef PySerializer_method_table[]{ {"serialize_log_event_from_msgpack_map", py_c_function_cast(PySerializer_serialize_log_event_from_msgpack_map), @@ -182,7 +183,8 @@ PyMethodDef PySerializer_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 PySerializer_slots[]{ {Py_tp_alloc, reinterpret_cast(PyType_GenericAlloc)}, {Py_tp_dealloc, reinterpret_cast(PySerializer_dealloc)}, @@ -192,11 +194,12 @@ PyType_Slot PySerializer_slots[]{ {Py_tp_doc, const_cast(static_cast(cPySerializerDoc))}, {0, nullptr} }; -// NOLINTEND(cppcoreguidelines-avoid-c-arrays, cppcoreguidelines-pro-type-*-cast) +// NOLINTEND(cppcoreguidelines-pro-type-*-cast) /** * `PySerializer`'s Python type specifications. */ +// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) PyType_Spec PySerializer_type_spec{ "clp_ffi_py.ir.native.Serializer", sizeof(PySerializer), @@ -271,7 +274,7 @@ CLP_FFI_PY_METHOD auto PySerializer_init(PySerializer* self, PyObject* args, PyO if (serializer_result.has_error()) { PyErr_Format( PyExc_RuntimeError, - cSerializerCreateErrorFormatStr.data(), + get_c_str_from_constexpr_string_view(cSerializerCreateErrorFormatStr), serializer_result.error().message().c_str() ); return -1; @@ -443,8 +446,12 @@ auto PySerializer::serialize_log_event_from_msgpack_map(std::span ms } auto const buffer_size_before_serialization{get_ir_buf_size()}; + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access) if (false == m_serializer->serialize_msgpack_map(msgpack_obj.via.map)) { - PyErr_SetString(PyExc_RuntimeError, cSerializerSerializeMsgpackMapError.data()); + PyErr_SetString( + PyExc_RuntimeError, + get_c_str_from_constexpr_string_view(cSerializerSerializeMsgpackMapError) + ); return std::nullopt; } auto const buffer_size_after_serialization{get_ir_buf_size()}; diff --git a/src/wrapped_facade_headers/Python.hpp b/src/wrapped_facade_headers/Python.hpp index e341ef0..7011eea 100644 --- a/src/wrapped_facade_headers/Python.hpp +++ b/src/wrapped_facade_headers/Python.hpp @@ -33,6 +33,7 @@ #include #include #include +#include // IWYU pragma: end_exports #endif // clang-format on