Add command to only check migration files in a given file

This commit is contained in:
yongming authored and David Wobrock committed 2019-10-10 22:50:17 +02:00
1 parent 14cafd017d
commit adf61dd669
2 files changed
+33 -2

No files matched your search

@@ -25,6 +25,15 @@ class Command(BaseCommand):
"the initial repo commit will be used"
),
)
parser.add_argument(
"--include-migrations-in-file",
metavar="FILE_PATH",
type=str,
nargs="?",
help=(
"if specified, only migrations inside the file " "will be considered",
),
)
parser.add_argument(
"--ignore-name-contains",
type=str,
@@ -122,7 +131,10 @@ class Command(BaseCommand):
only_unapplied_migrations=options["unapplied_migrations"],
exclude_migration_tests=options["exclude_migration_tests"],
)
linter.lint_all_migrations(git_commit_id=options["commit_id"])
linter.lint_all_migrations(
git_commit_id=options["commit_id"],
migrations_file_path=options["include_migrations_in_file"],
)
linter.print_summary()
if linter.has_errors:
sys.exit(1)