def checkSourceLine(line, file_path, reportError):
    if (line.find('.  ') != (- 1)):
        reportError('over-enthusiastic spaces')
    if (isInSubdir(file_path, 'source', 'include') and X_ENVOY_USED_DIRECTLY_REGEX.match(line)):
        reportError('Please do not use the raw literal x-envoy in source code.  See Envoy::Http::PrefixValue.')
    if hasInvalidAngleBracketDirectory(line):
        reportError('envoy includes should not have angle brackets')
    for (invalid_construct, valid_construct) in PROTOBUF_TYPE_ERRORS.items():
        if (invalid_construct in line):
            reportError(('incorrect protobuf type reference %s; should be %s' % (invalid_construct, valid_construct)))
    for (invalid_construct, valid_construct) in LIBCXX_REPLACEMENTS.items():
        if (invalid_construct in line):
            reportError(('term %s should be replaced with standard library term %s' % (invalid_construct, valid_construct)))
    if re.search('#include.*/_virtual_includes/', line):
        reportError("Don't include the virtual includes headers.")
    if (not whitelistedForProtobufDeps(file_path)):
        if (('"google/protobuf' in line) or ('google::protobuf' in line)):
            reportError('unexpected direct dependency on google.protobuf, use the definitions in common/protobuf/protobuf.h instead.')
    if (line.startswith('#include <mutex>') or line.startswith('#include <condition_variable')):
        reportError("Don't use <mutex> or <condition_variable*>, switch to Thread::MutexBasicLockable in source/common/common/thread.h")
    if line.startswith('#include <shared_mutex>'):
        reportError("Don't use <shared_mutex>, use absl::Mutex for reader/writer locks.")
    if ((not whitelistedForRealTime(file_path)) and (not ('NO_CHECK_FORMAT(real_time)' in line))):
        if (('RealTimeSource' in line) or (('RealTimeSystem' in line) and (not ('TestRealTimeSystem' in line))) or ('std::chrono::system_clock::now' in line) or ('std::chrono::steady_clock::now' in line) or ('std::this_thread::sleep_for' in line) or hasCondVarWaitFor(line)):
            reportError("Don't reference real-world time sources from production code; use injection")
    if (not whitelistedForUnpackTo(file_path)):
        if ('UnpackTo' in line):
            reportError("Don't use UnpackTo() directly, use MessageUtil::unpackTo() instead")
    if ('std::get_time' in line):
        if ('test/' in file_path):
            reportError("Don't use std::get_time; use TestUtility::parseTime in tests")
        else:
            reportError("Don't use std::get_time; use the injectable time system")
    if ('std::put_time' in line):
        reportError("Don't use std::put_time; use absl::Time equivalent instead")
    if ('gmtime' in line):
        reportError("Don't use gmtime; use absl::Time equivalent instead")
    if ('mktime' in line):
        reportError("Don't use mktime; use absl::Time equivalent instead")
    if ('localtime' in line):
        reportError("Don't use localtime; use absl::Time equivalent instead")
    if ('strftime' in line):
        reportError("Don't use strftime; use absl::FormatTime instead")
    if ('strptime' in line):
        reportError("Don't use strptime; use absl::FormatTime instead")
    if ('std::atomic_' in line):
        reportError("Don't use free std::atomic_* functions, use std::atomic<T> members instead.")
    if (('__attribute__((packed))' in line) and (file_path != './include/envoy/common/platform.h')):
        reportError("Don't use __attribute__((packed)), use the PACKED_STRUCT macro defined in include/envoy/common/platform.h instead")
    if re.search('\\{\\s*\\.\\w+\\s*\\=', line):
        reportError("Don't use designated initializers in struct initialization, they are not part of C++14")
    if (' ?: ' in line):
        reportError("Don't use the '?:' operator, it is a non-standard GCC extension")
    if line.startswith('using testing::Test;'):
        reportError("Don't use 'using testing::Test;, elaborate the type instead")
    if line.startswith('using testing::TestWithParams;'):
        reportError("Don't use 'using testing::Test;, elaborate the type instead")
    if ((not whitelistedForSerializeAsString(file_path)) and ('SerializeAsString' in line)):
        reportError("Don't use MessageLite::SerializeAsString for generating deterministic serialization, use MessageUtil::hash instead.")
    if ((not whitelistedForJsonStringToMessage(file_path)) and ('JsonStringToMessage' in line)):
        reportError("Don't use Protobuf::util::JsonStringToMessage, use TestUtility::loadFromJson.")
    if (isInSubdir(file_path, 'source') and file_path.endswith('.cc') and (('.counter(' in line) or ('.gauge(' in line) or ('.histogram(' in line))):
        reportError("Don't lookup stats by name at runtime; use StatName saved during construction")
    if re.search('envoy::[a-z0-9_:]+::[A-Z][a-z]\\w*_\\w*_[A-Z]{2}', line):
        reportError("Don't use mangled Protobuf names for enum constants")
    hist_m = re.search('(?<=HISTOGRAM\\()[a-zA-Z0-9_]+_(b|kb|mb|ns|us|ms|s)(?=,)', line)
    if (hist_m and (not whitelistedForHistogramSiSuffix(hist_m.group(0)))):
        reportError("Don't suffix histogram names with the unit symbol, it's already part of the histogram object and unit-supporting sinks can use this information natively, other sinks can add the suffix automatically on flush should they prefer to do so.")
    if ((not whitelistedForStdRegex(file_path)) and ('std::regex' in line)):
        reportError("Don't use std::regex in code that handles untrusted input. Use RegexMatcher")
    if (not whitelistedForGrpcInit(file_path)):
        grpc_init_or_shutdown = line.find('grpc_init()')
        grpc_shutdown = line.find('grpc_shutdown()')
        if ((grpc_init_or_shutdown == (- 1)) or ((grpc_shutdown != (- 1)) and (grpc_shutdown < grpc_init_or_shutdown))):
            grpc_init_or_shutdown = grpc_shutdown
        if (grpc_init_or_shutdown != (- 1)):
            comment = line.find('// ')
            if ((comment == (- 1)) or (comment > grpc_init_or_shutdown)):
                reportError(("Don't call grpc_init() or grpc_shutdown() directly, instantiate " + 'Grpc::GoogleGrpcContext. See #8282'))
