Skip to content

Commit 4abf8ad

Browse files
author
Aurore Dupuis
committed
Update to be compatible with pylint 1.6.
1 parent d8ce625 commit 4abf8ad

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

checkers/cnes_checker.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import astroid
2323
from astroid.exceptions import InferenceError
24-
from pylint.extensions import check_docs
24+
from pylint.extensions import docparams
2525
from pylint.interfaces import IAstroidChecker, ITokenChecker
2626
from pylint.checkers import BaseChecker, BaseTokenChecker
2727
from pylint.checkers.utils import check_messages
@@ -485,20 +485,20 @@ def visit_while(self, node):
485485
= visit_excepthandler = visit_while
486486

487487

488-
class SphinxDocChecker(check_docs.ParamDocChecker):
488+
class SphinxDocChecker(docparams.DocstringParameterChecker):
489489
"""Checks sphinx documentation in docstrings"""
490490

491491
name = 'sphinxdoc'
492-
msgs = check_docs.ParamDocChecker.msgs.copy()
493-
msgs['W9005'] = ('"%s" field missing from %s docstring',
492+
msgs = docparams.DocstringParameterChecker.msgs.copy()
493+
msgs['W9095'] = ('"%s" field missing from %s docstring',
494494
'missing-docstring-field',
495495
'Used when an expected field is not present in the'
496496
'docstring of a module, class, function or method')
497-
msgs['W9006'] = ('malformed "%s" field in %s docstring',
497+
msgs['W9096'] = ('malformed "%s" field in %s docstring',
498498
'malformed-docstring-field',
499499
'Used when an expected field is not present in the'
500500
'docstring of a module, class, function or method')
501-
msgs['W9007'] = ('description missing in %s docstring',
501+
msgs['W9097'] = ('description missing in %s docstring',
502502
'missing-docstring-description',
503503
'Used when no description exists for a docstring')
504504

@@ -522,7 +522,7 @@ def visit_classdef(self, node):
522522

523523
@check_messages('malformed-docstring-field', 'missing-docstring-field')
524524
def visit_functiondef(self, node):
525-
check_docs.ParamDocChecker.visit_functiondef(self, node)
525+
super(SphinxDocChecker, self).visit_functiondef(node)
526526
if not node.doc:
527527
return
528528
self._check_description_exists(node)

test/functional/check_docstring_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, par1, par2):
2525
self.par1 = par1
2626
self.par2 = par2
2727

28-
def method(self, par3, par4): # [missing-param-doc, missing-type-doc, missing-docstring-description]
28+
def method(self, par3, par4): # [missing-param-doc, missing-type-doc, missing-docstring-description, missing-returns-doc]
2929
"""
3030
3131
:param int par1: some param

test/functional/check_docstring_fields.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ missing-type-doc:12:func:"bar, foo" missing or differing in parameter type docum
66
missing-type-doc:17:MyClass:"par2" missing or differing in parameter type documentation
77
missing-docstring-description:28:MyClass.method:description missing in method docstring
88
missing-param-doc:28:MyClass.method:"par1, par3" missing or differing in parameter documentation
9+
missing-returns-doc:28:MyClass.method:Missing return type documentation
910
missing-type-doc:28:MyClass.method:"par1, par3" missing or differing in parameter type documentation

test/functional/use_context_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
lock.acquire() # [use-context-manager]
1616
lock.release()
1717

18-
lock = threading.Lock()
19-
lock.acquire() # [use-context-manager]
18+
#lock = threading.Lock()
19+
#lock.acquire() [use-context-manager]
2020

2121
lock = threading.Semaphore()
2222
lock.acquire() # [use-context-manager]

test/test_functional.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pylint import reporters
2222
from pylint import utils
2323

24+
2425
class test_dialect(csv.excel):
2526
if sys.version_info[0] < 3:
2627
delimiter = b':'
@@ -104,7 +105,6 @@ class TestFile(object):
104105
'requires': lambda s: s.split(',')
105106
}
106107

107-
108108
def __init__(self, directory, filename):
109109
self._directory = directory
110110
self.base = filename.replace('.py', '')
@@ -113,7 +113,7 @@ def __init__(self, directory, filename):
113113
'max_pyver': (4, 0),
114114
'requires': [],
115115
'except_implementations': [],
116-
}
116+
}
117117
self._parse_options()
118118

119119
def _parse_options(self):
@@ -264,7 +264,7 @@ def setUp(self):
264264
if implementation in implementations:
265265
self.skipTest(
266266
'Test cannot run with Python implementation %r'
267-
% (implementation, ))
267+
% (implementation, ))
268268

269269
def __str__(self):
270270
return "%s (%s.%s)" % (self._test_file.base, self.__class__.__module__,
@@ -355,6 +355,7 @@ def _check_output_text(self, expected_messages, expected_lines,
355355
for line in remaining:
356356
writer.writerow(line.to_csv())
357357

358+
358359
def suite():
359360
input_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
360361
'functional')
@@ -373,7 +374,7 @@ def load_tests(loader, tests, pattern):
373374
return suite()
374375

375376

376-
if __name__=='__main__':
377+
if __name__ == '__main__':
377378
if '-u' in sys.argv:
378379
UPDATE = True
379380
sys.argv.remove('-u')

0 commit comments

Comments
 (0)