Skip to content

Commit 77baf06

Browse files
committed
Moved pep257 class instantiation into check().
Also added a version check. Should fix issue #6.
1 parent 1221b33 commit 77baf06

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

linter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ class PEP257(PythonLinter):
3131
line_col_base = (1, 0) # pep257 uses one-based line and zero-based column numbers
3232
tempfile_suffix = 'py'
3333
module = 'pep257'
34+
check_version = True
3435

35-
@classmethod
36-
def initialize(cls):
37-
"""Initialize a PEP257Checker() object, to be re-used on every check()."""
38-
super().initialize()
39-
cls._checker = cls.module.PEP257Checker()
36+
# Internal
37+
checker = None
4038

4139
def check(self, code, filename):
4240
"""Run pep257 on code and return the output."""
41+
if self.checker is None:
42+
self.checker = self.module.PEP257Checker()
43+
4344
errors = []
44-
for error in self._checker.check_source(code, os.path.basename(filename)):
45+
for error in self.checker.check_source(code, os.path.basename(filename)):
4546
if getattr(error, 'code', None) is not None:
4647
errors.append(str(error))
4748

0 commit comments

Comments
 (0)