Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[repo] Allow skipping paths in sanity check script #2060

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build/scripts/sanitycheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@
CRLF = b'\r\n'
LF = b'\n'

# Add paths to exclude from sanity checks here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add a comment saying these are done to mainly for auto-generated code from the checks, until code generation itself can be fixed, if at all possible.

exclude_folders = [
"src/OpenTelemetry.SemanticConventions"
joaopgrassi marked this conversation as resolved.
Show resolved Hide resolved
]
# 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 = []
Expand Down
Loading