SERVER-100631 Add ruff into "bazel run lint" (#32166)

GitOrigin-RevId: 4234e1f4a6e164cfd2ab53cdb7290b238095520f
This commit is contained in:
Zack Winter 2025-06-11 06:42:13 -07:00 committed by MongoDB Bot
parent af5c17461a
commit 40f6d641f7
75 changed files with 653 additions and 15 deletions

3
.github/CODEOWNERS vendored
View File

@ -3051,5 +3051,8 @@ WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot
# The following patterns are parsed from ./src/third_party/libmongocrypt/OWNERS.yml # The following patterns are parsed from ./src/third_party/libmongocrypt/OWNERS.yml
/src/third_party/libmongocrypt/**/* @10gen/server-security @svc-auto-approve-bot /src/third_party/libmongocrypt/**/* @10gen/server-security @svc-auto-approve-bot
# The following patterns are parsed from ./tools/lint/OWNERS.yml
/tools/lint/**/* @10gen/devprod-build @svc-auto-approve-bot
# The following patterns are parsed from ./x509/OWNERS.yml # The following patterns are parsed from ./x509/OWNERS.yml
/x509/**/* @10gen/server-security @svc-auto-approve-bot /x509/**/* @10gen/server-security @svc-auto-approve-bot

View File

@ -129,6 +129,12 @@ single_version_override(
version = "6.4.0", version = "6.4.0",
) )
bazel_dep(name = "rules_multitool", version = "0.4.0")
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//tools/lint:multitool.lock.json")
use_repo(multitool, "multitool")
# TODO port over from WORKSPACE # TODO port over from WORKSPACE
# currently breaks pyright # currently breaks pyright
##node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True) ##node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)

View File

