From 4fd287655a72b9aea14cdac715ad5b90ed082ed2 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sun, 19 Jun 2022 19:47:51 +0530 Subject: add circuitpython code --- .../raspberrypi/sdk/tools/check_doxygen_groups.py | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 circuitpython/ports/raspberrypi/sdk/tools/check_doxygen_groups.py (limited to 'circuitpython/ports/raspberrypi/sdk/tools/check_doxygen_groups.py') diff --git a/circuitpython/ports/raspberrypi/sdk/tools/check_doxygen_groups.py b/circuitpython/ports/raspberrypi/sdk/tools/check_doxygen_groups.py new file mode 100755 index 0000000..bbcd9f5 --- /dev/null +++ b/circuitpython/ports/raspberrypi/sdk/tools/check_doxygen_groups.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2021 Raspberry Pi (Trading) Ltd. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# +# Little script to check that every \ingroup has a matching \defgroup +# +# Usage: +# +# Run from the root of the tree to check + + +import subprocess +import re +import sys +import os + +groups = {} +any_errors = False + +res = subprocess.run(['git', 'grep', '\\defgroup'], check=True, stdout=subprocess.PIPE) +for line in res.stdout.decode('utf8').split('\n'): + m = re.match(r'^(\S+):.*\\defgroup\s+(\w+)', line) + if m: + filename = m.group(1) + group = m.group(2) + if os.path.basename(filename) in ('check_doxygen_groups.py', 'index.h'): + continue + if group in groups: + any_errors = True + print("{} uses \\defgroup {} but so does {}".format(groups[group], group, filename)) + else: + groups[group] = filename + +res = subprocess.run(['git', 'grep', '\\ingroup'], check=True, stdout=subprocess.PIPE) +for line in res.stdout.decode('utf8').split('\n'): + m = re.match(r'^(\S+):.*\\ingroup\s+(\w+)', line) + if m: + filename = m.group(1) + group = m.group(2) + if os.path.basename(filename) in ('check_doxygen_groups.py', 'index.h'): + continue + if group not in groups: + any_errors = True + print("{} uses \\ingroup {} which was never defined".format(filename, group)) + +sys.exit(any_errors) -- cgit v1.2.3