Skip to content

Commit 19c9b91

Browse files
authored
Merge pull request #1771 from ottml/fix_clang_tidy_on_ci
Fix clang tidy on ci
2 parents 5cc1ddb + c176314 commit 19c9b91

File tree

39 files changed

+115
-68
lines changed

39 files changed

+115
-68
lines changed

.clang-tidy

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,58 @@ Checks: >-
1212
modernize-*,
1313
performance-*,
1414
readability-*,
15+
-bugprone-assignment-in-if-condition,
16+
-bugprone-casting-through-void,
17+
-bugprone-easily-swappable-parameters,
18+
-bugprone-empty-catch,
19+
-bugprone-implicit-widening-of-multiplication-result,
1520
-bugprone-narrowing-conversions,
21+
-bugprone-optional-value-conversion,
22+
-bugprone-reserved-identifier,
23+
-bugprone-switch-missing-default-case,
1624
-bugprone-too-small-loop-variable,
25+
-bugprone-unchecked-optional-access,
26+
-bugprone-unhandled-exception-at-new,
27+
-clang-analyzer-core.NonNullParamChecker,
28+
-clang-analyzer-cplusplus.NewDeleteLeaks,
29+
-clang-analyzer-optin.core.EnumCastOutOfRange,
1730
-clang-analyzer-osx.*,
31+
-misc-confusable-identifiers,
32+
-misc-const-correctness,
33+
-misc-include-cleaner,
1834
-misc-non-private-member-variables-in-classes,
35+
-misc-no-recursion,
1936
-misc-unused-parameters,
37+
-misc-use-anonymous-namespace,
2038
-modernize-avoid-c-arrays,
39+
-modernize-macro-to-enum,
2140
-modernize-raw-string-literal,
2241
-modernize-return-braced-init-list,
2342
-modernize-use-default-member-init,
2443
-modernize-use-emplace,
2544
-modernize-use-nodiscard,
2645
-modernize-use-override,
2746
-modernize-use-trailing-return-type,
47+
-performance-avoid-endl,
48+
-performance-enum-size,
49+
-performance-move-const-arg,
50+
-performance-no-int-to-ptr,
51+
-readability-avoid-nested-conditional-operator,
52+
-readability-avoid-return-with-void-value,
2853
-readability-braces-around-statements,
2954
-readability-convert-member-functions-to-static,
3055
-readability-else-after-return,
56+
-readability-function-cognitive-complexity,
57+
-readability-identifier-length,
3158
-readability-implicit-bool-conversion,
3259
-readability-isolate-declaration,
3360
-readability-magic-numbers,
3461
-readability-named-parameter,
62+
-readability-redundant-casting,
3563
-readability-static-accessed-through-instance,
64+
-readability-suspicious-call-argument,
3665
-readability-uppercase-literal-suffix,
66+
-readability-use-anyofallof,
3767
-readability-identifier-naming,
3868
-clang-diagnostic-inconsistent-missing-override
3969
CheckOptions:
@@ -43,5 +73,8 @@ CheckOptions:
4373
value: 'Point<.*?>;MapPoint;Position;Extent;DrawPoint'
4474
- key: performance-unnecessary-value-param.AllowedTypes
4575
value: 'Point<.*?>;MapPoint;Position;Extent;DrawPoint'
46-
AnalyzeTemporaryDtors: false
76+
- key: readability-function-cognitive-complexity.IgnoreMacros
77+
value: true
78+
- key: readability-simplify-boolean-expr.IgnoreMacros
79+
value: true
4780
...

external/libutil

extras/audioDrivers/SDL/AudioSDL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ driver::RawSoundHandle AudioSDL::LoadEffect(const std::string& filepath)
142142

143143
driver::RawSoundHandle AudioSDL::LoadEffect(const std::vector<char>& data, const std::string& /*ext*/)
144144
{
145-
SDL_RWops* rwOps = SDL_RWFromConstMem(&data[0], static_cast<int>(data.size()));
145+
SDL_RWops* rwOps = SDL_RWFromConstMem(data.data(), static_cast<int>(data.size()));
146146
Mix_Chunk* sound = Mix_LoadWAV_RW(rwOps, true); //-V601
147147

148148
if(sound == nullptr)

libs/common/include/Rect.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ template<typename T>
2020
struct RectBase
2121
{
2222
using position_type = Point<T>;
23+
// Deactivated to bug in clang-tidy
24+
// NOLINTBEGIN(modernize-type-traits)
2325
using extent_elem_type =
2426
typename std::conditional_t<std::is_integral_v<T>, std::make_unsigned<T>, std::common_type<T>>::type;
27+
// NOLINTEND(modernize-type-traits)
2528
using extent_type = Point<extent_elem_type>;
2629
T left, top, right, bottom;
2730
constexpr RectBase() : RectBase(position_type::all(0), extent_type::all(0)) {}

libs/common/include/helpers/serializeContainers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ namespace detail {
3535
void pushContainer(Serializer& ser, const T& container, long)
3636
{
3737
using Type = typename T::value_type;
38+
// Deactivated to bug in clang-tidy
39+
// NOLINTBEGIN(modernize-type-traits)
3840
using Integral =
3941
typename std::conditional_t<std::is_enum_v<Type>, std::underlying_type<Type>, std::common_type<Type>>::type;
42+
// NOLINTEND(modernize-type-traits)
4043
for(const auto el : container)
4144
{
4245
// Cast also required for bool vector -.-

libs/s25main/Debug.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ bool captureBacktrace(DebugInfo::stacktrace_t& stacktrace, LPCONTEXT ctx) noexce
132132
return true;
133133
}
134134
#else
135-
bool captureBacktrace(DebugInfo::stacktrace_t& stacktrace, void*) noexcept
135+
bool captureBacktrace(DebugInfo::stacktrace_t& stacktrace, void*) noexcept(false)
136136
{
137137
# if RTTR_BACKTRACE_HAS_FUNCTION
138-
const auto num_frames = backtrace(&stacktrace[0], stacktrace.size());
138+
const auto num_frames = backtrace(stacktrace.data(), stacktrace.size());
139139
stacktrace.resize(num_frames);
140140
return true;
141141
# else
@@ -182,7 +182,7 @@ DebugInfo::~DebugInfo()
182182
sock.Close();
183183
}
184184

185-
DebugInfo::stacktrace_t DebugInfo::GetStackTrace(void* ctx) noexcept
185+
DebugInfo::stacktrace_t DebugInfo::GetStackTrace(void* ctx) noexcept(false)
186186
{
187187
#ifndef RTTR_CONTEXT_PTR_TYPE
188188
using RTTR_CONTEXT_PTR_TYPE = void*;
@@ -267,7 +267,7 @@ bool DebugInfo::SendStackTrace(const stacktrace_t& stacktrace)
267267
endStacktrace.push_back(reinterpret_cast<littleVoid_t::value_type>(ptr));
268268

269269
unsigned stacktraceLen = sizeof(littleVoid_t) * endStacktrace.size();
270-
return SendString(reinterpret_cast<const char*>(&endStacktrace[0]), stacktraceLen);
270+
return SendString(reinterpret_cast<const char*>(endStacktrace.data()), stacktraceLen);
271271
}
272272

273273
bool DebugInfo::SendReplay()

0 commit comments

Comments
 (0)