def checkSourceLine(line, file_path, reportError):
    if (line.find('.  ') != (- 1)):
        reportError('over-enthusiastic spaces')
    if (isInSubdir(file_path, 'source', 'include') and X_ENVOY_USED_DIRECTLY_REGEX.match(line)):
        reportError('Please do not use the raw literal x-envoy in source code.  See Envoy::Http::PrefixValue.')
    if hasInvalidAngleBracketDirectory(line):
        reportError('envoy includes should not have angle brackets')
    for (invalid_construct, valid_construct) in PROTOBUF_TYPE_ERRORS.items():
        if (invalid_construct in line):
            reportError(('incorrect protobuf type reference %s; should be %s' % (invalid_construct, valid_construct)))
    for (invalid_construct, valid_construct) in LIBCXX_REPLACEMENTS.items():
        if (invalid_construct in line):
            reportError(('term %s should be replaced with standard library term %s' % (invalid_construct, valid_construct)))
    if re.search('#include.*/_virtual_includes/', line):
        reportError("Don't include the virtual includes headers.")
    if (not whitelistedForProtobufDeps(file_path)):
        if (('"google/protobuf' in line) or ('google::protobuf' in line)):
            reportError('unexpected direct dependency on google.protobuf, use the definitions in common/protobuf/protobuf.h instead.')
    if (line.startswith('#include <mutex>') or line.startswith('#include <condition_variable')):
        reportError("Don't use <mutex> or <condition_variable*>, switch to Thread::MutexBasicLockable in source/common/common/thread.h")
    if line.startswith('#include <shared_mutex>'):
        reportError("Don't use <shared_mutex>, use absl::Mutex for reader/writer locks.")
    if ((not whitelistedForRealTime(file_path)) and (not ('NO_CHECK_FORMAT(real_time)' in line))):
        if (('RealTimeSource' in line) or (('RealTimeSystem' in line) and (not ('TestRealTimeSystem' in line))) or ('std::chrono::system_clock::now' in line) or ('std::chrono::steady_clock::now' in line) or ('std::this_thread::sleep_for' in line) or hasCondVarWaitFor(line)):
            reportError("Don't reference real-world time sources from production code; use injection")
    if (not whitelistedForUnpackTo(file_path)):
        if ('UnpackTo' in line):
            reportError("Don't use UnpackTo() directly, use MessageUtil::unpackTo() instead")
    if ('std::get_time' in line):
        if ('test/' in file_path):
            reportError("Don't use std::get_time; use TestUtility::parseTime in tests")
        else:
            reportError("Don't use std::get_time; use the injectable time system")
    if ('std::put_time' in line):
        reportError("Don't use std::put_time; use absl::Time equivalent instead")
    if ('gmtime' in line):
        reportError("Don't use gmtime; use absl::Time equivalent instead")
    if ('mktime' in line):
        reportError("Don't use mktime; use absl::Time equivalent instead")
    if ('localtime' in line):
        reportError("Don't use localtime; use absl::Time equivalent instead")
    if ('strftime' in line):
        reportError("Don't use strftime; use absl::FormatTime instead")
    if ('strptime' in line):
        reportError("Don't use strptime; use absl::FormatTime instead")
    if ('std::atomic_' in line):
        reportError("Don't use free std::atomic_* functions, use std::atomic<T> members instead.")
    if (('__attribute__((packed))' in line) and (file_path != './include/envoy/common/platform.h')):
        reportError("Don't use __attribute__((packed)), use the PACKED_STRUCT macro defined in include/envoy/common/platform.h instead")
    if re.search('\\{\\s*\\.\\w+\\s*\\=', line):
        reportError("Don't use designated initializers in struct initialization, they are not part of C++14")
    if (' ?: ' in line):
        reportError("Don't use the '?:' operator, it is a non-standard GCC extension")
    if line.startswith('using testing::Test;'):
        reportError("Don't use 'using testing::Test;, elaborate the type instead")
    if line.startswith('using testing::TestWithParams;'):
        reportError("Don't use 'using testing::Test;, elaborate the type instead")
    if ((not whitelistedForSerializeAsString(file_path)) and ('SerializeAsString' in line)):
        reportError("Don't use MessageLite::SerializeAsString for generating deterministic serialization, use MessageUtil::hash instead.")
    if ((not whitelistedForJsonStringToMessage(file_path)) and ('JsonStringToMessage' in line)):
        reportError("Don't use Protobuf::util::JsonStringToMessage, use TestUtility::loadFromJson.")
    if (isInSubdir(file_path, 'source') and file_path.endswith('.cc') and (('.counter(' in line) or ('.gauge(' in line) or ('.histogram(' in line))):
        reportError("Don't lookup stats by name at runtime; use StatName saved during construction")
    if re.search('envoy::[a-z0-9_:]+::[A-Z][a-z]\\w*_\\w*_[A-Z]{2}', line):
        reportError("Don't use mangled Protobuf names for enum constants")
    hist_m = re.search('(?<=HISTOGRAM\\()[a-zA-Z0-9_]+_(b|kb|mb|ns|us|ms|s)(?=,)', line)
    if (hist_m and (not whitelistedForHistogramSiSuffix(hist_m.group(0)))):
        reportError("Don't suffix histogram names with the unit symbol, it's already part of the histogram object and unit-supporting sinks can use this information natively, other sinks can add the suffix automatically on flush should they prefer to do so.")
    if ((not whitelistedForStdRegex(file_path)) and ('std::regex' in line)):
        reportError("Don't use std::regex in code that handles untrusted input. Use RegexMatcher")
    if (not whitelistedForGrpcInit(file_path)):
        grpc_init_or_shutdown = line.find('grpc_init()')
        grpc_shutdown = line.find('grpc_shutdown()')
        if ((grpc_init_or_shutdown == (- 1)) or ((grpc_shutdown != (- 1)) and (grpc_shutdown < grpc_init_or_shutdown))):
            grpc_init_or_shutdown = grpc_shutdown
        if (grpc_init_or_shutdown != (- 1)):
            comment = line.find('// ')
            if ((comment == (- 1)) or (comment > grpc_init_or_shutdown)):
                reportError(("Don't call grpc_init() or grpc_shutdown() directly, instantiate " + 'Grpc::GoogleGrpcContext. See #8282'))