Skip to content

Commit

Permalink
why can’t clang-tidy just leave me alone?
Browse files Browse the repository at this point in the history
  • Loading branch information
db48x committed Oct 19, 2024
1 parent 1bce68d commit 96aa876
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build-scripts/get_translation_characters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
def main():

Check failure on line 10 in build-scripts/get_translation_characters.py

View workflow job for this annotation

GitHub Actions / check

expected 2 blank lines, found 1
print("// generated by get_translation_characters.py; example:")
print("// ./build-scripts/get_translation_characters.py en ar cs da de el es fr hu id is it ja ko nb nl pl pt ru sr tr uk_UA zh_Hans zh_Hant > src/cldr/imgui-glyph-ranges.cpp\n")

Check failure on line 12 in build-scripts/get_translation_characters.py

View workflow job for this annotation

GitHub Actions / check

line too long (184 > 79 characters)
print("// NOLINTBEGIN(cata-static-declarations,readability-function-size)")
try:
for language in sys.argv[1:]:
print_func(language)
print("// NOLINTEND(cata-static-declarations,readability-function-size)")

Check failure on line 17 in build-scripts/get_translation_characters.py

View workflow job for this annotation

GitHub Actions / check

line too long (81 > 79 characters)
return 0
except KeyError as x:
print(f"Unknown language code “{x.args[0]}”", file=sys.stderr)
Expand Down
10 changes: 8 additions & 2 deletions src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,12 @@ static int GetFallbackCharWidth( ImWchar c, const float scale )
return fontwidth * mk_wcwidth( c ) * scale;
}

// NOLINTNEXTLINE(bugprone-suspicious-include)
#include "cldr/imgui-glyph-ranges.cpp"

static void AddGlyphRangesFromCLDR( ImFontGlyphRangesBuilder *b, const std::string &lang )
{
// NOLINTBEGIN(bugprone-branch-clone)
if( lang == "en" ) {
AddGlyphRangesFromCLDRForEN( b );
} else if( lang == "ar" ) {
Expand Down Expand Up @@ -347,6 +349,7 @@ static void AddGlyphRangesFromCLDR( ImFontGlyphRangesBuilder *b, const std::stri
} else if( lang == "zh_TW" ) {
AddGlyphRangesFromCLDRForZH_HANS( b );
}
// NOLINTEND(bugprone-branch-clone)
}

#if defined(__clang__) || defined(__GNUC__)
Expand All @@ -358,6 +361,7 @@ static void AddGlyphRangesFromCLDR( ImFontGlyphRangesBuilder *b, const std::stri
static void AddGlyphRangesMisc( UNUSED ImFontGlyphRangesBuilder *b,
UNUSED const std::string &lang )

Check failure on line 362 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / build (src)

Parameter 'lang' of 'AddGlyphRangesMisc' can be std::string_view. [cata-use-string_view,-warnings-as-errors]
{
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
static ImWchar superscripts[] = { 0x00B9, 0x00B9, 0x00B2, 0x00B3, 0x2070, 0x208E, 0x0000 };
b->AddRanges( &superscripts[0] );
}
Expand Down Expand Up @@ -389,10 +393,12 @@ static void check_font( const ImFont *font )
{
if( !font || !font->IsLoaded() ) {
// we can’t use debugmsg or cata_fatal because they trigger a new ImGui frame
// NOLINTNEXTLINE(cert-err33-c)
fprintf( stderr,
"Failed to create font atlas! Make sure that your chosen font "
"exists, can be read, and has glyphs for your chosen "
"Failed to create font atlas! Make sure that your chosen "
"font exists, can be read, and has glyphs for your chosen "
"language.\n" );
// NOLINTNEXTLINE(cata-assert)
std::abort();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/cldr/imgui-glyph-ranges.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// generated by get_translation_characters.py; example:
// ./build-scripts/get_translation_characters.py en ar cs da de el es fr hu id is it ja ko nb nl pl pt ru sr tr uk_UA zh_Hans zh_Hant > src/cldr/imgui-glyph-ranges.cpp

// NOLINTBEGIN(cata-static-declarations,readability-function-size)
static void AddGlyphRangesFromCLDRForEN( ImFontGlyphRangesBuilder *b )
{
b->AddChar( 0x61 );
Expand Down Expand Up @@ -41531,3 +41532,4 @@ static void AddGlyphRangesFromCLDRForZH_HANT( ImFontGlyphRangesBuilder *b )
b->AddChar( 0xff5d );
}

// NOLINTEND(cata-static-declarations,readability-function-size)

0 comments on commit 96aa876

Please sign in to comment.