From b15c0402986e85fbb8320ca429db3512bf9a2aee Mon Sep 17 00:00:00 2001 From: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:05:04 -0500 Subject: [PATCH] refactor: Fix clang-tidy warnings in `ir_native.cpp`. (#104) --- lint-tasks.yml | 1 + src/clp_ffi_py/modules/ir_native.cpp | 7 +++++-- src/wrapped_facade_headers/Python.hpp | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lint-tasks.yml b/lint-tasks.yml index 7171206..9d7635b 100644 --- a/lint-tasks.yml +++ b/lint-tasks.yml @@ -112,6 +112,7 @@ 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}}/modules" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.cpp" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.hpp" - "{{.CLP_FFI_PY_CPP_SRC_DIR}}/PyExceptionContext.hpp" diff --git a/src/clp_ffi_py/modules/ir_native.cpp b/src/clp_ffi_py/modules/ir_native.cpp index fe84136..65b113b 100644 --- a/src/clp_ffi_py/modules/ir_native.cpp +++ b/src/clp_ffi_py/modules/ir_native.cpp @@ -18,7 +18,8 @@ PyDoc_STRVAR( "Python interface to the CLP IR serialization and deserialization methods." ); -// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) +// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) +// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays) PyMethodDef Py_native_method_table[]{{nullptr, nullptr, 0, nullptr}}; PyModuleDef Py_native{ @@ -28,9 +29,11 @@ PyModuleDef Py_native{ -1, static_cast(Py_native_method_table) }; + +// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables) } // namespace -// NOLINTNEXTLINE(modernize-use-trailing-return-type) +// NOLINTNEXTLINE(modernize-use-trailing-return-type, readability-identifier-naming) PyMODINIT_FUNC PyInit_native() { PyObject* new_module{PyModule_Create(&Py_native)}; if (nullptr == new_module) { diff --git a/src/wrapped_facade_headers/Python.hpp b/src/wrapped_facade_headers/Python.hpp index 381a4ab..e341ef0 100644 --- a/src/wrapped_facade_headers/Python.hpp +++ b/src/wrapped_facade_headers/Python.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include