Why do we need to search source-code?
1. Quickly learn the domain and context of the application
2. After adding a feature, we should aware if we broke anything (assume you work with code that doesn't have test-case), it helps even to search testcases
3. Find similar code and ensure you are improving quality of the overall similar code (not just fixing current bug)
4. Understand how application behaves when there are production issues.
Most often I deal with large inherited code-base in my career, often we need to search similar code or usage of certain variable or a function/class/module. When it is statically typed language to certain extent IDE/compiler helps. But we have to deal with different languages and sometime developers copy/paste for various reason. Searching/grepping code and its usage seems to be very useful for various reasons.
You as a developer, what are all the ways you search source-code before working/fixing feature or bug? Do you use any CLI tools other than grep. I have used OpenGrok, But few times it is not maintained by me or other developers.
Below is my steps.
1. Read the relevant code, and know certain domain keyword, variable names (inclusive class/method/function)
2. Use the bitbucket/GitHub/git search
3. Use the grep
4. Use the git-grep
Still few times, I end up missing.
Seems like this is (Especially CLI based search) very valuable skill to have. Do you have any tips/tools for other developers?
Septum is neighborhood based (context-based) search, so you can find contiguous groups of lines which contain specific things, but exclude other things. It's also interactive so you can add/remove filters as needed. This makes it useful for those cases where terms change based on their context so you can exclude terms related to the contexts you don't want to keep. It reads .septum/config which contains its normal commands to load directories and settings, so you can have different configs per project you're working on.