GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/python/ql/src/Classes/ShouldBeContextManager.ql at main · max2max4u/codeql Expand file tree/ Copy pathShouldBeContextManager.qlMore file actions 21 lines (19 loc) · 689 Bytes / Copy pathShouldBeContextManager.qlFile metadata and controls21 lines (19 loc) · 689 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 /** * @name Class should be a context manager * @description Making a class a context manager allows instances to be used in a 'with' statement. * This improves resource handling and code readability. * @kind problem * @tags maintainability * readability * convention * @problem.severity recommendation * @sub-severity high * @precision medium * @id py/should-be-context-manager */ import python from ClassValue c where not c.isBuiltin() and not c.isContextManager() and exists(c.declaredAttribute("__del__")) select c, "Class " + c.getName() + " implements __del__ (presumably to release some resource). Consider making it a context manager." |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |