Permalink
Switch branches/tags
pylint-version-1.1.0 pylint-version-1.0.0 pylint-version-0.28.0 pylint-version-0.27.0 pylint-version-0.26.0 pylint-version-0.25.2 pylint-version-0.25.1 pylint-version-0.25.0 pylint-version-0.24.0 pylint-version-0.23.0 pylint-version-0.22.0 pylint-version-0.21.4 pylint-version-0.21.3 pylint-version-0.21.2 pylint-version-0.21.1 pylint-version-0.21.0 pylint-version-0.20.0 pylint-version-0.19.0 pylint-version-0.18.1 pylint-version-0_17_0 pylint-version-0_15_2 pylint-version-0_15_1 pylint-version-0_15_0 pylint-version-0_13_0 pylint-debian-version-1.1.0-1 pylint-debian-version-1.0.0-1 pylint-debian-version-0.28.0-1 pylint-debian-version-0.27.0-1 pylint-debian-version-0.26.0-1 pylint-debian-version-0.25.2-1 pylint-debian-version-0.25.1-1 pylint-debian-version-0.25.0-1 pylint-debian-version-0.24.0-1 pylint-debian-version-0.23.0-1 pylint-debian-version-0.22.0-1 pylint-debian-version-0.21.4-1 pylint-debian-version-0.21.3-1 pylint-debian-version-0.21.2-1 pylint-debian-version-0.21.1-1 pylint-debian-version-0.21.0-1 pylint-debian-version-0.20.0-1 pylint-debian-version-0.19.0-1 pylint-debian-version-0.18.1-1 pylint-debian-version-0_15_2-1 pylint-debian-version-0_15_1-1 pylint-debian-version-0_15_0-1 pylint-debian-version-0_13_0-1 pylint-2.1.1 pylint-2.1.0 pylint-2.0.1 pylint-2.0 pylint-2.0.dev1 pylint-2.0.dev pylint-1.9.2 pylint-1.9.1 pylint-1.9 pylint-1.8.4 pylint-1.8.3 pylint-1.8.2 pylint-1.8.1 pylint-1.8.0 pylint-1.7.6 pylint-1.7.5 pylint-1.7.4 pylint-1.7.3 pylint-1.7.2 pylint-1.7.1 pylint-1.7.0 pylint-1.6.5 pylint-1.6.4 pylint-1.6.3 pylint-1.6.2 pylint-1.6.1 pylint-1.6.0 pylint-1.5.6 pylint-1.5.5 pylint-1.5.4 pylint-1.5.3 pylint-1.5.2 pylint-1.5.1 pylint-1.5 pylint-1.4.5 pylint-1.4.4 pylint-1.4.3 pylint-1.4.2 pylint-1.4.1 pylint-1.4 pylint-1.3.1 pylint-1.3 pylint-1.2 before-astroid
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (26 sloc) 1.09 KB
from pylint.interfaces import IRawChecker
from pylint.checkers import BaseChecker
class MyRawChecker(BaseChecker):
"""check for line continuations with '\' instead of using triple
quoted string or parenthesis
"""
__implements__ = IRawChecker
name = 'custom_raw'
msgs = {'W9901': ('use \\ for line continuation',
'backslash-line-continuation',
('Used when a \\ is used for a line continuation instead'
' of using triple quoted string or parenthesis.')),
}
options = ()
def process_module(self, node):
"""process a module
the module's content is accessible via node.stream() function
"""
with node.stream() as stream:
for (lineno, line) in enumerate(stream):
if line.rstrip().endswith('\\'):
self.add_message('backslash-line-continuation',
line=lineno)
def register(linter):
"""required method to auto register this checker"""
linter.register_checker(MyRawChecker(linter))