1#!/usr/bin/env python3
2#
3# Arm SCP/MCP Software
4# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7
8"""
9Check for missing documentation.
10This script runs 'make -f Makefile.cmake doc' and checks for any
11output on stderr, where the Doxygen tool outputs any warnings
12about undocumented components
13"""
14
15import sys
16import subprocess
17from utils import banner
18
19
20def run():
21    print(banner('Checking for undocumented code'))
22
23    result = subprocess.Popen(
24        'make -f Makefile.cmake doc',
25        shell=True,
26        stdout=subprocess.DEVNULL,
27        stderr=subprocess.PIPE)
28
29    (stdout, stderr) = result.communicate()
30
31    if result.returncode != 0:
32        print(stderr.decode())
33        print('Error checking for undocumented code.')
34        return False
35
36    print('The codebase is fully documented.')
37    return True
38
39
40def main():
41    return 0 if run() else 1
42
43
44if __name__ == '__main__':
45    sys.exit(main())
46