diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-02-17 01:09:04 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-02-17 01:09:04 +0200 |
commit | d00adfbdc7b77280f6a7c97e39cb882b853da1d8 (patch) | |
tree | 26722500b372c31cda2f8e49701fe5735171684b /examples/custom_raw.py | |
parent | fe36ec0486cfc9aba10d8d87b0f42077ad1e78db (diff) | |
parent | 1dc09ef472a1bc0ca312c7cd8a1a3c700b510b47 (diff) | |
download | pylint-d00adfbdc7b77280f6a7c97e39cb882b853da1d8.tar.gz |
The HTML output accepts the `--msg-template` option.
Patch by Daniel Goldsmith. Closes issue #135.
Diffstat (limited to 'examples/custom_raw.py')
-rw-r--r-- | examples/custom_raw.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/custom_raw.py b/examples/custom_raw.py index 00fbe89..30e90bf 100644 --- a/examples/custom_raw.py +++ b/examples/custom_raw.py @@ -10,6 +10,7 @@ class MyRawChecker(BaseChecker): 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.')), } @@ -18,11 +19,13 @@ class MyRawChecker(BaseChecker): def process_module(self, node): """process a module - the module's content is accessible via node.file_stream object + the module's content is accessible via node.stream() function """ - for (lineno, line) in enumerate(node.file_stream): - if line.rstrip().endswith('\\'): - self.add_message('W9901', line=lineno) + with module.stream() as stream: + for (lineno, line) in enumerate(stream): + if line.rstrip().endswith('\\'): + self.add_message('backslash-line-continuation', + line=lineno) def register(linter): |