From ef38433bb8fd6e911dbbf88d55b1cd72cd281f5c Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Fri, 26 Jun 2020 20:23:14 +0200 Subject: [PATCH] Unrelated: handle migration files gathered from git command that are not in the installed_apps --- django_migration_linter/migration_linter.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index 8134c19..4e27826 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -331,8 +331,18 @@ class MigrationLinter(object): if self.is_migration_file(line): app_label, name = split_migration_path(line) if migrations_list is None or (app_label, name) in migrations_list: - migration = self.migration_loader.disk_migrations[app_label, name] - migrations.append(migration) + if (app_label, name) in self.migration_loader.disk_migrations: + migration = self.migration_loader.disk_migrations[ + app_label, name + ] + migrations.append(migration) + else: + logger.info( + "Found migration file (%s, %s) " + "that is not present in loaded migration.", + app_label, + name, + ) diff_process.wait() if diff_process.returncode != 0: