srctree

Robin Linden parent f6f4719e 458fefea
meta/clang-tidy: Enable a bunch more readability checks

inlinesplit
.clang-tidy added: 25, removed: 14, total 11
@@ -42,11 +42,21 @@ Checks: >
modernize-*,
performance-*,
readability-container-size-empty,
readability-duplicate-include,
readability-identifier-naming,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misleading-indentation,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-control-flow,
readability-redundant-preprocessor,
readability-redundant-string-init,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-use-anyofallof,
-bugprone-exception-escape,
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
 
gfx/opengl_shader.cpp added: 25, removed: 14, total 11
@@ -10,6 +10,9 @@
#include <cstdlib>
#include <limits>
 
// NOLINTBEGIN(readability-make-member-function-const): The drawing code
// shouldn't be thought of as const, even if it technically doesn't modify any
// class members.
namespace gfx {
 
std::optional<OpenGLShader> OpenGLShader::create(std::string_view vertex_src, std::string_view fragment_src) {
@@ -100,3 +103,4 @@ void OpenGLShader::set_uniform(char const *name, std::span<float const, 4> data)
}
 
} // namespace gfx
// NOLINTEND(readability-make-member-function-const)
 
html2/character_reference.cpp added: 25, removed: 14, total 11
@@ -29,7 +29,7 @@ namespace {
// print(f'"{key}"sv', *codepoints, sep=', ', end='')
// print('},')
// ```
static constexpr std::array kReferences = std::to_array<CharacterReference>({{"&AElig"sv, 198},
constexpr std::array kReferences = std::to_array<CharacterReference>({{"&AElig"sv, 198},
{"&AElig;"sv, 198},
{"&AMP"sv, 38},
{"&AMP;"sv, 38},
 
html2/parser_states.cpp added: 25, removed: 14, total 11
@@ -9,6 +9,7 @@
 
#include "util/string.h"
 
#include <algorithm>
#include <array>
#include <cassert>
#include <optional>
@@ -145,14 +146,10 @@ constexpr bool is_quirky_public_identifier(std::string_view identifier) {
return true;
}
 
for (auto start : kQuirkyStartsOfPublicIdentifier) {
if (identifier.starts_with(start)) {
return true;
}
}
 
return false;
return std::ranges::any_of(
kQuirkyStartsOfPublicIdentifier, [&](auto start) { return identifier.starts_with(start); });
}
 
constexpr bool is_quirky_when_system_identifier_is_empty(std::string_view public_identifier) {
return public_identifier.starts_with("-//w3c//dtd html 4.01 frameset//")
|| public_identifier.starts_with("-//w3c//dtd html 4.01 transitional//");
 
html2/tokenizer_test.cpp added: 25, removed: 14, total 11
@@ -26,7 +26,7 @@ using namespace html2;
 
namespace {
 
static constexpr char const *kReplacementCharacter = "\xef\xbf\xbd";
constexpr char const *kReplacementCharacter = "\xef\xbf\xbd";
 
struct ParseErrorWithLocation {
ParseError error{};