mirror of
https://github.com/facebook/rocksdb.git
synced 2024-12-01 07:15:51 +00:00
f7237e3395
Reviewed By: jermenkoo Differential Revision: D64318168 fbshipit-source-id: 62bddd81424f1c5d4f50ce3512a9a8fe57a19ec3
23 lines
839 B
Python
Executable file
23 lines
839 B
Python
Executable file
#!/usr/bin/env python3
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
import glob
|
|
|
|
# Checks that all python files in the repository are at least free of syntax
|
|
# errors. This provides a minimal pre-/post-commit check for python file
|
|
# modifications.
|
|
|
|
filenames = []
|
|
# Avoid scanning all of ./ because there might be other external repos
|
|
# linked in.
|
|
for base in ["buckifier", "build_tools", "coverage", "tools"]:
|
|
# Clean this up when we finally upgrade to Python 3
|
|
for suff in ["*", "*/*", "*/*/*"]:
|
|
filenames += glob.glob(base + "/" + suff + ".py")
|
|
|
|
for filename in filenames:
|
|
source = open(filename).read() + "\n"
|
|
# Parses and syntax checks the file, throwing on error. (No pyc written.)
|
|
_ = compile(source, filename, "exec")
|
|
|
|
print(f"No syntax errors in {len(filenames)} .py files")
|