@ -11,3 +11,8 @@ sh_binary(
srcs = ["lint.sh"], srcs = ["lint.sh"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
py_binary(
name = "bazelisk",
srcs = ["bazelisk.py"],
)

View File

@ -0,0 +1,5 @@
py_binary(
name = "generate_coverity_command",
srcs = ["generate_coverity_command.py"],
visibility = ["//visibility:public"],
)

View File

@ -1,8 +1,15 @@
# placeholder for bazel/wrapper_hook/lint.py # placeholder for bazel/wrapper_hook/lint.py
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
if [[ $1 == "ALL_PASSING" ]]; then if [[ $1 == "ALL_PASSING" ]]; then
echo "No linter errors found!" echo -e "${GREEN}INFO:${NO_COLOR} No linter errors found!"
exit 0 exit 0
fi fi
echo "Linter run failed, see details above" echo -e "${RED}ERROR:${NO_COLOR} Linter run failed, see details above"
echo -e "${GREEN}INFO:${NO_COLOR} Run the following to try to auto-fix the errors:\n\nbazel run lint --fix"
exit 1 exit 1

View File

@ -146,3 +146,9 @@ platform(
":rhel9", ":rhel9",
], ],
) )
py_binary(
name = "remote_execution_containers_generator",
srcs = ["remote_execution_containers_generator.py"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,5 @@
py_binary(
name = "mongo_toolchain_version_generator",
srcs = ["mongo_toolchain_version_generator.py"],
visibility = ["//visibility:public"],
)

View File

@ -104,6 +104,10 @@ def list_files_without_targets(
new_list = [] new_list = []
for file in all_typed_files: for file in all_typed_files:
if file not in typed_files_in_targets_set and file not in exempt_list: if file not in typed_files_in_targets_set and file not in exempt_list:
if "bazel_rules_mongo" in file:
# Skip files in bazel_rules_mongo, since it has its own Bazel repo
continue
new_list.append(file) new_list.append(file)
if len(new_list) != 0: if len(new_list) != 0:
@ -139,6 +143,11 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool:
): ):
return False return False
if not list_files_without_targets(
files_with_targets, "python", "py", ["src/mongo", "buildscripts", "evergreen"]
):
return False
# Default to linting everything if no path was passed in # Default to linting everything if no path was passed in
if len([arg for arg in args if not arg.startswith("--")]) == 0: if len([arg for arg in args if not arg.startswith("--")]) == 0:
args = ["//..."] + args args = ["//..."] + args
@ -147,7 +156,8 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool:
with tempfile.NamedTemporaryFile(delete=False) as buildevents: with tempfile.NamedTemporaryFile(delete=False) as buildevents:
buildevents_path = buildevents.name buildevents_path = buildevents.name
args.append("--aspects=//tools/lint:linters.bzl%eslint") for linter in ["eslint", "ruff"]:
args.append(f"--aspects=//tools/lint:linters.bzl%{linter}")
args.extend( args.extend(
[ [
@ -210,11 +220,16 @@ def run_rules_lint(bazel_bin: str, args: List[str]) -> bool:
if "coverage.dat" in report or not os.path.exists(report) or not os.path.getsize(report): if "coverage.dat" in report or not os.path.exists(report) or not os.path.getsize(report):
# Report is empty. No linting errors. # Report is empty. No linting errors.
continue continue
failing_reports += 1
print(f"From {report}:")
with open(report, "r", encoding="utf-8") as f: with open(report, "r", encoding="utf-8") as f:
print(f.read()) file_contents = f.read().strip()
if file_contents == "All checks passed!":
# Report is successful. No linting errors.
continue
print(f"From {report}:")
print(file_contents)
print() print()
failing_reports += 1
# Apply fixes if requested # Apply fixes if requested
if fix: if fix:

View File

@ -251,3 +251,35 @@ sh_binary(
name = "setup_node_env", name = "setup_node_env",
srcs = ["setup_node_env.sh"], srcs = ["setup_node_env.sh"],
) )
py_binary(
name = "evergreen_task_timeout",
srcs = ["evergreen_task_timeout.py"],
main = "evergreen_task_timeout.py",
visibility = ["//visibility:public"],
deps = [
"//buildscripts/ciconfig",
"//buildscripts/resmoke_proxy",
"//buildscripts/timeouts:timeout_service",
"//evergreen:all_python_files",
dependency(
"evergreen-py",
group = "testing",
),
dependency(
"pydantic",
group = "evergreen",
),
dependency(
"inject",
group = "evergreen",
),
],
)
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency")
py_library( py_library(
name = "ciconfig", name = "ciconfig",
srcs = [ srcs = [
"__init__.py",
"evergreen.py", "evergreen.py",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -1,3 +1,5 @@
load("@poetry//:dependencies.bzl", "dependency")
filegroup( filegroup(
name = "idlc", name = "idlc",
srcs = [ srcs = [
@ -16,5 +18,65 @@ py_library(
] + glob(["idl/**/*.py"]), ] + glob(["idl/**/*.py"]),
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
dependency(
"typer",
group = "core",
),
], ],
) )
py_library(
name = "idl_compatibility_errors",
srcs = [
"idl_compatibility_errors.py",
],
visibility = ["//visibility:public"],
)
py_binary(
name = "idl_check_compatibility",
srcs = [
"idl_check_compatibility.py",
],
main = "idl_check_compatibility.py",
visibility = ["//visibility:public"],
deps = [
"idl_compatibility_errors",
],
)
py_binary(
name = "check_stable_api_commands_have_idl_definitions",
srcs = [
"check_stable_api_commands_have_idl_definitions.py",
],
main = "check_stable_api_commands_have_idl_definitions.py",
visibility = ["//visibility:public"],
)
py_binary(
name = "checkout_idl_files_from_past_releases",
srcs = [
"checkout_idl_files_from_past_releases.py",
],
main = "checkout_idl_files_from_past_releases.py",
visibility = ["//visibility:public"],
)
py_binary(
name = "gen_all_server_params_list",
srcs = [
"gen_all_server_params_list.py",
],
main = "gen_all_server_params_list.py",
visibility = ["//visibility:public"],
)
py_binary(
name = "run_tests",
srcs = [
"run_tests.py",
],
main = "run_tests.py",
visibility = ["//visibility:public"],
)

View File

@ -41,7 +41,6 @@ from pymongo import MongoClient
# Permit imports from "buildscripts". # Permit imports from "buildscripts".
sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), "../../.."))) sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), "../../..")))
from idl import syntax from idl import syntax
from buildscripts.idl.lib import list_idls, parse_idl from buildscripts.idl.lib import list_idls, parse_idl

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency")
py_library( py_library(
name = "linter", name = "linter",
srcs = [ srcs = [
"__init__.py",
"base.py", "base.py",
"filediff.py", "filediff.py",
"git.py", "git.py",

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -17,3 +17,10 @@ py_library(
), ),
], ],
) )
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,11 @@
py_binary(
name = "resmoke_proxy",
srcs = [
"__init__.py",
"resmoke_proxy.py",
],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
],
)

