blob: b1aaadf8c06cd8a9ae9569fa6274226806374768 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
"""Test for statements without effects."""
# pylint: disable=too-few-public-methods
# +1:[pointless-string-statement]
"""inline doc string should use a separated message"""
__revision__ = ''
__revision__ # [pointless-statement]
__revision__ <= 1 # [pointless-statement]
__revision__.lower()
[i for i in __revision__] # [pointless-statement]
# +1:[pointless-string-statement]
"""inline doc string should use a separated message"""
__revision__.lower(); # [unnecessary-semicolon]
list() and tuple() # [expression-not-assigned]
def to_be():
"""return 42"""
return "42"
ANSWER = to_be() # ok
ANSWER == to_be() # [expression-not-assigned]
to_be() or not to_be() # [expression-not-assigned]
to_be().title # [expression-not-assigned]
GOOD_ATTRIBUTE_DOCSTRING = 42
"""Module level attribute docstring is fine. """
class ClassLevelAttributeTest(object):
""" test attribute docstrings. """
good_attribute_docstring = 24
""" class level attribute docstring is fine either. """
second_good_attribute_docstring = 42
# Comments are good.
# empty lines are good, too.
""" Still a valid class level attribute docstring. """
def __init__(self):
self.attr = 42
""" Good attribute docstring """
attr = 24
""" Still a good __init__ level attribute docstring. """
val = 0
for val in range(42):
val += attr
# +1:[pointless-string-statement]
""" Invalid attribute docstring """
self.val = val
def test(self):
""" invalid attribute docstrings here. """
self.val = 42
# +1:[pointless-string-statement]
""" this is an invalid attribute docstring. """
|