summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJoshua Vandaƫle <joshua@vandaele.software>2025-04-23 11:19:14 +0200
committerJoshua Vandaƫle <joshua@vandaele.software>2025-04-23 11:19:57 +0200
commitbf554edfe0b543b08c42401b78fea2ae0ffa1168 (patch)
treef8fac4821872a272c4d1c0af9f6709acf05db491 /Source
parent2c54ee94c1bed2b958478e302307be4d056321a5 (diff)
linter: Add and apply new formatting rules
New rules: `InsertNewlineAtEOF: true` `RemoveSemicolon: true` `RequiresClausePosition: WithPreceding`
Diffstat (limited to 'Source')
-rw-r--r--Source/.clang-format3
-rw-r--r--Source/Core/Common/Config/Layer.h2
-rw-r--r--Source/Core/Common/Contains.h13
-rw-r--r--Source/Core/Common/StringUtil.h4
-rw-r--r--Source/Core/Core/AchievementManager.h8
-rw-r--r--Source/Core/Core/HW/WiimoteReal/IOAndroid.h2
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp2
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h2
-rw-r--r--Source/Core/VideoBackends/Metal/MTLStateTracker.h2
9 files changed, 20 insertions, 18 deletions
diff --git a/Source/.clang-format b/Source/.clang-format
index 12912e9126..09d6fe9301 100644
--- a/Source/.clang-format
+++ b/Source/.clang-format
@@ -54,6 +54,7 @@ IncludeCategories:
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
+InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -67,6 +68,8 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
+RemoveSemicolon: true
+RequiresClausePosition: WithPreceding
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
diff --git a/Source/Core/Common/Config/Layer.h b/Source/Core/Common/Config/Layer.h
index 58859789ca..e82b411c29 100644
--- a/Source/Core/Common/Config/Layer.h
+++ b/Source/Core/Common/Config/Layer.h
@@ -18,7 +18,7 @@ namespace Config
// Setting a key to an object of this type will delete the key.
struct DefaultState
{
- friend constexpr bool operator==(DefaultState, DefaultState) { return true; };
+ friend constexpr bool operator==(DefaultState, DefaultState) { return true; }
};
namespace detail
diff --git a/Source/Core/Common/Contains.h b/Source/Core/Common/Contains.h
index 526355fae1..cabf6c0c07 100644
--- a/Source/Core/Common/Contains.h
+++ b/Source/Core/Common/Contains.h
@@ -11,16 +11,15 @@ namespace Common
struct ContainsFn
{
template <std::input_iterator I, std::sentinel_for<I> S, class T, class Proj = std::identity>
- requires std::indirect_binary_predicate<std::ranges::equal_to, std::projected<I, Proj>,
- const T*>
+ requires std::indirect_binary_predicate<std::ranges::equal_to, std::projected<I, Proj>, const T*>
constexpr bool operator()(I first, S last, const T& value, Proj proj = {}) const
{
return std::ranges::find(std::move(first), last, value, std::move(proj)) != last;
}
template <std::ranges::input_range R, class T, class Proj = std::identity>
- requires std::indirect_binary_predicate<
- std::ranges::equal_to, std::projected<std::ranges::iterator_t<R>, Proj>, const T*>
+ requires std::indirect_binary_predicate<
+ std::ranges::equal_to, std::projected<std::ranges::iterator_t<R>, Proj>, const T*>
constexpr bool operator()(R&& r, const T& value, Proj proj = {}) const
{
return (*this)(std::ranges::begin(r), std::ranges::end(r), value, std::move(proj));
@@ -32,7 +31,7 @@ struct ContainsSubrangeFn
template <std::forward_iterator I1, std::sentinel_for<I1> S1, std::forward_iterator I2,
std::sentinel_for<I2> S2, class Pred = std::ranges::equal_to,
class Proj1 = std::identity, class Proj2 = std::identity>
- requires std::indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
+ requires std::indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
constexpr bool operator()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
Proj1 proj1 = {}, Proj2 proj2 = {}) const
{
@@ -45,8 +44,8 @@ struct ContainsSubrangeFn
template <std::ranges::forward_range R1, std::ranges::forward_range R2,
class Pred = std::ranges::equal_to, class Proj1 = std::identity,
class Proj2 = std::identity>
- requires std::indirectly_comparable<std::ranges::iterator_t<R1>, std::ranges::iterator_t<R2>,
- Pred, Proj1, Proj2>
+ requires std::indirectly_comparable<std::ranges::iterator_t<R1>, std::ranges::iterator_t<R2>,
+ Pred, Proj1, Proj2>
constexpr bool operator()(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {},
Proj2 proj2 = {}) const
{
diff --git a/Source/Core/Common/StringUtil.h b/Source/Core/Common/StringUtil.h
index 621ec2188e..617aee16bc 100644
--- a/Source/Core/Common/StringUtil.h
+++ b/Source/Core/Common/StringUtil.h
@@ -73,7 +73,7 @@ void TruncateToCString(std::string* s);
bool TryParse(const std::string& str, bool* output);
template <typename T>
- requires(std::is_integral_v<T> || (std::is_enum_v<T> && !detail::IsBooleanEnum<T>()))
+requires(std::is_integral_v<T> || (std::is_enum_v<T> && !detail::IsBooleanEnum<T>()))
bool TryParse(const std::string& str, T* output, int base = 0)
{
char* end_ptr = nullptr;
@@ -112,7 +112,7 @@ bool TryParse(const std::string& str, T* output, int base = 0)
}
template <typename T>
- requires(detail::IsBooleanEnum<T>())
+requires(detail::IsBooleanEnum<T>())
bool TryParse(const std::string& str, T* output)
{
bool value;
diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h
index 3c09a87d1b..d3df28160c 100644
--- a/Source/Core/Core/AchievementManager.h
+++ b/Source/Core/Core/AchievementManager.h
@@ -171,8 +171,8 @@ public:
void SetDevMenuUpdateCallback(std::function<void(void)> callback)
{
m_dev_menu_callback = callback;
- };
- bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); };
+ }
+ bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); }
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
void DoState(PointerWrap& p);
@@ -339,13 +339,13 @@ public:
u16 revision)
{
return true;
- };
+ }
constexpr bool CheckApprovedARCode(const ActionReplay::ARCode& code, const std::string& game_id,
u16 revision)
{
return true;
- };
+ }
constexpr void LoadGame(const std::string&, const DiscIO::Volume*) {}
diff --git a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h
index 8373ef51e2..c29c1de869 100644
--- a/Source/Core/Core/HW/WiimoteReal/IOAndroid.h
+++ b/Source/Core/Core/HW/WiimoteReal/IOAndroid.h
@@ -23,7 +23,7 @@ protected:
bool ConnectInternal() override;
void DisconnectInternal() override;
bool IsConnected() const override;
- void IOWakeup() override {};
+ void IOWakeup() override {}
int IORead(u8* buf) override;
int IOWrite(u8 const* buf, size_t len) override;
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
index 5db63dfc0e..de82f319d5 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
@@ -190,4 +190,4 @@ void ConfigComplexChoice::mousePressEvent(QMouseEvent* event)
{
QComboBox::mousePressEvent(event);
}
-};
+}
diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h
index 32f94a91e8..fb37d3119f 100644
--- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h
+++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigControl.h
@@ -90,7 +90,7 @@ protected:
return Config::Get(setting);
}
- virtual void OnConfigChanged() {};
+ virtual void OnConfigChanged() {}
private:
bool IsConfigLocal() const
diff --git a/Source/Core/VideoBackends/Metal/MTLStateTracker.h b/Source/Core/VideoBackends/Metal/MTLStateTracker.h
index 75bd34352b..32f6e1db01 100644
--- a/Source/Core/VideoBackends/Metal/MTLStateTracker.h
+++ b/Source/Core/VideoBackends/Metal/MTLStateTracker.h
@@ -57,7 +57,7 @@ public:
explicit StateTracker();
~StateTracker();
- Framebuffer* GetCurrentFramebuffer() { return m_current_framebuffer; };
+ Framebuffer* GetCurrentFramebuffer() { return m_current_framebuffer; }
void SetCurrentFramebuffer(Framebuffer* framebuffer);
void BeginClearRenderPass(MTLClearColor color, float depth);
void BeginRenderPass(MTLLoadAction load_action);