doctor: extract helper from stray file checks