View File

@ -110,7 +110,7 @@ def in_spawn_host():
return False return False
if in_git_root_dir() and not in_spawn_host(): if (in_git_root_dir() or "BUILD_WORKSPACE_DIRECTORY" in os.environ) and not in_spawn_host():
generate_mongo_version_file() generate_mongo_version_file()
else: else:
LOGGER.info("Skipping generating mongo version file since we're not in the root of a git repo") LOGGER.info("Skipping generating mongo version file since we're not in the root of a git repo")

View File

@ -11,4 +11,11 @@ S3_SHA256_HASHES = {
"https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-amd64": "3305e287b3fcc68b9a35fd8515ee617452cd4e018f9e6886b6c7cdbcba8710d4", "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-amd64": "3305e287b3fcc68b9a35fd8515ee617452cd4e018f9e6886b6c7cdbcba8710d4",
"https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-arm64": "0b5a2a717ac4fc911e1fec8d92af71dbb4fe95b10e5213da0cc3d56cea64a328", "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-linux-arm64": "0b5a2a717ac4fc911e1fec8d92af71dbb4fe95b10e5213da0cc3d56cea64a328",
"https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-windows-amd64.exe": "58d41ce53257c5594c9bc86d769f580909269f68de114297f46284fbb9023dcf", "https://mdb-build-public.s3.amazonaws.com/buildozer/v7.3.1/buildozer-windows-amd64.exe": "58d41ce53257c5594c9bc86d769f580909269f68de114297f46284fbb9023dcf",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-apple-darwin.tar.gz": "b94562393a4bf23f1a48521f5495a8e48de885b7c173bd7ea8206d6d09921633",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-unknown-linux-musl.tar.gz": "73df3729a3381d0918e4640aac4b2653c542f74c7b7843dee8310e2c877e6f2e",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-powerpc64le-unknown-linux-gnu.tar.gz": "6eedb853553ee52309e9519af775b3359a12227ec342404b6a033308cdd48b1b",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-s390x-unknown-linux-gnu.tar.gz": "b4f93af861c1b3e1956df08e0d9f20b7e55cd7beb37c9df09b659908e920ebe6",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-apple-darwin.tar.gz": "34aa37643e30dcb81a3c0e011c3a8df552465ea7580ba92ca727a3b7c6de25d1",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-pc-windows-msvc.zip": "9d10e1282c5f695b2130cf593d55e37266513fc6d497edc4a30a6ed6d8ba4067",
"https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-unknown-linux-musl.tar.gz": "39a1cd878962ebc88322b4f6d33cae2292454563028f93a3f1f8ce58e3025b07",
} }

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -17,3 +17,10 @@ mongo_toolchain_py_cxx_test(
), ),
], ],
) )
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,11 @@
py_test(
name = "test_evergreen",
srcs = [
"__init__.py",
"test_evergreen.py",
],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/ciconfig",
],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,49 @@
load("@poetry//:dependencies.bzl", "dependency")
py_test(
name = "test_suites_configurations",
srcs = ["test_suites_configurations.py"],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
],
)
py_test(
name = "test_find_suites",
srcs = ["test_find_suites.py"],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
],
)
py_test(
name = "test_generated_matrix_suites",
srcs = ["test_generated_matrix_suites.py"],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
"//buildscripts/resmokelib/logging",
],
)
py_test(
name = "test_jstest_tags",
srcs = ["test_jstest_tags.py"],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/idl",
"//buildscripts/resmokelib",
],
)
py_test(
name = "test_matrix_suite_generation",
srcs = ["test_matrix_suite_generation.py"],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
"//buildscripts/resmokelib/logging",
],
)

View File

