Add method to linter reset_counters

This commit is contained in:
David Wobrock committed 2020-07-02 19:15:30 +02:00
1 parent a9cae8a21e
commit 8a7cff3c82
1 file changed
+8 -5
+8 -5
View File
@@ -72,11 +72,7 @@ class MigrationLinter(object):
self.warnings_as_errors = warnings_as_errors
# Initialise counters
self.nb_valid = 0
self.nb_ignored = 0
self.nb_warnings = 0
self.nb_erroneous = 0
self.nb_total = 0
self.reset_counters()
# Initialise cache. Read from old, write to new to prune old entries.
if self.should_use_cache():
@@ -91,6 +87,13 @@ class MigrationLinter(object):
connection=connections[self.database], load=True
)
def reset_counters(self):
self.nb_valid = 0
self.nb_ignored = 0
self.nb_warnings = 0
self.nb_erroneous = 0
self.nb_total = 0
def should_use_cache(self):
return self.django_path and not self.no_cache