Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2301)

Unified Diff: Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py

Issue 18418010: Check in the thirdparty libs needed for webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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))
+

Powered by Google App Engine
This is Rietveld 408576698