Last active
May 29, 2025 17:51
-
-
Save glimchb/8b1b00e371a43a40e7dd7339ec0e9643 to your computer and use it in GitHub Desktop.
SPDK doc/jsonrpc.md linter of json examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################### | |
import re | |
with open("doc/jsonrpc.md", "r") as file: | |
data = file.read() | |
examples = re.findall("~~~json(.+?)~~~", data, re.MULTILINE | re.DOTALL) | |
for example in examples: | |
try: | |
json.loads(example) | |
except json.decoder.JSONDecodeError: | |
for i, x in enumerate(example.splitlines()): | |
print(i+2,x) | |
raise | |
################################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment