News for hackers. Stuff that matters.
Re:Don’t underestimate grep-based code scanning by felipeerias on Wednesday August 07, 2019 @10:52AM (#20635246)
Related to this, it is generally a very good idea to be strict when naming functions, parameters, variables, etc. so that each concept has exactly one name throughout the codebase.
Re:Don’t underestimate grep-based code scanning by polytomous_ on Wednesday August 07, 2019 @11:02AM (#20635338)
Also, check your spelling. It's a pain when items don't show up in search because of spelling issues.

I've seen function names misspelled, and then every invocation just doubling down on that misspelling.

Re:Don’t underestimate grep-based code scanning by yakubin on Wednesday August 07, 2019 @11:52AM (#20635836)
I encountered a similar problem in a c++ codebase and the debugging logs it produced. There was an error which was being reported in the logs as "weak ptr expired" or somethings like that. I grepped for it the whole source code (a gigantic project). No results. Going back and forth several times. Feeling stupid beyond imagination. Then I copy-pasted what was actually printed in the logs into my grep query (previously I was typing it in manually). It quickly found a match. Turns out someone wrote "weak ptr" as "week ptr". Everyone in the team had a good laugh.
Re:Don’t underestimate grep-based code scanning by jandrese on Wednesday August 07, 2019 @03:49PM (#20638188)
And it turns out the pointer expired on sunday morning, except in some regions where it expired on some other day.
Re:Don’t underestimate grep-based code scanning by splittingTimes on Wednesday August 07, 2019 @03:06PM (#20637816)
But how do you effectively orhanize/enforce this for a code base of several million LOC where geographically distributed teams are working on different ends of the system all the time?

The amount of cross team coordination is staggering.

Re:Don’t underestimate grep-based code scanning by peterstensmyr on Wednesday August 07, 2019 @06:09PM (#20639691)
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.
Re:Don’t underestimate grep-based code scanning by splittingTimes on Thursday August 08, 2019 @12:07AM (#20641767)
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. :/

Re:Don’t underestimate grep-based code scanning by peterstensmyr on Thursday August 08, 2019 @07:47PM (#20650096)
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 by paulddraper on Wednesday August 07, 2019 @03:29PM (#20638024)
Documentation, I think.
Re:Don’t underestimate grep-based code scanning by xamuel on Wednesday August 07, 2019 @02:40PM (#20637577)
Also, please think twice before using OO classes as a license to give all your methods useless names like "get", "add", "open", etc.!