# Format
# | task          | type      | cwd |
# | ------------  | --------- | --- |
# | fmt           | composite |     |
# | fmt-check     | composite |     |
# | fmt-rust      | script    |     |
# | fmt-rust-check| extend    |     |

[tasks.fmt]
workspace = false
dependencies = ["fmt-rust"]

[tasks.fmt-check]
workspace = false
dependencies = ["fmt-rust-check"]

[tasks.fmt-rust]
workspace = false
script = "cargo +nightly fmt ${FMT_RUST_ARGS}"
env = { FMT_RUST_ARGS = "" }

[tasks.fmt-rust-check]
workspace = false
extend = "fmt-rust"
env = { FMT_RUST_ARGS = "-- --check" }


# Lint
# | task     | type    | cwd |
# | ----     | ------- | --- |
# | lint     | command |     |
# | lint-fix | command |     |

[tasks.lint]
workspace = false
command = "cargo"
args = [
	"clippy",
	"--all-targets",
	"--all-features",
	"--",
	"-D",
	"warnings"
]

[tasks.lint-fix]
workspace = false
command = "cargo"
args = [
	"clippy",
	"--fix",
	"--allow-dirty",
	"--all-targets",
	"--all-features"
]


# Test
# | task       | type    | cwd |
# | ---------- | ------- | --- |
# | test       | command |     |
# | test-redis | command |     |

[tasks.test]
workspace = false
command = "cargo"
args = ["test"]

[tasks.test-redis]
workspace = false
command = "cargo"
args = [
	"test",
	"--features",
	"redis"
]


# Meta
# | task   | type      | cwd |
# | ------ | --------- | --- |
# | checks | composite |     |

[tasks.checks]
workspace = false
dependencies = [
	"fmt-check",
	"lint",
	"test"
]
