diff --git a/WARNINGS.md b/WARNINGS.md
index 9bbc414ec..0d523a689 100644
--- a/WARNINGS.md
+++ b/WARNINGS.md
@@ -94,6 +94,7 @@ Warning categories supported by buildifier's linter:
* [`repository-name`](#repository-name)
* [`return-value`](#return-value)
* [`rule-impl-return`](#rule-impl-return)
+ * [`rule-load-location`](#rule-load-location)
* [`same-origin-load`](#same-origin-load)
* [`skylark-comment`](#skylark-comment)
* [`skylark-docstring`](#skylark-docstring)
@@ -1271,6 +1272,26 @@ consider using
[providers](https://docs.bazel.build/versions/main/skylark/rules.html#providers)
or lists of providers instead.
+--------------------------------------------------------------------------------
+
+## Rule must be loaded from a specific location
+
+ * Category name: `rule-load-location`
+ * Automatic fix: no
+ * [Suppress the warning](#suppress): `# buildifier: disable=rule-load-location`
+
+Warns when a rule is loaded from a location other than the expected one.
+Expected locations are specified in the tables file:
+
+```json
+{
+ "RuleLoadLocation": {
+ "genrule": "//tools/bazel:genrule.bzl"
+ }
+}
+```
+
+
--------------------------------------------------------------------------------
## Same label is used for multiple loads
diff --git a/buildifier/config/config_test.go b/buildifier/config/config_test.go
index 7554385e5..b2de02bf5 100644
--- a/buildifier/config/config_test.go
+++ b/buildifier/config/config_test.go
@@ -132,6 +132,7 @@ func ExampleExample() {
// "repository-name",
// "return-value",
// "rule-impl-return",
+ // "rule-load-location",
// "skylark-comment",
// "skylark-docstring",
// "string-iteration",
@@ -350,6 +351,7 @@ func TestValidate(t *testing.T) {
"repository-name",
"return-value",
"rule-impl-return",
+ "rule-load-location",
"skylark-comment",
"skylark-docstring",
"string-iteration",
@@ -449,6 +451,7 @@ func TestValidate(t *testing.T) {
"repository-name",
"return-value",
"rule-impl-return",
+ "rule-load-location",
"skylark-comment",
"skylark-docstring",
"string-iteration",
@@ -548,7 +551,7 @@ func TestValidate(t *testing.T) {
"repository-name",
"return-value",
"rule-impl-return",
-
+ "rule-load-location",
"skylark-comment",
"skylark-docstring",
"string-iteration",
diff --git a/buildifier/integration_test.sh b/buildifier/integration_test.sh
index e22e8b4bf..af51b56cb 100755
--- a/buildifier/integration_test.sh
+++ b/buildifier/integration_test.sh
@@ -337,6 +337,7 @@ cat > golden/.buildifier.example.json <