Skip to content

Commit

Permalink
Add taplo for TOML tidying/linting
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed May 11, 2024
1 parent 750562b commit bcc64c6
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 24 deletions.
1 change: 0 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[default.extend-words]
ue = "ue"
dows = "dows"

15 changes: 13 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ itertools = "0.12.1"
log = "0.4.21"
platforms = "=3.2.0"
regex = "1.10.4"
reqwest = { version = "0.12.4", default-features = false, features = ["gzip", "json", "rustls-tls"] }
reqwest = { version = "0.12.4", default-features = false, features = [
"gzip",
"json",
"rustls-tls",
] }
result = "1.0.0"
serde = { version = "1.0.201", features = ["derive"] }
strum = { version = "0.26.2", features = ["derive"] }
Expand All @@ -30,7 +34,14 @@ url = { version = "2.5.0", features = ["serde"] }
xz = "0.1.0"
# This disables all the features that require C compilation, which greatly
# simplifies cross-platform builds.
zip = { version = "1.2.2", default-features = false, features = [ "aes-crypto", "bzip2", "deflate", "deflate64", "lzma", "zstd" ] }
zip = { version = "1.2.2", default-features = false, features = [
"aes-crypto",
"bzip2",
"deflate",
"deflate64",
"lzma",
"zstd",
] }

[workspace.metadata.release]
allow-branch = ["master"]
Expand Down
4 changes: 1 addition & 3 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
[build.env]
passthrough = [
"GITHUB_TOKEN",
]
passthrough = ["GITHUB_TOKEN"]
1 change: 1 addition & 0 deletions dev/bin/install-dev-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function install_tools() {
run "ubi --project koalaman/shellcheck --in ~/bin"
run "ubi --project mvdan/sh --in ~/bin --exe shfmt"
run "ubi --project crate-ci/typos --in ~/bin"
run "ubi --project tamasfe/taplo --tag 0.8.1 --in ~/bin"
run "npm install prettier@2.7.1"
}

Expand Down
50 changes: 32 additions & 18 deletions precious.toml
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
exclude = [
"target",
]
exclude = ["target"]

[commands.rustfmt]
type = "both"
type = "both"
include = "**/*.rs"
cmd = [ "rustfmt", "--edition", "2021" ]
cmd = ["rustfmt", "--edition", "2021"]
lint_flags = "--check"
ok_exit_codes = [0]
lint_failure_exit_codes = [1]

[commands.clippy]
type = "lint"
include = "**/*.rs"
invoke = "once"
path-args = "none"
type = "lint"
include = "**/*.rs"
invoke = "once"
path-args = "none"
working-dir = "root"
cmd = [ "cargo", "clippy", "--locked", "--all-targets", "--all-features", "--", "-D", "clippy::all" ]
cmd = ["cargo", "clippy", "--locked", "--all-targets", "--all-features", "--", "-D", "clippy::all"]
ok_exit_codes = 0
lint_failure_exit_codes = 101
expect_stderr = true

[commands.omegasort-gitignore]
type = "both"
include = "**/.gitignore"
cmd = [ "omegasort", "--sort=path" ]
cmd = ["omegasort", "--sort=path"]
lint_flags = "--check"
tidy_flags = "--in-place"
ok_exit_codes = 0
lint_failure_exit_codes = 1
expect_stderr = true

[commands.prettier]
type = "both"
include = [ "**/*.md", "**/*.yml" ]
cmd = [ "./node_modules/.bin/prettier", "--no-config", "--prose-wrap", "always", "--print-width", "100" ]
type = "both"
include = ["**/*.md", "**/*.yml"]
cmd = [
"./node_modules/.bin/prettier",
"--no-config",
"--prose-wrap",
"always",
"--print-width",
"100",
]
lint_flags = "--check"
tidy_flags = "--write"
ok_exit_codes = 0
lint_failure_exit_codes = 1
ignore_stderr = [ "Code style issues" ]
ignore_stderr = "Code style issues"

[commands.shellcheck]
type = "lint"
type = "lint"
include = "**/*.sh"
cmd = "shellcheck"
cmd = "shellcheck"
ok_exit_codes = 0
lint_failure_exit_codes = 1

[commands.shfmt]
type = "both"
include = "**/*.sh"
cmd = [ "shfmt", "--simplify", "--indent", "4" ]
cmd = ["shfmt", "--simplify", "--indent", "4"]
lint_flags = "--diff"
tidy_flags = "--write"
ok_exit_codes = 0
Expand All @@ -65,3 +70,12 @@ cmd = "typos"
invoke = "once"
ok-exit-codes = 0
lint-failure-exit-codes = 2

[commands.taplo]
include = "**/*.toml"
cmd = ["taplo", "format", "--option", "indent_string= ", "--option", "column_width=100"]
lint_failure_exit_codes = 1
lint_flags = "--check"
ok_exit_codes = 0
type = "both"
ignore_stderr = "INFO taplo.+"

0 comments on commit bcc64c6

Please sign in to comment.