Configure clang-tidy CI check (#1028)

This commit is contained in:
Siarhei Fedartsou
2023-04-20 09:57:25 +02:00
committed by GitHub
parent f03deb7032
commit 2a7a6f01a2
27 changed files with 200 additions and 31 deletions

View File

@@ -67,7 +67,7 @@ public:
CGLPixelFormatObj pixelFormat = nullptr;
};
class CGLBackendImpl : public HeadlessBackend::Impl {
class CGLBackendImpl final : public HeadlessBackend::Impl {
public:
CGLBackendImpl() {
CGLError error = CGLCreateContext(cglDisplay->pixelFormat, nullptr, &glContext);

View File

@@ -37,6 +37,7 @@ CGImageRef CGImageCreateWithMLNPremultipliedImage(mbgl::PremultipliedImage&& src
return CGImageCreate(src.size.width, src.size.height, bitsPerComponent, bitsPerPixel,
bytesPerRow, *colorSpace,
// NOLINTNEXTLINE(bugprone-suspicious-enum-usage)
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast, *provider,
NULL, false, kCGRenderingIntentDefault);
}
@@ -58,6 +59,7 @@ mbgl::PremultipliedImage MLNPremultipliedImageFromCGImage(CGImageRef src) {
CGContextHandle context(CGBitmapContextCreate(
image.data.get(), width, height, bitsPerComponent, bytesPerRow, *colorSpace,
// NOLINTNEXTLINE(bugprone-suspicious-enum-usage)
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast));
if (!context) {
throw std::runtime_error("CGBitmapContextCreate failed");

View File

@@ -242,6 +242,7 @@ PremultipliedImage drawGlyphBitmap(GlyphID glyphID, CTFontRef font, GlyphMetrics
bitsPerComponent,
bytesPerRow,
*colorSpace,
// NOLINTNEXTLINE(bugprone-suspicious-enum-usage)
kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedLast));
if (!context) {
throw std::runtime_error("CGBitmapContextCreate failed");

View File

@@ -11,7 +11,7 @@ std::string uppercase(const std::string &string) {
encoding:NSUTF8StringEncoding
freeWhenDone:NO];
NSString *uppercase = [original uppercaseString];
const std::string result{[uppercase cStringUsingEncoding : NSUTF8StringEncoding],
std::string result{[uppercase cStringUsingEncoding : NSUTF8StringEncoding],
[uppercase lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
return result;
}
@@ -22,8 +22,8 @@ std::string lowercase(const std::string &string) {
encoding:NSUTF8StringEncoding
freeWhenDone:NO];
NSString *lowercase = [original lowercaseString];
const std::string result{[lowercase cStringUsingEncoding : NSUTF8StringEncoding],
[lowercase lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
std::string result{[lowercase cStringUsingEncoding : NSUTF8StringEncoding],
[lowercase lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
return result;
}

View File

@@ -90,7 +90,7 @@ public:
auto &allocator = doc.GetAllocator();
std::map<std::string, std::string> values;
auto db = mapbox::sqlite::Database::open(path.c_str(), mapbox::sqlite::ReadOnly);
auto db = mapbox::sqlite::Database::open(path, mapbox::sqlite::ReadOnly);
mapbox::sqlite::Statement meta(db, "SELECT * from metadata");
for (mapbox::sqlite::Query q(meta); q.run();) {
@@ -268,7 +268,7 @@ private:
return ptr->second;
};
auto ptr2 = db_cache.insert(std::pair<std::string, mapbox::sqlite::Database>(path, mapbox::sqlite::Database::open(path.c_str(), mapbox::sqlite::ReadOnly)));
auto ptr2 = db_cache.insert(std::pair<std::string, mapbox::sqlite::Database>(path, mapbox::sqlite::Database::open(path, mapbox::sqlite::ReadOnly)));
return ptr2.first->second;
}

View File

@@ -42,7 +42,7 @@ std::u16string applyArabicShaping(const std::u16string& input) {
std::u16string outputText(outputLength, 0);
u_shapeArabic(mbgl::utf16char_cast<const UChar*>(input.c_str()), static_cast<int32_t>(input.size()), mbgl::utf16char_cast<UChar*>(&outputText[0]), outputLength,
u_shapeArabic(mbgl::utf16char_cast<const UChar*>(input.c_str()), static_cast<int32_t>(input.size()), mbgl::utf16char_cast<UChar*>(outputText.data()), outputLength,
(U_SHAPE_LETTERS_SHAPE & U_SHAPE_LETTERS_MASK) |
(U_SHAPE_TEXT_DIRECTION_LOGICAL & U_SHAPE_TEXT_DIRECTION_MASK),
&errorCode);
@@ -191,7 +191,7 @@ std::u16string BiDi::writeReverse(const std::u16string& input, std::size_t logic
int32_t outputLength =
ubidi_writeReverse(mbgl::utf16char_cast<const UChar*>(&input[logicalStart]),
logicalLength,
mbgl::utf16char_cast<UChar*>(&outputText[0]),
mbgl::utf16char_cast<UChar*>(outputText.data()),
logicalLength + 1, // Extra room for null terminator, although we don't really need to have ICU write it for us
UBIDI_DO_MIRRORING | UBIDI_REMOVE_BIDI_CONTROLS,
&errorCode);
@@ -223,7 +223,7 @@ std::u16string BiDi::getLine(std::size_t start, std::size_t end) {
// UBIDI_REMOVE_BIDI_CONTROLS: Now that all the lines are set, remove control characters so that
// they don't show up on screen (some fonts have glyphs representing them)
int32_t finalLength = ubidi_writeReordered(impl->bidiLine,
mbgl::utf16char_cast<UChar*>(&outputText[0]),
mbgl::utf16char_cast<UChar*>(outputText.data()),
outputLength,
UBIDI_DO_MIRRORING | UBIDI_REMOVE_BIDI_CONTROLS,
&errorCode);

View File

@@ -1,4 +0,0 @@
Checks: '-*,bugprone-*,clang-analyzer-*,google-*,modernize-*,performance-*,-clang-analyzer-osx.*,-google-readability-braces-around-statements,-google-readability-todo,-google-runtime-int,-google-runtime-references'
WarningsAsErrors: 'bugprone-use-after-move,performance-move-const-arg'
HeaderFilterRegex: '.*'
FormatStyle: file