It can with a proper regex. Mostly. Depending on the language, your patience, and the amount of false positives you are comfortable with.
I did sth like that (I had bash scripts for common programming "refactorings" and "queries" like "print all classes and methods where this variable is used"). I couldn't use a modern IDE cause we were programming on a legacy linux server through ssh for licencing reasons.
And the (C++) code was written by a guy that learnt C++ and OOP on the job and it showed. Class hierarchies were sometimes 8 levels deep and class variables were reused for different purposes to "save effort on serializing them" :)
So if the user interactions were in the same order and with the same text prompts - a class would inherit them and add some new ones. Even if the old class was just accidentally asking the user similar questions :) So OR_PalNr could mean shelf number in base class and Printer number in descendant, because both times the user was asked to "scan the barcode", while the callstack was a mix of methods from both classes :)
Fun times.
BTW nowadays I mostly work with IntelliJ, but sometimes a script is still the best way to understand the code. For example grepping the git blame output is often very useful. It's never 100% reliable, but it's often good enough.
> BTW nowadays I mostly work with IntelliJ, but sometimes a script is still the best way to understand the code. For example grepping the git blame output is often very useful. It's never 100% reliable, but it's often good enough.
I see we are on the same page : )
> It can with a proper regex. Mostly. Depending on the language, your patience, and the amount of false positives you are comfortable with.
For everyone else: in any of the three big Java IDEs, and in a number of other cases, you don't need much patience or tolerance for false positives, at least if your code isn't too unreasonable (with any sufficiently expressive language you can of course always fool it by somehow accessing things dynamically).
> I did sth like that (I had bash scripts for common programming "refactorings" and "queries" like "print all classes and methods where this variable is used"). I couldn't use a modern IDE cause we were programming on a legacy linux server through ssh for licencing reasons.
I did sth like that (I had bash scripts for common programming "refactorings" and "queries" like "print all classes and methods where this variable is used"). I couldn't use a modern IDE cause we were programming on a legacy linux server through ssh for licencing reasons.
And the (C++) code was written by a guy that learnt C++ and OOP on the job and it showed. Class hierarchies were sometimes 8 levels deep and class variables were reused for different purposes to "save effort on serializing them" :)
So if the user interactions were in the same order and with the same text prompts - a class would inherit them and add some new ones. Even if the old class was just accidentally asking the user similar questions :) So OR_PalNr could mean shelf number in base class and Printer number in descendant, because both times the user was asked to "scan the barcode", while the callstack was a mix of methods from both classes :)
Fun times.
BTW nowadays I mostly work with IntelliJ, but sometimes a script is still the best way to understand the code. For example grepping the git blame output is often very useful. It's never 100% reliable, but it's often good enough.