def METHOD_NAME(rules_yml: 'os.PathLike[str]') -> int:
    res = 0
    needed_rules = deepcopy(YML_CONFIG.all_extends)
    with open(rules_yml) as fr:
        for index, line in enumerate(fr):
            if line.startswith('.rules:'):
                key = line.strip().rsplit(':', 1)[0]
                if not YML_CONFIG.exists(key):
                    print(
                        '{}:{}:WARNING:rule "{}" unused'.format(rules_yml, index, key)
                    )
                else:
                    needed_rules.remove(key)
    if needed_rules:
        for item in needed_rules:
            print('ERROR: missing rule: "{}"'.format(item))
        res = 1
    if res == 0:
        print('Pass')
    return res