Commit 53478f8d authored by Michal Čihař's avatar Michal Čihař

Factor out check skip decision

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 6cc09d63
...@@ -41,6 +41,16 @@ class Check(object): ...@@ -41,6 +41,16 @@ class Check(object):
self.enable_string = id_dash self.enable_string = id_dash
self.ignore_string = 'ignore-%s' % id_dash self.ignore_string = 'ignore-%s' % id_dash
def should_skip(self, unit):
"""Check whether we should skip processing this unit"""
# Is this disabled by default
if self.default_disabled and self.enable_string not in unit.all_flags:
return True
# Is this check ignored
if self.ignore_string in unit.all_flags:
return True
return False
def check_target(self, sources, targets, unit): def check_target(self, sources, targets, unit):
''' '''
Checks target strings. Checks target strings.
...@@ -49,11 +59,7 @@ class Check(object): ...@@ -49,11 +59,7 @@ class Check(object):
return self.check_target_unit_with_flag( return self.check_target_unit_with_flag(
sources, targets, unit sources, targets, unit
) )
# Is this disabled by default if self.should_skip(unit):
if self.default_disabled and self.enable_string not in unit.all_flags:
return False
# Is this check ignored
if self.ignore_string in unit.all_flags:
return False return False
# No checking of not translated units # No checking of not translated units
if self.ignore_untranslated and not unit.translated: if self.ignore_untranslated and not unit.translated:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment