mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
Allow running against a single file
This commit is contained in:
parent
efd8787e0b
commit
0386aa2643
1 changed files with 8 additions and 1 deletions
|
@ -293,7 +293,7 @@ class PythonPackageValidator(Validator):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('modules', help='Path to modules')
|
parser.add_argument('modules', help='Path to module or module directory')
|
||||||
parser.add_argument('-w', '--warnings', help='Show warnings',
|
parser.add_argument('-w', '--warnings', help='Show warnings',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
@ -302,6 +302,13 @@ def main():
|
||||||
|
|
||||||
exit = []
|
exit = []
|
||||||
|
|
||||||
|
# Allow testing against a single file
|
||||||
|
if os.path.isfile(args.modules):
|
||||||
|
mv = ModuleValidator(os.path.abspath(args.modules))
|
||||||
|
mv.validate()
|
||||||
|
exit.append(mv.report(args.warnings))
|
||||||
|
sys.exit(sum(exit))
|
||||||
|
|
||||||
for root, dirs, files in os.walk(args.modules):
|
for root, dirs, files in os.walk(args.modules):
|
||||||
basedir = root[len(args.modules)+1:].split('/', 1)[0]
|
basedir = root[len(args.modules)+1:].split('/', 1)[0]
|
||||||
if basedir in BLACKLIST_DIRS:
|
if basedir in BLACKLIST_DIRS:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue