]> begriffs open source - freertos/blob - .github/scripts/kernel_checker.py
Remove support for tmrCOMMAND_START_DONT_TRACE (#305)
[freertos] / .github / scripts / kernel_checker.py
1 #!/usr/bin/env python3
2
3 import os
4 from common.header_checker import HeaderChecker
5
6 #--------------------------------------------------------------------------------------------------
7 #                                            CONFIG
8 #--------------------------------------------------------------------------------------------------
9 KERNEL_IGNORED_FILES = [
10     'FreeRTOS-openocd.c'
11 ]
12
13 KERNEL_IGNORED_EXTENSIONS = [
14     '.yml',
15     '.css',
16     '.idx',
17     '.md',
18     '.url',
19     '.sty',
20     '.0-rc2',
21     '.s82',
22     '.js',
23     '.out',
24     '.pack',
25     '.2',
26     '.1-kernel-only',
27     '.0-kernel-only',
28     '.0-rc1',
29     '.readme',
30     '.tex',
31     '.png',
32     '.bat',
33     '.sh',
34     '.txt'
35 ]
36
37 KERNEL_IGNORED_PATTERNS = [
38     r'.*\.git.*',
39     r'.*portable.*Xtensa_ESP32\/include\/portmacro\.h',
40     r'.*portable.*Xtensa_ESP32.*port\.c',
41     r'.*portable.*Xtensa_ESP32.*portasm\.S',
42     r'.*portable.*Xtensa_ESP32.*xtensa_.*',
43     r'.*portable.*Xtensa_ESP32.*portmux_impl.*',
44     r'.*portable.*Xtensa_ESP32.*xt_asm_utils\.h'
45 ]
46
47 KERNEL_HEADER = [
48     '/*\n',
49     ' * FreeRTOS Kernel V10.4.3\n',
50     ' * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\n',
51     ' *\n',
52     ' * Permission is hereby granted, free of charge, to any person obtaining a copy of\n',
53     ' * this software and associated documentation files (the "Software"), to deal in\n',
54     ' * the Software without restriction, including without limitation the rights to\n',
55     ' * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n',
56     ' * the Software, and to permit persons to whom the Software is furnished to do so,\n',
57     ' * subject to the following conditions:\n',
58     ' *\n',
59     ' * The above copyright notice and this permission notice shall be included in all\n',
60     ' * copies or substantial portions of the Software.\n',
61     ' *\n',
62     ' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n',
63     ' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n',
64     ' * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n',
65     ' * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n',
66     ' * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n',
67     ' * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n',
68     ' *\n',
69     ' * https://www.FreeRTOS.org\n',
70     ' * https://github.com/FreeRTOS\n',
71     ' *\n',
72     ' */\n',
73 ]
74
75
76 def main():
77     parser = HeaderChecker.configArgParser()
78     args   = parser.parse_args()
79
80     # Configure the checks then run
81     checker = HeaderChecker(KERNEL_HEADER)
82     checker.ignoreExtension(*KERNEL_IGNORED_EXTENSIONS)
83     checker.ignorePattern(*KERNEL_IGNORED_PATTERNS)
84     checker.ignoreFile(*KERNEL_IGNORED_FILES)
85     checker.ignoreFile(os.path.split(__file__)[-1])
86
87     rc = checker.processArgs(args)
88     if rc:
89         checker.showHelp(__file__)
90
91     return rc
92
93 if __name__ == '__main__':
94     exit(main())
95