Who says anything about regex? The linting (in the broad sense of the word) can look at which packages are changed. How many interfaces are affected by the change. Of course, that is not a metric of relatedness yet. We need more research in this area what it means to have “good” code if we ever want to rise from programming being an art.