Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find long try-catch instances in the code (not super bulletproof but kinda works)
$ find . -name '*.js' -exec awk -v gap=15 '/try/ {inside=1; diff=0; next} inside{diff++} /catch/ && inside && (diff>=gap) {print diff,"L",NR-diff,FILENAME; inside=0;}' {} \;
32 L 405 ./core/JsObject.js
26 L 482 ./jsunit/TestCase.js // false match!
39 L 20 ./node.js
52 L 129 ./templates/ModuleCtrlFactory.js
62 L 193 ./templates/ModuleCtrlFactory.js
21 L 268 ./templates/ModuleCtrlFactory.js
22 L 194 ./templates/TemplateCtxt.js
39 L 1426 ./utils/SynEvents.js
16 L 63 ./widgetLibs/WidgetLib.js
17 L 94 ./widgetLibs/WidgetLib.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment