Skip to content
Snippets Groups Projects
Commit df5d3734 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

check-code: reject module-level @cachefunc

Module-level @cachefunc usage is risky because it can easily create a
memory "leak". Let's reject it completely for now. If a valid usage
comes up in the future, we can always improve the check or reconsider.
parent 86145461
No related branches found
No related tags found
No related merge requests found
...@@ -325,6 +325,7 @@ ...@@ -325,6 +325,7 @@
# XXX only catch mutable arguments on the first line of the definition # XXX only catch mutable arguments on the first line of the definition
(r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"), (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
(r'\butil\.Abort\b', "directly use error.Abort"), (r'\butil\.Abort\b', "directly use error.Abort"),
(r'^@(\w*\.)?cachefunc', "module-level @cachefunc is risky, please avoid"),
(r'^import Queue', "don't use Queue, use util.queue + util.empty"), (r'^import Queue', "don't use Queue, use util.queue + util.empty"),
(r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"), (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"),
(r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"), (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment