From b0f59cb5cb924c86f70e6c918a5f09f370563a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Tue, 15 Mar 2022 11:55:36 +0100 Subject: [PATCH] Flag new user-visible log messages for review Messages with log levels INFO or higher are flagged for manual review. Purpose of this check is to prevent debug logs to being released with too-high log level. --- dangerfile.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dangerfile.py b/dangerfile.py index 430f260e4c..5a7b564758 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -273,3 +273,24 @@ annotations_added = lines_containing(configure_added_lines, '# [pairwise: ') if len(switches_added) > len(annotations_added): fail('This merge request adds at least one new `./configure` switch that ' 'is not annotated for pairwise testing purposes.') + +############################################################################### +# USER-VISIBLE LOG LEVELS +############################################################################### +# +# WARN if the merge request adds new user-visible log messages (INFO or above) + +user_visible_log_levels = [ + 'ISC_LOG_INFO', + 'ISC_LOG_NOTICE', + 'ISC_LOG_WARNING', + 'ISC_LOG_ERROR', + 'ISC_LOG_CRITICAL', +] +source_added_lines = added_lines(target_branch, ['*.[ch]']) +for log_level in user_visible_log_levels: + if (lines_containing(source_added_lines, log_level)): + warn('This merge request adds new user-visible log messages with ' + 'level INFO or above. Please double-check log levels and make ' + 'sure none of the messages added is a leftover debug message.') + break