From c7a1f5c24b583a85dfeb20b233795310994fcb90 Mon Sep 17 00:00:00 2001 From: Joao Grassi <5938087+joaopgrassi@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:37:20 +0200 Subject: [PATCH] Allow skipping paths in sanity check --- build/scripts/sanitycheck.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/scripts/sanitycheck.py b/build/scripts/sanitycheck.py index 901d364f46..a1bf521970 100644 --- a/build/scripts/sanitycheck.py +++ b/build/scripts/sanitycheck.py @@ -8,12 +8,21 @@ CRLF = b'\r\n' LF = b'\n' +# Add paths to exclude from sanity checks here +exclude_folders = [ + "src/OpenTelemetry.SemanticConventions" +] +# Normalize paths so they work in windows/unix +exclude_folders = [os.path.normpath(folder) for folder in exclude_folders] + def sanitycheck(pattern, allow_utf8 = False, allow_eol = (CRLF, LF), indent = 1): error_count = 0 for filename in glob.glob(pattern, recursive=True): if not os.path.isfile(filename): continue + if any(filename.startswith(exclude_folder) for exclude_folder in exclude_folders): + continue with open(filename, 'rb') as file: content = file.read() error = []