1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

maint/build ~ improve cargo make format to include test formatting

This commit is contained in:
Roy Ivy III 2020-05-02 00:12:29 -05:00
parent 969964aade
commit f16e2261fc

View file

@ -113,6 +113,8 @@ description = "Format"
category = "[project]" category = "[project]"
dependencies = [ dependencies = [
"action-format", "action-format",
"action-determine-tests",
"action-format-tests",
] ]
[tasks.help] [tasks.help]
@ -230,15 +232,34 @@ set_env CARGO_MAKE_TASK_BUILD_UTILS_ARGS "${package_options}"
''' '''
] ]
[tasks.action-determine-tests]
script_runner = "@duckscript"
script = [
'''
test_files = glob_array tests/**/*.rs
for file in ${test_files}
if is_empty "${tests}"
tests = set "${file}"
else
tests = set "${tests} ${file}"
end_if
end
set_env CARGO_MAKE_VAR_TESTS "${tests}"
'''
]
[tasks.action-format] [tasks.action-format]
description = "`cargo fmt`" description = "`cargo fmt`"
command = "cargo" command = "cargo"
args = ["fmt"] args = ["fmt"]
[tasks.action-fmt] [tasks.action-format-tests]
description = "`cargo fmt`" description = "`cargo fmt` tests"
command = "cargo" command = "cargo"
args = ["fmt"] args = ["fmt", "--", "@@split(CARGO_MAKE_VAR_TESTS, )"]
[tasks.action-fmt]
alias = "action-format"
[tasks.action-fmt_report] [tasks.action-fmt_report]
description = "`cargo fmt` lint report" description = "`cargo fmt` lint report"