@ -1,5 +1,6 @@
import glob import glob
import json import json
import os
import unittest import unittest
from collections import defaultdict from collections import defaultdict
from typing import Optional from typing import Optional
@ -57,6 +58,7 @@ class RequiresFcvTagRule(JstestTagRule):
class TestJstestTags(unittest.TestCase): class TestJstestTags(unittest.TestCase):
def test_jstest_tags(self): def test_jstest_tags(self):
os.chdir(os.environ.get("BUILD_WORKSPACE_DIRECTORY", "."))
globs = ["src/mongo/db/modules/enterprise/jstests/**/*.js", "jstests/**/*.js"] globs = ["src/mongo/db/modules/enterprise/jstests/**/*.js", "jstests/**/*.js"]
tag_rules = [ tag_rules = [

View File

@ -0,0 +1,5 @@
py_test(
name = "python_test",
srcs = ["python_test.py"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,12 @@
py_test(
name = "test_discovery",
srcs = [
"__init__.py",
"test_discovery.py",
],
visibility = ["//visibility:public"],
deps = [
"//buildscripts/resmokelib",
"//buildscripts/resmokelib/logging",
],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,5 @@
py_binary(
name = "test_sbom",
srcs = ["test_sbom.py"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,34 @@
load("@poetry//:dependencies.bzl", "dependency")
py_library(
name = "timeout",
srcs = ["timeout.py"],
visibility = ["//visibility:public"],
deps = [
dependency(
"shrub-py",
group = "testing",
),
],
)
py_library(
name = "timeout_service",
srcs = ["timeout_service.py"],
visibility = ["//visibility:public"],
deps = [
"timeout",
"//buildscripts/resmoke_proxy",
dependency(
"inject",
group = "evergreen",
),
],
)
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -3,6 +3,7 @@ load("@poetry//:dependencies.bzl", "dependency")
py_library( py_library(
name = "util", name = "util",
srcs = [ srcs = [
"__init__.py",
"buildozer_utils.py", "buildozer_utils.py",
"cedar_report.py", "cedar_report.py",
"cmdutils.py", "cmdutils.py",

View File

@ -560,3 +560,17 @@ sh_binary(
name = "write_mongo_binary_url_to_downstream_expansions", name = "write_mongo_binary_url_to_downstream_expansions",
srcs = ["write_mongo_binary_url_to_downstream_expansions.sh"], srcs = ["write_mongo_binary_url_to_downstream_expansions.sh"],
) )
py_binary(
name = "macos_notary",
srcs = ["macos_notary.py"],
main = "macos_notary.py",
visibility = ["//visibility:public"],
)
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -124,3 +124,10 @@ sh_binary(
name = "wiredtiger_develop_use", name = "wiredtiger_develop_use",
srcs = ["wiredtiger_develop_use.sh"], srcs = ["wiredtiger_develop_use.sh"],
) )
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -213,6 +213,9 @@ ignore = [
"F822", # undefined-export "F822", # undefined-export
] ]
[tool.ruff.lint.isort]
known-first-party = ["buildscripts", "buildscripts/idl", "evergreen"]
[tool.pyright] [tool.pyright]
include = [ include = [
"buildscripts", "buildscripts",

View File

@ -164,3 +164,8 @@ mongo_cc_benchmark(
"//src/mongo/db:service_context", "//src/mongo/db:service_context",
], ],
) )
py_binary(
name = "lock_gdb_test",
srcs = ["lock_gdb_test.py"],
)

View File

@ -92,3 +92,8 @@ mongo_cc_unit_test(
":unicode", ":unicode",
], ],
) )
py_binary(
name = "gen_diacritic_map",
srcs = ["gen_diacritic_map.py"],
)

View File

@ -0,0 +1,16 @@
package(default_visibility = ["//visibility:public"])
py_library(
name = "utils",
srcs = ["utils.py"],
)
py_binary(
name = "extract_failed_test_to_pickle",
srcs = ["extract_failed_test_to_pickle.py"],
)
py_binary(
name = "extract_pickle_to_json",
srcs = ["extract_pickle_to_json.py"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,17 @@
py_binary(
name = "overwrite_results",
srcs = [
"overwrite_results.py",
],
main = "overwrite_results.py",
visibility = ["//visibility:public"],
)
py_binary(
name = "setup_repro_env",
srcs = [
"setup_repro_env.py",
],
main = "setup_repro_env.py",
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,6 @@
# TODO(SERVER-105817): The following library is autogenerated, please split these out into individual python targets
py_library(
name = "all_python_files",
srcs = glob(["*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -55,3 +55,8 @@ mongo_cc_binary(
"//src/mongo/db/query/stage_builder/sbe:abt_unit_test_utils", "//src/mongo/db/query/stage_builder/sbe:abt_unit_test_utils",
], ],
) )
py_binary(
name = "optimizer_gdb_test",
srcs = ["optimizer_gdb_test.py"],
)

View File

@ -75,3 +75,9 @@ mongo_cc_unit_test(
"//src/mongo/unittest", "//src/mongo/unittest",
], ],
) )
py_binary(
name = "process_logs",
srcs = ["process_logs.py"],
visibility = ["//visibility:public"],
)

View File

@ -1275,3 +1275,9 @@ mongo_cc_library(
"packaged_task.h", "packaged_task.h",
], ],
) )
py_binary(
name = "pretty_printer_test",
srcs = ["pretty_printer_test.py"],
visibility = ["//visibility:public"],
)

