Where is Homebrew's doctor.rb? I need to change some configuration for the brew doctor tool and by surfing the web I learned that this can be done by editing the doctor.rb file and adding some custom code inside it.

The problem is that when I run

locate doctor.rb


I get an output like this:

/Applications/Xcode.app/Contents/Developer/[...]/ruby/2.3.0/rubygems/doctor.rb
/Library/Developer/CommandLineTools/SDKs/[...]/ruby/2.3.0/rubygems/doctor.rb
/System/Library/Frameworks/[...]/2.0/usr/lib/ruby/2.0.0/rubygems/doctor.rb
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/doctor.rb
/usr/local/Homebrew/Library/Homebrew/cmd/doctor.rb
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/[...]/doctor.rb


So, which doctor.rb file should I edit to customize the configuration?
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.