1#!/usr/bin/python3
2import re
3
4
5def project(name: str) -> bool:
6    reject_regex = [
7        ".*-oem",
8        "openbmc/ibm-.*",
9        "openbmc/intel-.*",
10        "openbmc/google-.*",
11        "openbmc/meta-.*",
12    ]
13
14    reject_repo = [
15        "openbmc/s2600wf-misc",
16    ]
17
18    for r in reject_repo:
19        if r == name:
20            return False
21
22    for r in reject_regex:
23        if re.match(r, name):
24            return False
25
26    return True
27
28
29def file(proj: str, filename: str) -> bool:
30    reject_regex = {
31        "all": [
32            ".*/create_pel.*",
33            ".*/google/",
34            ".*/ibm/",
35            ".*/intel/",
36            "MAINTAINERS",
37            "OWNERS",
38            "ibm-.*",
39            "ibm_.*",
40        ],
41        "openbmc/entity-manager": ["configurations/.*"],
42        "openbmc/libmctp": ["docs/bindings/vendor-.*"],
43        "openbmc/openbmc": ["meta-(?!phosphor).*", "poky/.*"],
44        "openbmc/openbmc-test-automation": ["oem/.*", "openpower/.*"],
45        "openbmc/openpower-libhei": [
46            "test/simulator/sample_data/.*",
47            "test/simulator/test_*cases/.*",
48            "xml/.*",
49        ],
50        "openbmc/openpower-hw-diags": [
51            ".*/pel/.*",
52            ".*/ras-data/.*",
53        ],
54        "openbmc/phosphor-debug-collector": [
55            "dump-extensions/.*",
56            "tools/dreport.d/ibm.d/.*",
57        ],
58        "openbmc/phosphor-fan-presence": [".*/config_files/.*"],
59        "openbmc/phosphor-power": [".*/config_files/.*"],
60        "openbmc/phosphor-led-manager": ["configs/.*"],
61        "openbmc/phosphor-logging": [".*/openpower-pels/.*"],
62        "openbmc/webui-vue": [
63            "src/env/.*",
64        ],
65    }
66
67    reject_files = ["/COMMIT_MSG", "/PATCHSET_LEVEL"]
68
69    for r in reject_files:
70        if r == filename:
71            return False
72
73    for r in reject_regex.get(proj, []) + reject_regex.get("all", []):
74        if re.match(r, filename):
75            return False
76
77    return True
78