Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run plz fmt -w on master #2865

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ go_test(
srcs = ["docs_test.go"],
data = ["//docs"],
deps = [
"//src/core",
"///third_party/go/golang.org_x_net//html",
"///third_party/go/github.com_stretchr_testify//assert",
"///third_party/go/github.com_stretchr_testify//require",
"///third_party/go/golang.org_x_net//html",
"//src/core",
],
)

Expand Down
2 changes: 1 addition & 1 deletion docs/tools/lexicon_templater/rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ go_library(
name = "rules",
srcs = ["rules.go"],
visibility = ["//docs/..."],
)
)
8 changes: 4 additions & 4 deletions docs/tools/plugin_config_tool/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
go_binary(
name = "plugin_config_tool",
srcs = ["plugin_config_tool.go"],
visibility = ["//docs/..."],
deps = [
"///third_party/go/github.com_peterebden_go-cli-init_v5//flags",
"///third_party/go/github.com_please-build_gcfg//:gcfg",
"//src/core",
"//docs/tools/lexicon_templater/rules:rules",
"//docs/tools/lexicon_templater/rules",
"//docs/tools/plugin_config_tool/plugin",
"//src/core",
],
visibility = ["//docs/..."],
)
)
6 changes: 3 additions & 3 deletions docs/tools/plugin_config_tool/plugin/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
go_library(
name = "plugin",
srcs = ["plugin.go"],
deps = ["//docs/tools/lexicon_templater/rules:rules"],
visibility = ["//docs/..."]
)
visibility = ["//docs/..."],
deps = ["//docs/tools/lexicon_templater/rules"],
)
6 changes: 3 additions & 3 deletions docs/tools/plugin_templater/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ go_binary(
deps = [
"///third_party/go/github.com_peterebden_go-cli-init_v5//flags",
"//docs/tools/lexicon_templater/rules",
"//docs/tools/plugin_config_tool/plugin:plugin",
]
)
"//docs/tools/plugin_config_tool/plugin",
],
)
1 change: 0 additions & 1 deletion docs/tools/templater/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ go_binary(
srcs = ["template.go"],
visibility = ["//docs/..."],
deps = ["///third_party/go/github.com_peterebden_go-cli-init_v5//flags"],

)
2 changes: 1 addition & 1 deletion test/build_defs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ filegroup(
name = "build_defs",
srcs = ["test.build_defs"],
visibility = [
"//test/...",
"//src/test/...",
"//test/...",
],
)

Expand Down
2 changes: 1 addition & 1 deletion test/entry_point/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ def e2e_test(name, expected_output, plz_command):
name = name,
expected_output = expected_output,
plz_command = plz_command.replace("plz ", "plz -o plugin.go.gotool:$TOOLS_GO "),
repo = "test_repo",
tools = {
"go": [CONFIG.GO.GO_TOOL],
},
repo = "test_repo",
)

