diff --git a/src/com/google/javascript/jscomp/CompilerOptions.java b/src/com/google/javascript/jscomp/CompilerOptions.java
index 272f414862e..c0cc93a1050 100644
--- a/src/com/google/javascript/jscomp/CompilerOptions.java
+++ b/src/com/google/javascript/jscomp/CompilerOptions.java
@@ -1191,7 +1191,16 @@ public boolean getAssumeGettersArePure() {
*
You can use this to make absolute paths relative to the root of your source tree. This is
* useful to work around CI and build systems that use absolute paths.
*/
- Pattern conformanceRemoveRegexFromPath = Pattern.compile(".*?google3/");
+ private Optional conformanceRemoveRegexFromPath =
+ Optional.of(Pattern.compile("^((.*/)?google3/)?((^/)?(blaze|bazel)-out/[^/]+/bin/)?"));
+
+ public void setConformanceRemoveRegexFromPath(Optional pattern) {
+ conformanceRemoveRegexFromPath = pattern;
+ }
+
+ public Optional getConformanceRemoveRegexFromPath() {
+ return conformanceRemoveRegexFromPath;
+ }
/** For use in {@link CompilationLevel#WHITESPACE_ONLY} mode, when using goog.module. */
boolean wrapGoogModulesForWhitespaceOnly = true;
diff --git a/src/com/google/javascript/jscomp/ConformanceRules.java b/src/com/google/javascript/jscomp/ConformanceRules.java
index 405fb30184e..f7a9c1a3cc3 100644
--- a/src/com/google/javascript/jscomp/ConformanceRules.java
+++ b/src/com/google/javascript/jscomp/ConformanceRules.java
@@ -250,7 +250,11 @@ protected abstract ConformanceResult checkConformance(
/** Returns the first Whitelist entry that matches the given path, and null otherwise. */
@Nullable
private Whitelist findWhitelistForPath(String path) {
- path = compiler.getOptions().conformanceRemoveRegexFromPath.matcher(path).replaceFirst("");
+ Optional pathRegex = compiler.getOptions().getConformanceRemoveRegexFromPath();
+ if (pathRegex.isPresent()) {
+ path = pathRegex.get().matcher(path).replaceFirst("");
+ }
+
for (Whitelist whitelist : whitelists) {
if (whitelist.matches(path)) {
return whitelist;