# clang-tidy configuration for AfterAPro.
#
# clang-analyzer and bugprone are the checks that find real defects in C.
# Three exclusions, all deliberate:
#
# - insecureAPI.DeprecatedOrUnsafeBufferHandling wants the Annex K _s functions
#   (snprintf_s and friends). They are optional in C11, absent from glibc and
#   present only on MSVC, so following it would make the code build on neither
#   of our two targets. Bounded calls (snprintf with sizeof, strncpy followed by
#   an explicit terminator) are what we use instead.
# - readability-magic-numbers fires on every layout constant, where the number
#   next to the widget is the clearest form.
# - security.ArrayBound cannot relate an allocation of width * height elements
#   to a loop bounded by width and by height once the function holding the loop
#   has been inlined into the one holding the allocation. It reports the blur
#   and the edge aware average in st_detail.c, both of which clamp or skip
#   every index before using it. The check spent ten years in alpha for this
#   reason. The same code is run under AddressSanitizer by `make SAN=asan test`,
#   which is the check that would find a real overrun.
Checks: >
  clang-analyzer-*,
  bugprone-*,
  -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
  -clang-analyzer-security.ArrayBound,
  -bugprone-easily-swappable-parameters
# A finding in our own code fails `make check-format`. The header filter keeps
# the report to AfterAPro's own headers: nilorea and Allegro are not ours to fix
# from here.
WarningsAsErrors: '*'
HeaderFilterRegex: 'AfterAPro/(include|src)/'
