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

Minor clang tool improvements #16

Merged
merged 2 commits into from
Nov 26, 2024
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
11 changes: 11 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
BasedOnStyle: WebKit
QualifierAlignment: 'Custom'
QualifierOrder: [
'friend',
'static',
'constexpr',
'inline',
'volatile',
'restrict',
'const',
'type',
]
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/python_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
} }
{
Expand Down Expand Up @@ -124,11 +124,11 @@ std::optional<LoadError> 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) {
Expand Down
3 changes: 2 additions & 1 deletion test/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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