From 48b761f1c72e24a9311f2f5e69336e800d4ccdcf Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 26 Nov 2024 23:40:18 +0100 Subject: [PATCH 1/2] clang-tidy|clang-format: Qualifier order and more test exceptions --- .clang-format | 11 +++++++++++ .clang-tidy | 2 ++ test/.clang-tidy | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 11d0dcd..e0958e5 100644 --- a/.clang-format +++ b/.clang-format @@ -1 +1,12 @@ BasedOnStyle: WebKit +QualifierAlignment: 'Custom' +QualifierOrder: [ + 'friend', + 'static', + 'constexpr', + 'inline', + 'volatile', + 'restrict', + 'const', + 'type', +] diff --git a/.clang-tidy b/.clang-tidy index dcb1de7..932a5be 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -56,6 +56,8 @@ CheckOptions: value: camelBack - key: readability-identifier-naming.GlobalFunctionCase value: camelBack + - key: readability-identifier-naming.GlobalFunctionIgnoredRegexp + value: '^TEST$' - key: readability-identifier-naming.GlobalPointerCase value: lower_case - key: readability-identifier-naming.GlobalVariableCase diff --git a/test/.clang-tidy b/test/.clang-tidy index 164b9f3..b580f6f 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -10,4 +10,5 @@ Checks: > -bugprone-easily-swappable-parameters, -bugprone-unchecked-optional-access, -hicpp-noexcept-move, - -cppcoreguidelines-noexcept-move-operations + -cppcoreguidelines-noexcept-move-operations, + -cppcoreguidelines-init-variables From a99a97b1e2f7bfb2e9da0a1b7be26c621f9c8354 Mon Sep 17 00:00:00 2001 From: Tamino Bauknecht Date: Tue, 26 Nov 2024 23:41:07 +0100 Subject: [PATCH 2/2] python: Fix formatting for updated clang-format configuration --- src/python_interpreter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python_interpreter.cpp b/src/python_interpreter.cpp index c608f66..c71a642 100644 --- a/src/python_interpreter.cpp +++ b/src/python_interpreter.cpp @@ -67,11 +67,11 @@ PythonInterpreter::PythonInterpreter() // TODO: handle this failure return; } - PythonGuard const python_guard { state() }; + const PythonGuard python_guard { state() }; Py_DECREF(main_module); } } , state_ { nullptr, [](auto* state) { - PythonGuard const python_guard { state }; + const PythonGuard python_guard { state }; Py_EndInterpreter(state); } } { @@ -124,11 +124,11 @@ std::optional PythonInterpreter::load(const std::string& file_name) if (!file) { return LoadError::fileNotReadable; } - PythonGuard const python_guard { state() }; + const PythonGuard python_guard { state() }; auto* globals = PyModule_GetDict(mainModule()); assert(globals); auto* locals = globals; - int const start { Py_file_input }; + const int start { Py_file_input }; auto* result = PyRun_File(file.get(), file_name.c_str(), start, globals, locals); Py_DECREF(globals); if (result != nullptr) {