Live data from Hacker News

Don’t underestimate grep-based code scanning

littlemaninmyhead.wordpress.com

121–122 of 122 posts

Re: Don’t underestimate grep-based code scanning

#121

Earlier quoted context omitted.

Fail verification in CI if the change doesn’t pass your checks. You can check anything, such as whether it has a duplicate name already in the codebase.

I would be interested to know, which CI tool can check "that each concept has exactly one name throughout the codebase." I thought code reviews are the only way and then you need to have every Dev aligned and on the same page on this topic... Which never happens. :/

It wouldn’t be something provided by the CI tool, you’d have to write the test yourself. At the end of the day it’s just another test, albeit a more complex one than a standard unit test.

Re: Don’t underestimate grep-based code scanning

#122
post #68
post #52

Don't use grep. Use ag[0], which is specifically designed for searching code. It's much faster, honors .gitignore, and the output can be piped back through grep if you like. ag FooBar | grep -v Baz It's in brew/apt/yum etc as `the_silver_searcher` (although brew install ag works fine too). 0: https://github.com/ggreer/the_silver_searcher

I find `git grep` to be quite sufficient. A real pain when trying to look through code that isn't in git though.

you can just add `--no-index` to search in non-git repositories
Post reply on HN