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

Unified Diff: Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom.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.py
diff --git a/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom.py b/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e4d5e76b1ba1afea4219a86aa67916075fa8705
--- /dev/null
+++ b/Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom.py
@@ -0,0 +1,36 @@
+from logilab import astng
+
+from pylint.interfaces import IASTNGChecker
+from pylint.checkers import BaseChecker
+
+class MyASTNGChecker(BaseChecker):
+ """add member attributes defined using my own "properties" function
+ to the class locals dictionary
+ """
+
+ __implements__ = IASTNGChecker
+
+ name = 'custom'
+ msgs = {}
+ options = ()
+ # this is important so that your checker is executed before others
+ priority = -1
+
+ def visit_callfunc(self, node):
+ """called when a CallFunc node is encountered.
+
+ See logilab.astng for the description of available nodes."""
+ if not (isinstance(node.func, astng.Getattr)
+ and isinstance(node.func.expr, astng.Name)
+ and node.func.expr.name == 'properties'
+ and node.func.attrname == 'create'):
+ return
+ in_class = node.frame()
+ for param in node.args:
+ in_class.locals[param.name] = node
+
+
+def register(linter):
+ """required method to auto register this checker"""
+ linter.register_checker(MyASTNGChecker(linter))
+
« no previous file with comments | « Tools/Scripts/webkitpy/thirdparty/pylint/epylint.py ('k') | Tools/Scripts/webkitpy/thirdparty/pylint/examples/custom_raw.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698