Where is Homebrew's doctor.rb?
The file that you are looking to edit should be present in Homebrew installation directory, which generally is /usr/local/Homebrew.

From your shared locate output, the one matching the criterion is:

/usr/local/Homebrew/Library/Homebrew/cmd/doctor.rb.