e2e_test(
Expand Down
42 changes: 29 additions & 13 deletions test/get_outs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,45 @@ gr_getouts = genrule(
fg_getouts = filegroup(
name = "filegroup_getouts",
srcs = {
"wibble": [text_file(name = 'wibble_file2', content = 'wibblewibblewibble')],
"wobble": [text_file(name = 'wobble_file2', content = 'wobblewobblewobble')],
"wibble": [text_file(
name = "wibble_file2",
content = "wibblewibblewibble",
)],
"wobble": [text_file(
name = "wobble_file2",
content = "wobblewobblewobble",
)],
},
)

def assert_dict(l1, l2):
if l1 != l2:
fail(f"{l1} != {l2}")

assert_dict({}, get_named_outs(nonamedouts))
assert_dict(
{},
get_named_outs(nonamedouts),
)

assert_dict(
{
"wibble": ["wibble_file1"],
"wobble": ["wobble_file1"],
},
get_named_outs(gr_getouts),
)

assert_dict({
"wibble": ["wibble_file1"],
"wobble": ["wobble_file1"],
}, get_named_outs(gr_getouts))
assert_dict(
{
"wibble": ["//test/get_outs:wibble_file2"],
"wobble": ["//test/get_outs:wobble_file2"],
},
get_named_outs(fg_getouts),
)

assert_dict({
"wibble": ["//test/get_outs:wibble_file2"],
"wobble": ["//test/get_outs:wobble_file2"],
}, get_named_outs(fg_getouts))
gr_subtargets = {k: [f"{gr_getouts}|{k}"] for k, _ in get_named_outs(gr_getouts).items()}

gr_subtargets = { k: [f'{gr_getouts}|{k}'] for k, _ in get_named_outs(gr_getouts).items() }
fg_subtargets = { k: [f'{fg_getouts}|{k}'] for k, _ in get_named_outs(fg_getouts).items() }
fg_subtargets = {k: [f"{fg_getouts}|{k}"] for k, _ in get_named_outs(fg_getouts).items()}

gentest(
name = "get_outs_gr_wibble_test",
Expand Down
5 changes: 2 additions & 3 deletions test/plugins/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ genrule(
cmd = "mv $SRCS_PLUGIN foo_plugin && mv $SRCS_TOOL foo_plugin/tools && tar -czf $OUT foo_plugin",
)

def plugin_e2e_test(name, plz_command, expected_output = None, expected_failure = False, expect_output_contains = None):
def plugin_e2e_test(name, plz_command, expected_output=None, expected_failure=False, expect_output_contains=None):
return please_repo_e2e_test(
name = name,
data = {
Expand Down Expand Up @@ -119,11 +119,10 @@ please_repo_e2e_test(
repo = "self_referencing_plugin",
)


plugin_e2e_test(
name = "arch_test",
expected_output = {
"plz-out/gen/foo_bar66/fooc.txt": "bar66",
},
plz_command = "plz build -o plugin.foo.modulepath:something --arch foo_bar66 //:output_fooc",
)
)
79 changes: 58 additions & 21 deletions test/pytype/BUILD
Original file line number Diff line number Diff line change
@@ -1,45 +1,82 @@


v_none = None

v_bool = False

v_int = 5
v_str = 'hello'
v_list = [0, 1, 2]

v_str = "hello"

v_list = [
0,
1,
2,
]

v_dict = {
'a': 0,
'b': 1,
"a": 0,
"b": 1,
}

def func1():
fail('func1 should not be executed')
fail("func1 should not be executed")

lambda1 = lambda: fail('lambda1 should not be executed')
lambda1 = lambda: fail("lambda1 should not be executed")

all_type = [
None, bool, int, str, list, dict, callable,
None,
bool,
int,
str,
list,
dict,
callable,
]

matrix = [
[v_none, None],
[v_bool, bool],
[v_int, int],
[v_str, str],
[v_list, list],
[v_dict, dict],
[func1, callable],
[lambda1, callable],
[
v_none,
None,
],
[
v_bool,
bool,
],
[
v_int,
int,
],
[
v_str,
str,
],
[
v_list,
list,
],
[
v_dict,
dict,
],
[
func1,
callable,
],
[
lambda1,
callable,
],
]

for ty in matrix:
v = ty[0]
realtype = ty[1]
istypes = { str(t): isinstance(v, t) for t in all_type }
istypes = {str(t): isinstance(v, t) for t in all_type}

realtypestr = str(realtype)
for typestr, istype in istypes.items():
if typestr == realtypestr and not istype:
fail(f'{v} should be of type {typestr} -> {istypes}')
elif realtype == bool and typestr == "<function int>": # special bool case which is also int
fail(f"{v} should be of type {typestr} -> {istypes}")
elif realtype == bool and typestr == "<function int>": # special bool case which is also int
continue
elif typestr != realtypestr and istype:
fail(f'{v} should not be of type {typestr} -> {istypes}')
fail(f"{v} should not be of type {typestr} -> {istypes}")
2 changes: 1 addition & 1 deletion test/revdeps/require_provide/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
subinclude("//test/build_defs")

def provider(name, deps = []):
def provider(name, deps=[]):
# This is the rule that actually gets depended on after resolving the require/provide setup
go = build_rule(
name = name,
Expand Down
2 changes: 1 addition & 1 deletion test/text_file/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ text_file(

text_file(
name = "multilines_file",
strip = True,
content = """
This is a multi lines file,
use strip option to remove first empty newline
and all empty spaces on the left of the text.
""",
strip = True,
)

text_file(
Expand Down
10 changes: 5 additions & 5 deletions third_party/go/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package(default_visibility = ["PUBLIC"])
go_toolchain(
name = "toolchain",
hashes = [
"79715ca5b8becd120703ac9af5d1da749e095d2b9bf830c4f3af4b15b2cb049d", # darwin-amd64
"94ad76b7e1593bb59df7fd35a738194643d6eed26a4181c94e3ee91381e40459", # darwin-arm64
"eda6cf7495c95fc3f57d3a62cb63d321269198e1a6960563a1d894ed767b1301", # freebsd-amd64
"d7ec48cde0d3d2be2c69203bc3e0a44de8660b9c09a6e85c4732a3f7dc442612", # linux-amd64
"aa2fab0a7da20213ff975fa7876a66d47b48351558d98851b87d1cfef4360d09", # linux-arm64
"79715ca5b8becd120703ac9af5d1da749e095d2b9bf830c4f3af4b15b2cb049d", # darwin-amd64
"94ad76b7e1593bb59df7fd35a738194643d6eed26a4181c94e3ee91381e40459", # darwin-arm64
"eda6cf7495c95fc3f57d3a62cb63d321269198e1a6960563a1d894ed767b1301", # freebsd-amd64
"d7ec48cde0d3d2be2c69203bc3e0a44de8660b9c09a6e85c4732a3f7dc442612", # linux-amd64
"aa2fab0a7da20213ff975fa7876a66d47b48351558d98851b87d1cfef4360d09", # linux-arm64
],
install_std = True,
version = "1.20.5",
Expand Down
2 changes: 1 addition & 1 deletion tools/build_langserver/lsp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ go_library(
],
visibility = ["//tools/build_langserver/..."],
deps = [
"///third_party/go/github.com_bazelbuild_buildtools//build",
"///third_party/go/github.com_sourcegraph_go-lsp//:go-lsp",
"///third_party/go/github.com_sourcegraph_jsonrpc2//:jsonrpc2",
"///third_party/go/gopkg.in_op_go-logging.v1//:go-logging.v1",
"///third_party/go/github.com_bazelbuild_buildtools//build",
"//rules",
"//src/core",
"//src/parse/asp",
Expand Down
4 changes: 2 additions & 2 deletions tools/sandbox/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ c_library(
c_binary(
name = "please_sandbox",
srcs = ["main.c"],
static = (CONFIG.get("STATIC_SANDBOX") is not None),
static = ((CONFIG.get("STATIC_SANDBOX") is not None)),
visibility = ["PUBLIC"],
deps = [":sandbox"],
)

c_binary(
name = "nonet_sandbox",
srcs = ["nonet_main.c"],
static = (CONFIG.get("STATIC_SANDBOX") is not None),
static = ((CONFIG.get("STATIC_SANDBOX") is not None)),
visibility = ["PUBLIC"],
deps = [":sandbox"],
)
Expand Down