ansible/test/sanity/code-smell/obsolete-files.py
Matt Clay 5a50fb35df Add sanity test for obsolete files.
This will help prevent accidental merging of content to recently obsoleted directories when adding new files.

It may also help contributors who have modified obsolete files understand where their changes should now be made.
2019-08-09 11:22:59 -07:00

19 lines
485 B
Python
Executable file

#!/usr/bin/env python
"""Prevent files from being added to directories that are now obsolete."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
def main():
"""Main entry point."""
paths = sys.argv[1:] or sys.stdin.read().splitlines()
for path in paths:
print('%s: directory "%s/" is obsolete and should not contain any files' % (path, os.path.dirname(path)))
if __name__ == '__main__':
main()