refactoring

This commit is contained in:
Vincent Poulailleau 2019-11-22 13:26:31 +01:00
parent a3c05b80b7
commit 09018c0a41
7 changed files with 9 additions and 19 deletions

View File

@ -12,9 +12,7 @@ log = simplelogging.get_logger()
class Checker(ABC):
"""Base class for checkers."""
def __init__(self, name):
"""Initializer, name is displayed in messages."""
self.name = name
name = "UnknownChecker" # name displayed in error messages
def check_file(self, pofile: PoFile):
"""Check a `*.po` file."""

View File

@ -9,9 +9,7 @@ from padpo.pofile import PoItem
class DoubleSpaceChecker(Checker):
"""Checker for double spaces."""
def __init__(self):
"""Initialiser."""
super().__init__(name="Double space")
name = "Double space"
def check_item(self, item: PoItem):
"""Check an item in a `*.po` file."""

View File

@ -8,9 +8,7 @@ from padpo.pofile import PoItem
class EmptyChecker(Checker):
"""Checker for missing translations."""
def __init__(self):
"""Initialiser."""
super().__init__(name="Empty")
name = "Empty"
def check_item(self, item: PoItem):
"""Check an item in a `*.po` file."""

View File

@ -7,9 +7,7 @@ from padpo.pofile import PoItem
class FuzzyChecker(Checker):
"""Checker for fuzzy translations."""
def __init__(self):
"""Initialiser."""
super().__init__(name="Fuzzy")
name = "Fuzzy"
def check_item(self, item: PoItem):
"""Check an item in a `*.po` file."""

View File

@ -19,9 +19,11 @@ log = simplelogging.get_logger()
class GrammalecteChecker(Checker):
"""Checker for grammar errors."""
name = "Grammalecte"
def __init__(self):
"""Initialiser."""
super().__init__(name="Grammalecte")
super().__init__()
self.dir = None
def check_file(self, pofile: PoFile):

View File

@ -9,9 +9,7 @@ MAX_LINE_LENGTH = 79
class LineLengthChecker(Checker):
"""Checker for line length."""
def __init__(self):
"""Initialiser."""
super().__init__(name="Line length")
name = "Line length"
def check_item(self, item: PoItem):
"""Check an item in a `*.po` file."""

View File

@ -9,9 +9,7 @@ from padpo.pofile import PoItem
class NonBreakableSpaceChecker(Checker):
"""Checker for missing non breakable spaces."""
def __init__(self):
"""Initialiser."""
super().__init__(name="NBSP")
name = "NBSP"
def check_item(self, item: PoItem):
"""Check an item in a `*.po` file."""