Skip to content

Commit 69feeb4

Browse files
authored
Merge pull request #138 from influxdata/crepererum/lint-toml
chore: lint TOML
2 parents 1e4a59a + 4e417e0 commit 69feeb4

File tree

11 files changed

+125
-86
lines changed

11 files changed

+125
-86
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
with:
2929
tool: cargo-deny,just
3030

31+
- name: Install `tombi`
32+
uses: tombi-toml/setup-tombi@a9378ac9fe5c29df7d26263deacea4ac642af9c2 # v1
33+
3134
- name: Install stable toolchain
3235
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master
3336
with:

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Install [just] to easily run all the tests/scripts.
2525
### Python
2626
Install [Python] to set up the environment for the [Python] guest.
2727

28+
### Tombi
29+
Install [tombi] to format and lint [TOML] files.
30+
2831

2932
## Checks
3033
There is one "run everything" [just] recipe:
@@ -107,4 +110,6 @@ Then the [Python Standard Library] was not found or not bundled correctly. You m
107110
[Python Standard Library]: https://docs.python.org/3/library/index.html
108111
[Rust]: https://www.rust-lang.org/
109112
[rustup]: https://rustup.rs/
113+
[tombi]: https://tombi-toml.github.io/tombi
114+
[TOML]: https://toml.io/
110115
[yamllint]: https://github.com/adrienverge/yamllint

Cargo.toml

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1+
[workspace]
2+
resolver = "3"
3+
members = [
4+
"arrow2bytes",
5+
"guests/bundle",
6+
"guests/python",
7+
"guests/rust",
8+
"host",
9+
]
10+
111
[workspace.package]
212
version = "0.1.0"
3-
authors = ["IOx Project Developers"]
413
edition = "2024"
514
license = "MIT OR Apache-2.0"
615

7-
[workspace]
8-
members = [
9-
"arrow2bytes",
10-
"guests/bundle",
11-
"guests/python",
12-
"guests/rust",
13-
"host",
14-
]
15-
resolver = "3"
16-
1716
[workspace.dependencies]
1817
anyhow = { version = "1.0.100", default-features = false }
1918
arrow = { version = "55.2.0", default-features = false, features = ["ipc"] }
@@ -26,28 +25,29 @@ datafusion-udf-wasm-arrow2bytes = { path = "arrow2bytes", version = "0.1.0" }
2625
datafusion-udf-wasm-bundle = { path = "guests/bundle", version = "0.1.0" }
2726
datafusion-udf-wasm-guest = { path = "guests/rust", version = "0.1.0" }
2827
datafusion-udf-wasm-python = { path = "guests/python", version = "0.1.0" }
29-
sqlparser = { version = "0.55.0", default-features = false, features = ["std", "visitor"] }
3028
http = { version = "1.3.1", default-features = false }
3129
hyper = { version = "1.7", default-features = false }
32-
tokio = { version = "1.48.0", default-features = false }
3330
pyo3 = { version = "0.27.1", default-features = false, features = ["macros"] }
31+
sqlparser = { version = "0.55.0", default-features = false, features = [
32+
"std",
33+
"visitor"
34+
] }
3435
tar = { version = "0.4.44", default-features = false }
3536
tempfile = { version = "3.23.0", default-features = false }
37+
tokio = { version = "1.48.0", default-features = false }
3638
wasip2 = { version = "1" }
37-
wasmtime = { version = "38.0.3", default-features = false, features = ["async", "cranelift"] }
39+
wasmtime = { version = "38.0.3", default-features = false, features = [
40+
"async",
41+
"cranelift"
42+
] }
3843
wasmtime-wasi = { version = "38.0.3", default-features = false }
39-
wasmtime-wasi-http = { version = "38.0.3", default-features = false, features = ["default-send-request"] }
44+
wasmtime-wasi-http = { version = "38.0.3", default-features = false, features = [
45+
"default-send-request"
46+
] }
4047
wasmtime-wasi-io = { version = "38.0.3", default-features = false }
41-
wit-bindgen = { version = "0.47", default-features = false, features = ["macros"] }
42-
43-
[workspace.lints.rust]
44-
missing_copy_implementations = "deny"
45-
missing_debug_implementations = "deny"
46-
missing_docs = "deny"
47-
rust_2018_idioms = { level = "deny", priority = -1 }
48-
unexpected_cfgs = "deny"
49-
unreachable_pub = "deny"
50-
unused_crate_dependencies = "deny"
48+
wit-bindgen = { version = "0.47", default-features = false, features = [
49+
"macros"
50+
] }
5151

5252
[workspace.lints.clippy]
5353
allow_attributes = "warn"
@@ -60,6 +60,15 @@ todo = "deny"
6060
undocumented_unsafe_blocks = "deny"
6161
use_self = "deny"
6262

