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