Skip to content

Commit cf317ed

Browse files
redsun82Copilot
andcommitted
Just: modernize justfiles for just 1.48.1
Use f-strings instead of `+` concatenation, remove `set unstable` (all previously unstable features are now stable), and add `[parallel]` to swift `extra-tests` recipe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b4dac99 commit cf317ed

File tree

15 files changed

+38
-29
lines changed

15 files changed

+38
-29
lines changed

cpp/ql/test/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import "../justfile"
22

33
base_flags := "--include-location-in-star"
44

5-
all_checks := default_db_checks + """\
5+
all_checks := f"""\
6+
{{default_db_checks}}\
67
--check-undefined-labels \
78
--check-unused-labels \
8-
--consistency-queries=""" + consistency_queries
9+
--consistency-queries={{consistency_queries}}"""
910

1011
[no-cd]
1112
test *ARGS=".": (_codeql_test "cpp" base_flags all_checks ARGS)

csharp/ql/test/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import "../justfile"
22

33
base_flags := ""
44

5-
all_checks := default_db_checks + """\
5+
all_checks := f"""\
6+
{{default_db_checks}}\
67
--check-undefined-labels \
78
--check-repeated-labels \
89
--check-redefined-labels \
910
--additional-packs=ql \
10-
--consistency-queries=""" + consistency_queries
11+
--consistency-queries={{consistency_queries}}"""
1112

1213
[no-cd]
1314
test *ARGS=".": (_codeql_test "csharp" base_flags all_checks ARGS)

go/ql/test/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import "../justfile"
22

33
base_flags := ""
44

5-
all_checks := default_db_checks + """\
5+
all_checks := f"""\
6+
{{default_db_checks}}\
67
--check-undefined-labels \
78
--check-unused-labels \
89
--check-repeated-labels \
910
--check-redefined-labels \
1011
--check-use-before-definition \
11-
--consistency-queries=""" + consistency_queries
12+
--consistency-queries={{consistency_queries}}"""
1213

1314
[no-cd]
1415
test *ARGS=".": (_codeql_test "go" base_flags all_checks ARGS)

java/ql/test-kotlin1/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ base_flags := """\
44
CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT= \
55
"""
66

7-
all_checks := default_db_checks + """\
7+
all_checks := f"""\
8+
{{default_db_checks}}\
89
--check-undefined-labels \
910
--check-repeated-labels \
1011
--check-redefined-labels \
1112
--check-use-before-definition \
12-
--consistency-queries=""" + consistency_queries
13+
--consistency-queries={{consistency_queries}}"""
1314

1415
[no-cd]
1516
test *ARGS=".": (_codeql_test "java" base_flags all_checks ARGS)

java/ql/test-kotlin2/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ base_flags := """\
55
CODEQL_KOTLIN_LEGACY_TEST_EXTRACTION_KOTLIN2=true \
66
"""
77

8-
all_checks := default_db_checks + """\
8+
all_checks := f"""\
9+
{{default_db_checks}}\
910
--check-undefined-labels \
1011
--check-repeated-labels \
1112
--check-redefined-labels \
1213
--check-use-before-definition \
13-
--consistency-queries=""" + consistency_queries
14+
--consistency-queries={{consistency_queries}}"""
1415

1516
[no-cd]
1617
test *ARGS=".": (_codeql_test "java" base_flags all_checks ARGS)

java/ql/test/justfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ base_flags := """\
44
CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT="\\ " \
55
"""
66

7-
all_checks := default_db_checks + """\
7+
all_checks := f"""\
8+
{{default_db_checks}}\
89
--check-undefined-labels \
910
--check-repeated-labels \
1011
--check-redefined-labels \
1112
--check-use-before-definition \
12-
--consistency-queries=""" + consistency_queries
13+
--consistency-queries={{consistency_queries}}"""
1314

1415
[no-cd]
1516
test *ARGS=".": (_codeql_test "java" base_flags all_checks ARGS)

misc/just/build.just

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _build_dist LANGUAGE: _require_semmle_code (_maybe_build_dist LANGUAGE)
88
# Build the language-specific distribution if we are in an internal repository checkout
99
# Otherwise, do nothing
1010
[no-exit-message]
11-
_maybe_build_dist LANGUAGE: (_if_in_semmle_code ('cd "$SEMMLE_CODE"; tools/bazel test //language-packs:intree-' + LANGUAGE + '-as-test --test_output=all') '# using codeql from PATH, if any')
11+
_maybe_build_dist LANGUAGE: (_if_in_semmle_code (f'cd "$SEMMLE_CODE"; tools/bazel test //language-packs:intree-{{LANGUAGE}}-as-test --test_output=all') '# using codeql from PATH, if any')
1212

1313
# Call bazel. Uses our official bazel wrapper if we are in an internal repository checkout
1414
[no-cd, no-exit-message]

misc/just/defs.just

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import 'semmle-code-stub.just'
44
set fallback
55
set allow-duplicate-recipes
66
set allow-duplicate-variables
7-
set unstable
87

98
export PATH_SEP := if os() == "windows" { ";" } else { ":" }
109
export JUST_EXECUTABLE := just_executable()
1110

12-
error := style("error") + "error" + NORMAL + ": "
11+
error := f'{{style("error")}}error{{NORMAL}}: '
1312
cmd_sep := "\n#--------------------------------------------------------\n"
1413
export CMD_BEGIN := style("command") + cmd_sep
1514
export CMD_END := cmd_sep + NORMAL
@@ -25,8 +24,8 @@ default_db_checks := """\
2524

2625
[no-exit-message]
2726
@_require_semmle_code:
28-
{{ if SEMMLE_CODE == "" { '''
29-
echo "''' + error + ''' running this recipe requires doing so from an internal repository checkout" >&2
27+
{{ if SEMMLE_CODE == "" { f'''
28+
echo "{error} running this recipe requires doing so from an internal repository checkout" >&2
3029
exit 1
3130
''' } else { "" } }}
3231

misc/just/format.just

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ _format_ql +ARGS: (_maybe_build_dist "nolang") (
55
_if_in_semmle_code
66
'"$SEMMLE_CODE/target/intree/codeql-nolang/codeql"'
77
'codeql'
8-
("query format --in-place -v $(find " + ARGS + " -type f -name '*.ql' -or -name '*.qll')")
8+
(f"query format --in-place -v $(find {{ARGS}} -type f -name '*.ql' -or -name '*.qll')")
99
)
1010

1111
[no-cd, no-exit-message]
@@ -16,5 +16,5 @@ _format_cpp *ARGS=".": (
1616
_if_in_semmle_code
1717
"uv run clang-format"
1818
"clang-format"
19-
"-i --verbose $(find " + ARGS + " -type f -name '*.h' -or -name '*.cpp')"
19+
(f"-i --verbose $(find {{ARGS}} -type f -name '*.h' -or -name '*.cpp')")
2020
)

misc/just/forward.just

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "lib.just"
77
# copy&paste necessary for each command until proper forwarding of multiple args is implemented
88
# see https://github.com/casey/just/issues/1988
99

10-
_forward := py + ' "' + source_dir() + '/forward_command.py"'
10+
_forward := f'{{py}} "{{source_dir()}}/forward_command.py"'
1111

1212
alias t := test
1313
alias b := build

0 commit comments

Comments
 (0)