63+
[workspace.lints.rust]
64+
missing_copy_implementations = "deny"
65+
missing_debug_implementations = "deny"
66+
missing_docs = "deny"
67+
rust_2018_idioms = { level = "deny", priority = -1 }
68+
unexpected_cfgs = "deny"
69+
unreachable_pub = "deny"
70+
unused_crate_dependencies = "deny"
71+
6372
[workspace.lints.rustdoc]
6473
bare_urls = "deny"
6574
broken_intra_doc_links = "deny"
@@ -79,10 +88,9 @@ datafusion-sql = { git = "https://github.com/influxdata/arrow-datafusion.git", r
7988
cranelift-codegen.opt-level = 3
8089
cranelift-entity.opt-level = 3
8190
cranelift-frontend.opt-level = 3
82-
regalloc2.opt-level = 3
83-
wasmparser.opt-level = 3
84-
wasmtime-internal-cranelift.opt-level = 3
85-
8691
# faster insta snapshots
8792
insta.opt-level = 3
93+
regalloc2.opt-level = 3
8894
similar.opt-level = 3
95+
wasmparser.opt-level = 3
96+
wasmtime-internal-cranelift.opt-level = 3

Justfile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,29 @@ check-rust-deny:
5252
# run ALL Rust checks
5353
check-rust: check-rust-fmt check-rust-check check-rust-build check-rust-clippy check-rust-test check-rust-doc check-rust-bench check-rust-deny
5454

55+
# check TOML formatting
56+
check-toml-fmt:
57+
@echo ::group::check-toml-fmt
58+
tombi format --check
59+
@echo ::endgroup::
60+
61+
# lint TOML files with taplo
62+
check-toml-lint:
63+
@echo ::group::check-toml-lint
64+
tombi lint
65+
@echo ::endgroup::
66+
67+
# check TOML files
68+
check-toml: check-toml-fmt check-toml-lint
69+
5570
# lint YAML files
5671
check-yaml:
5772
@echo ::group::check-yaml
5873
yamllint -s .
5974
@echo ::endgroup::
6075

6176
# run ALL checks
62-
check: check-rust check-yaml
77+
check: check-rust check-toml check-yaml
6378

6479
# clean Rust build artifacts
6580
clean-rust:
@@ -91,5 +106,14 @@ fix-rust-fmt:
91106
# fix common Rust issues automatically
92107
fix-rust: fix-rust-clippy fix-rust-check fix-rust-fmt
93108

109+
# fix TOML formatting
110+
fix-toml-fmt:
111+
@echo ::group::fix-toml-fmt
112+
tombi format
113+
@echo ::endgroup::
114+
115+
# fix common TOML issues
116+
fix-toml: fix-toml-fmt
117+
94118
# fix common issues automatically
95-
fix: fix-rust
119+
fix: fix-rust fix-toml

arrow2bytes/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[package]
22
name = "datafusion-udf-wasm-arrow2bytes"
33
version.workspace = true
4-
authors.workspace = true
54
edition.workspace = true
65
license.workspace = true
76

8-
[lints]
9-
workspace = true
10-
117
[dependencies]
128
arrow.workspace = true
9+
10+
[lints]
11+
workspace = true

deny.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,49 @@
55
version = 2
66
yanked = "deny"
77
ignore = [
8-
# paste is unmaintained but does not have any known issues;
9-
# there is no replacement at this time
10-
"RUSTSEC-2024-0436",
8+
# paste is unmaintained but does not have any known issues;
9+
# there is no replacement at this time
10+
"RUSTSEC-2024-0436",
1111
]
1212
git-fetch-with-cli = true
1313

1414
[licenses]
1515
unused-allowed-license = "deny"
1616
allow = [
17-
"Apache-2.0",
18-
"Apache-2.0 WITH LLVM-exception",
19-
"BSD-2-Clause",
20-
"BSD-3-Clause",
21-
"CC0-1.0",
22-
"CDLA-Permissive-2.0",
23-
"ISC",
24-
"MIT",
25-
"Unicode-3.0",
26-
"Zlib",
17+
"Apache-2.0",
18+
"Apache-2.0 WITH LLVM-exception",
19+
"BSD-2-Clause",
20+
"BSD-3-Clause",
21+
"CC0-1.0",
22+
"CDLA-Permissive-2.0",
23+
"ISC",
24+
"MIT",
25+
"Unicode-3.0",
26+
"Zlib",
2727
]
2828

2929
[[licenses.clarify]]
3030
name = "ring"
3131
expression = "BSD-4-Clause AND ISC AND MIT AND OpenSSL"
3232
license-files = [
33-
# https://github.com/briansmith/ring/blob/95948b3977013aed16db92ae32e6b8384496a740/LICENSE
34-
{ path = "LICENSE", hash = 0xbd0eed23 },
33+
# https://github.com/briansmith/ring/blob/95948b3977013aed16db92ae32e6b8384496a740/LICENSE
34+
{ path = "LICENSE", hash = 0xbd0eed23 },
3535
]
3636

3737
[bans]
3838
multiple-versions = "allow"
3939
wildcards = "deny"
4040
allow-wildcard-paths = true
4141
deny = [
42-
# We are using rustls as the TLS implementation, so we shouldn't be linking
43-
# in OpenSSL too.
44-
#
45-
# If you're hitting this, you might want to take a look at what new
46-
# dependencies you have introduced and check if there's a way to depend on
47-
# rustls instead of OpenSSL (tip: check the crate's feature flags).
48-
{ name = "openssl-sys" },
49-
# Use stdlib ( https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html )
50-
{ name = "atty" },
42+
# We are using rustls as the TLS implementation, so we shouldn't be linking
43+
# in OpenSSL too.
44+
#
45+
# If you're hitting this, you might want to take a look at what new
46+
# dependencies you have introduced and check if there's a way to depend on
47+
# rustls instead of OpenSSL (tip: check the crate's feature flags).
48+
{ name = "openssl-sys" },
49+
# Use stdlib ( https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html )
50+
{ name = "atty" },
5151
]
5252

5353
[sources]
@@ -57,5 +57,5 @@ unused-allowed-source = "deny"
5757

5858
[sources.allow-org]
5959
github = [
60-
"influxdata",
60+
"influxdata",
6161
]

guests/bundle/Cargo.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
[package]
22
name = "datafusion-udf-wasm-bundle"
33
version.workspace = true
4-
authors.workspace = true
54
edition.workspace = true
65
license.workspace = true
76

8-
[lints]
9-
workspace = true
10-
11-
[features]
12-
example = ["dep:datafusion-udf-wasm-guest"]
13-
python = ["dep:datafusion-udf-wasm-python"]
14-
157
[build-dependencies]
168
# these need to be marked as build dependencies so the build script reruns whenever they change
179
datafusion-udf-wasm-guest = { workspace = true, optional = true }
1810
datafusion-udf-wasm-python = { workspace = true, optional = true }
19-
2011
# the actual build-time dependencies
2112
serde_json = "1.0.145"
13+
14+
[features]
15+
example = ["dep:datafusion-udf-wasm-guest"]
16+
python = ["dep:datafusion-udf-wasm-python"]
17+
18+
[lints]
19+
workspace = true

guests/python/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[package]
22
name = "datafusion-udf-wasm-python"
33
version.workspace = true
4-
authors.workspace = true
54
edition.workspace = true
65
license.workspace = true
76

8-
[lints]
9-
workspace = true
10-
117
[lib]
128
crate-type = ["cdylib"]
139

@@ -23,3 +19,6 @@ wasip2.workspace = true
2319
[build-dependencies]
2420
tar.workspace = true
2521
walkdir = "2.5.0"
22+
23+
[lints]
24+
workspace = true

guests/rust/Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "datafusion-udf-wasm-guest"
33
version.workspace = true
4-
authors.workspace = true
54
edition.workspace = true
65
license.workspace = true
76

8-
[lints]
9-
workspace = true
7+
[[example]]
8+
crate-type = ["cdylib"]
9+
name = "add_one"
1010

1111
[dependencies]
1212
arrow.workspace = true
@@ -15,6 +15,5 @@ datafusion-expr.workspace = true
1515
datafusion-udf-wasm-arrow2bytes.workspace = true
1616
wit-bindgen.workspace = true
1717

18-
[[example]]
19-
name = "add_one"
20-
crate-type = ["cdylib"]
18+
[lints]
19+
workspace = true

host/Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
11
[package]
22
name = "datafusion-udf-wasm-host"
33
version.workspace = true
4-
authors.workspace = true
54
edition.workspace = true
65
license.workspace = true
76

8-
[lints]
9-
workspace = true
10-
117
[dependencies]
128
anyhow.workspace = true
139
arrow.workspace = true
1410
datafusion.workspace = true
1511
datafusion-common.workspace = true
1612
datafusion-expr.workspace = true
17-
datafusion-udf-wasm-arrow2bytes.workspace = true
1813
datafusion-sql.workspace = true
19-
sqlparser.workspace = true
14+
datafusion-udf-wasm-arrow2bytes.workspace = true
2015
http.workspace = true
2116
hyper.workspace = true
2217
rand = { version = "0.9" }
2318
siphasher = { version = "1", default-features = false }
19+
sqlparser.workspace = true
2420
tar.workspace = true
2521
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "sync"] }
2622
wasmtime.workspace = true
@@ -29,7 +25,13 @@ wasmtime-wasi-http.workspace = true
2925
wasmtime-wasi-io.workspace = true
3026

3127
[dev-dependencies]
32-
datafusion-udf-wasm-bundle = { workspace = true, features = ["example", "python"] }
28+
datafusion-udf-wasm-bundle = { workspace = true, features = [
29+
"example",
30+
"python"
31+
] }
3332
insta = "1.43.2"
3433
tokio = { workspace = true, features = ["fs", "macros"] }
3534
wiremock = "0.6.5"
35+
36+
[lints]
37+
workspace = true

0 commit comments

Comments
 (0)