View File

@ -62,12 +62,6 @@ config_setting(
flag_values = {":with_cxx_stdlib": "best"}, flag_values = {":with_cxx_stdlib": "best"},
) )
bool_flag(
name = "with_abseil",
build_setting_default = False,
deprecation = "The value of this flag is ignored. Bazel builds always depend on Abseil for its pre-adopted `std::` types. You should remove this flag from your build command.",
)
int_flag( int_flag(
name = "abi_version_no", name = "abi_version_no",
build_setting_default = 1, build_setting_default = 1,

5
tools/lint/OWNERS.yml Normal file
View File

@ -0,0 +1,5 @@
version: 1.0.0
filters:
- "*":
approvers:
- 10gen/devprod-build

View File

@ -2,6 +2,7 @@
load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect") load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect")
load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test") load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")
load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect")
eslint = lint_eslint_aspect( eslint = lint_eslint_aspect(
binary = Label("@//tools/lint:eslint"), binary = Label("@//tools/lint:eslint"),
@ -11,3 +12,10 @@ eslint = lint_eslint_aspect(
) )
eslint_test = lint_test(aspect = eslint) eslint_test = lint_test(aspect = eslint)
ruff = lint_ruff_aspect(
binary = "@multitool//tools/ruff",
configs = [
Label("//:pyproject.toml"),
],
)

View File

@ -0,0 +1,39 @@
{
"$schema": "https://raw.githubusercontent.com/theoremlp/rules_multitool/main/lockfile.schema.json",
"ruff": {
"binaries": [
{
"kind": "archive",
"url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-unknown-linux-musl.tar.gz",
"file": "ruff-aarch64-unknown-linux-musl/ruff",
"sha256": "73df3729a3381d0918e4640aac4b2653c542f74c7b7843dee8310e2c877e6f2e",
"os": "linux",
"cpu": "arm64"
},
{
"kind": "archive",
"url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-unknown-linux-musl.tar.gz",
"file": "ruff-x86_64-unknown-linux-musl/ruff",
"sha256": "39a1cd878962ebc88322b4f6d33cae2292454563028f93a3f1f8ce58e3025b07",
"os": "linux",
"cpu": "x86_64"
},
{
"kind": "archive",
"url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-aarch64-apple-darwin.tar.gz",
"file": "ruff-aarch64-apple-darwin/ruff",
"sha256": "b94562393a4bf23f1a48521f5495a8e48de885b7c173bd7ea8206d6d09921633",
"os": "macos",
"cpu": "arm64"
},
{
"kind": "archive",
"url": "https://mdb-build-public.s3.amazonaws.com/ruff/0.6.9/ruff-x86_64-apple-darwin.tar.gz",
"file": "ruff-x86_64-apple-darwin/ruff",
"sha256": "34aa37643e30dcb81a3c0e011c3a8df552465ea7580ba92ca727a3b7c6de25d1",
"os": "macos",
"cpu": "x86_64"
}
]
}
}