Skip to content

Commit

Permalink
Add missing repo boundary files (bazelbuild#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored and apattidb committed May 10, 2024
1 parent 6f49c9e commit 229b225
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions buildifier/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ test_dir/to_fix_tmp.bzl: applied fixes, 2 warnings left
fixed test_dir/to_fix_tmp.bzl
EOF

error_bzl="test_dir/to_fix_tmp.bzl:1: bzl-visibility: Module \"//foo/bar/internal/baz:module.bzl\" can only be loaded from files located inside \"//foo/bar\", not from \"//test_dir/to_fix_tmp.bzl\". (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#bzl-visibility)"
error_bzl="test_dir/to_fix_tmp.bzl:1: bzl-visibility: Module \"//foo/bar/internal/baz:module.bzl\" can only be loaded from files located inside \"//foo/bar\", not from \"//to_fix_tmp.bzl\". (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#bzl-visibility)"
error_docstring="test_dir/to_fix_tmp.bzl:1: module-docstring: The file has no module docstring."$'\n'"A module docstring is a string literal (not a comment) which should be the first statement of a file (it may follow comment lines). (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#module-docstring)"
error_integer="test_dir/to_fix_tmp.bzl:4: integer-division: The \"/\" operator for integer division is deprecated in favor of \"//\". (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#integer-division)"
error_dict="test_dir/to_fix_tmp.bzl:5: unsorted-dict-items: Dictionary items are out of their lexicographical order. (https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#unsorted-dict-items)"
Expand All @@ -394,7 +394,8 @@ test_lint () {
ret=0
cp test_dir/to_fix.bzl test_dir/to_fix_tmp.bzl
echo "$4" > golden/error_golden
echo "${4//test_dir/another_test_dir}" > golden/error_golden_another
with_replaced_dir="${4//test_dir/another_test_dir}"
echo "${with_replaced_dir//\/\/to_fix_tmp.bzl///another_test_dir/to_fix_tmp.bzl}" > golden/error_golden_another

cat > golden/fix_report_golden <<EOF
test_dir/to_fix_tmp.bzl: applied fixes, $5 warnings left
Expand Down Expand Up @@ -483,7 +484,7 @@ cat > golden/json_report_golden <<EOF
"category": "bzl-visibility",
"actionable": true,
"autoFixable": false,
"message": "Module \"//foo/bar/internal/baz:module.bzl\" can only be loaded from files located inside \"//foo/bar\", not from \"//test_dir/json/to_fix.bzl\".",
"message": "Module \"//foo/bar/internal/baz:module.bzl\" can only be loaded from files located inside \"//foo/bar\", not from \"//json/to_fix.bzl\".",
"url": "https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#bzl-visibility"
},
{
Expand Down
2 changes: 2 additions & 0 deletions wspace/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func isExecutable(fi os.FileInfo) bool {
var repoRootFiles = map[string]func(os.FileInfo) bool{
workspaceFile: isFile,
workspaceFile + ".bazel": isFile,
"MODULE.bazel": isFile,
"REPO.bazel": isFile,
".buckconfig": isFile,
"pants": isExecutable,
}
Expand Down

0 comments on commit 229b225

Please sign in to comment.