Refactor some linting code to more intelligible conditions
This commit is contained in:
1 parent
902752c3f1
commit
d410d2c7ba
1 file changed
+8
-8
@@ -130,7 +130,12 @@ class MigrationLinter(object):
|
|||||||
exclude_migration_tests,
|
exclude_migration_tests,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not errors:
|
if errors:
|
||||||
|
self.print_linting_msg(app_label, migration_name, "ERR", MessageType.ERROR)
|
||||||
|
self.nb_erroneous += 1
|
||||||
|
self.print_errors(errors)
|
||||||
|
value_to_cache = {"result": "ERR", "errors": errors}
|
||||||
|
else:
|
||||||
if ignored:
|
if ignored:
|
||||||
self.print_linting_msg(
|
self.print_linting_msg(
|
||||||
app_label, migration_name, "OK (ignored)", MessageType.IGNORE
|
app_label, migration_name, "OK (ignored)", MessageType.IGNORE
|
||||||
@@ -139,15 +144,10 @@ class MigrationLinter(object):
|
|||||||
else:
|
else:
|
||||||
self.print_linting_msg(app_label, migration_name, "OK", MessageType.OK)
|
self.print_linting_msg(app_label, migration_name, "OK", MessageType.OK)
|
||||||
self.nb_valid += 1
|
self.nb_valid += 1
|
||||||
if self.should_use_cache():
|
value_to_cache = {"result": "OK"}
|
||||||
self.new_cache[md5hash] = {"result": "OK"}
|
|
||||||
return
|
|
||||||
|
|
||||||
self.print_linting_msg(app_label, migration_name, "ERR", MessageType.ERROR)
|
|
||||||
self.nb_erroneous += 1
|
|
||||||
self.print_errors(errors)
|
|
||||||
if self.should_use_cache():
|
if self.should_use_cache():
|
||||||
self.new_cache[md5hash] = {"result": "ERR", "errors": errors}
|
self.new_cache[md5hash] = value_to_cache
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_migration_hash(app_label, migration_name):
|
def get_migration_hash(app_label, migration_name):
|
||||||
|
|||||||
Reference in new issue
Block a user