| Index: Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py
|
| diff --git a/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py b/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..00fbe89d16b8e84d800398d0742b78b50448743c
|
| --- /dev/null
|
| +++ b/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py
|
| @@ -0,0 +1,31 @@
|
| +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',
|
| + ('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.file_stream object
|
| + """
|
| + for (lineno, line) in enumerate(node.file_stream):
|
| + if line.rstrip().endswith('\\'):
|
| + self.add_message('W9901', line=lineno)
|
| +
|
| +
|
| +def register(linter):
|
| + """required method to auto register this checker"""
|
| + linter.register_checker(MyRawChecker(linter))
|
| +
|
|
|