5 ms·
My only complaint about print debugging is the sheer volume of commented out console.log statements I see across code bases. Or worse, not commented out and hap
by wkirby 2y ago
My only complaint about print debugging is the sheer volume of commented out console.log statements I see across code bases. Or worse, not commented out and happily logging away on prod. Seriously, leave your console open as you browse around — you’ll be astounded by the amount of debug output just rolling along on production.
Delete your debug cruft!
- stitched2gethr 2y agoI have a perfect solution for this, that works for me at least. Adding a `..` to the end of a variable triggers a macro that changes `val` into something like `print("val:", val) // FIXME: REMOVE`. Then a pre-commit hook makes sure I am unable to commit lines matching this pattern.
- deleted 2y ago[deleted]
- johnisgood 2y agoThat could work, but there is a problem with this approach (the last part of it): Not all projects use git, but the ones that do: It is possible to set up a global pre-commit hook in git, but it requires some manual configuration because git does not natively support global hooks out of the box. By default, hooks are local to each repository and reside in the .git/hooks directory. You could do: git config --global core.hooksPath ~/.git-hooks But... setting `core.hooksPath` overrides the use of local hooks in .git/hooks. At least you can combine global and local hooks by modifying your global hook scripts to manually invoke the local hooks.
- never_inline 2y agoThere's a python tool called `pre-commit` which may be helpful. Its used very much in python ecosystem.