Skip to content

Commit a94376c

Browse files
committed
Add formatter
1 parent ff704b8 commit a94376c

File tree

6 files changed

+74
-12
lines changed

6 files changed

+74
-12
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# Bazel
22
bazel-*
33
MODULE.bazel.lock
4+
5+
# Ruff
6+
.ruff_cache

BUILD

+20-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ platform(
2121
visibility = ["//visibility:public"],
2222
)
2323

24+
test_suite(
25+
name = "format.check",
26+
tests = ["//tools/format:format.check"],
27+
)
28+
29+
alias(
30+
name = "format.fix",
31+
actual = "//tools/format:format.fix",
32+
)
33+
2434
copyright_checker(
2535
name = "copyright",
2636
srcs = [
@@ -33,8 +43,17 @@ copyright_checker(
3343
] + glob([
3444
"*.bzl",
3545
]),
46+
config = "@score_cr_checker//resources:config",
3647
offset = 24,
3748
template = "@score_cr_checker//resources:templates",
38-
config = "@score_cr_checker//resources:config",
3949
visibility = ["//visibility:public"],
4050
)
51+
52+
exports_files(
53+
[
54+
"MODULE.bazel",
55+
],
56+
visibility = [
57+
"//tools/format:__pkg__",
58+
],
59+
)

MODULE.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ module(
1616
compatibility_level = 0,
1717
)
1818

19+
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")
20+
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
1921
bazel_dep(name = "platforms", version = "0.0.11")
2022
bazel_dep(name = "score_cr_checker", version = "0.2.0")

tests/MODULE.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ local_path_override(
2525
toolchain_qcc = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchain_qcc")
2626
toolchain_qcc.sdp(
2727
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
28-
url = "https://www.qnx.com/download/download/79858/installation.tgz",
2928
strip_prefix = "installation",
29+
url = "https://www.qnx.com/download/download/79858/installation.tgz",
3030
)
3131
use_repo(toolchain_qcc, "toolchain_qcc_sdp")
3232
use_repo(toolchain_qcc, "toolchain_qcc")

tools/format/BUILD

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2024 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("@aspect_rules_lint//format:defs.bzl", "format_multirun", "format_test")
15+
16+
format_multirun(
17+
name = "format.fix",
18+
python = "@aspect_rules_lint//format:ruff",
19+
starlark = "@buildifier_prebuilt//:buildifier",
20+
visibility = [
21+
"//visibility:public",
22+
],
23+
yaml = "@aspect_rules_lint//format:yamlfmt",
24+
)
25+
26+
format_test(
27+
name = "format.check",
28+
no_sandbox = True,
29+
python = "@aspect_rules_lint//format:ruff",
30+
starlark = "@buildifier_prebuilt//:buildifier",
31+
visibility = [
32+
"//visibility:public",
33+
],
34+
workspace = "//:MODULE.bazel",
35+
yaml = "@aspect_rules_lint//format:yamlfmt",
36+
)

tools/qnx_credential_helper.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ def eprint(*args, **kwargs):
4949
eprint("Failed getting credentials from .netrc")
5050
sys.exit(1)
5151

52-
data = urllib.parse.urlencode({
53-
"userlogin": login,
54-
"password": password,
55-
"UseCookie": "1"
56-
})
52+
data = urllib.parse.urlencode(
53+
{"userlogin": login, "password": password, "UseCookie": "1"}
54+
)
5755
data = data.encode("ascii")
5856

5957
cookie_jar = http.cookiejar.CookieJar()
@@ -72,8 +70,12 @@ def eprint(*args, **kwargs):
7270
sys.exit(1)
7371

7472
myQNX = cookies["myQNX"]
75-
print(json.dumps({
76-
"headers": {
77-
"Cookie": [f"myQNX={myQNX}"],
78-
}
79-
}))
73+
print(
74+
json.dumps(
75+
{
76+
"headers": {
77+
"Cookie": [f"myQNX={myQNX}"],
78+
}
79+
}
80+
)
81+
)

0 commit comments

Comments
 (0)