Apache DataFusion SQL Query Engine
chore: use taplo to format Cargo.toml manifests (#9263)
Ruihang Xiacf92f3b01ff0
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.ymlindex 154ac9766e..f7acc896cb 100644--- a/.github/workflows/rust.yml+++ b/.github/workflows/rust.yml@@ -480,16 +480,11 @@ jobs:uses: ./.github/actions/setup-builderwith:rust-version: stable- - name: Install cargo-tomlfmt- run: which cargo-tomlfmt || cargo install cargo-tomlfmt-+ - name: Install taplo+ run: cargo +stable install taplo-cli --version ^0.9 --locked+ # if you encounter an error, try running 'taplo format' to fix the formatting automatically.- name: Check Cargo.toml formatting- run: |- # if you encounter an error, try running 'cargo tomlfmt -p path/to/Cargo.toml' to fix the formatting automatically.- # If the error still persists, you need to manually edit the Cargo.toml file, which introduces formatting violation.- #- # ignore ./Cargo.toml because putting workspaces in multi-line lists make it easy to read- ci/scripts/rust_toml_fmt.sh+ run: taplo format --checkconfig-docs-check:name: check configs.md is up-to-datediff --git a/Cargo.toml b/Cargo.tomlindex 31c0005d58..f79e1f2896 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -17,7 +17,26 @@[workspace]exclude = ["datafusion-cli"]-members = ["datafusion/common", "datafusion/core", "datafusion/expr", "datafusion/execution", "datafusion/functions", "datafusion/functions-array", "datafusion/optimizer", "datafusion/physical-expr", "datafusion/physical-plan", "datafusion/proto", "datafusion/proto/gen", "datafusion/sql", "datafusion/sqllogictest", "datafusion/substrait", "datafusion/wasmtest", "datafusion-examples", "docs", "test-utils", "benchmarks",+members = [+ "datafusion/common",+ "datafusion/core",+ "datafusion/expr",+ "datafusion/execution",+ "datafusion/functions",+ "datafusion/functions-array",+ "datafusion/optimizer",+ "datafusion/physical-expr",+ "datafusion/physical-plan",+ "datafusion/proto",+ "datafusion/proto/gen",+ "datafusion/sql",+ "datafusion/sqllogictest",+ "datafusion/substrait",+ "datafusion/wasmtest",+ "datafusion-examples",+ "docs",+ "test-utils",+ "benchmarks",]resolver = "2"diff --git a/ci/scripts/rust_toml_fmt.sh b/ci/scripts/rust_toml_fmt.shindex 0a8cc346a3..9204a562a3 100755--- a/ci/scripts/rust_toml_fmt.sh+++ b/ci/scripts/rust_toml_fmt.sh@@ -17,11 +17,9 @@# specific language governing permissions and limitations# under the License.-# Run cargo-tomlfmt with flag `-d` in dry run to check formatting+# Run `taplo format` with flag `--check` in dry run to check formatting# without overwritng the file. If any error occur, you may want to-# rerun 'cargo tomlfmt -p path/to/Cargo.toml' without '-d' to fix-# the formatting automatically.+# rerun `taplo format` to fix the formatting automatically.set -ex-for toml in $(find . -mindepth 2 -name 'Cargo.toml'); do- cargo tomlfmt -d -p $toml+taplo formatdonediff --git a/datafusion-cli/Cargo.toml b/datafusion-cli/Cargo.tomlindex 45e7b740bf..147e432950 100644--- a/datafusion-cli/Cargo.toml+++ b/datafusion-cli/Cargo.toml@@ -35,7 +35,15 @@ async-trait = "0.1.41"aws-config = "0.55"aws-credential-types = "0.55"clap = { version = "3", features = ["derive", "cargo"] }-datafusion = { path = "../datafusion/core", version = "36.0.0", features = ["avro", "crypto_expressions", "encoding_expressions", "parquet", "regex_expressions", "unicode_expressions", "compression"] }+datafusion = { path = "../datafusion/core", version = "36.0.0", features = [+ "avro",+ "crypto_expressions",+ "encoding_expressions",+ "parquet",+ "regex_expressions",+ "unicode_expressions",+ "compression",+] }datafusion-common = { path = "../datafusion/common" }dirs = "4.0.0"env_logger = "0.9"diff --git a/datafusion/core/Cargo.toml b/datafusion/core/Cargo.tomlindex 09718791d0..874e455132 100644--- a/datafusion/core/Cargo.toml+++ b/datafusion/core/Cargo.toml@@ -43,7 +43,15 @@ avro = ["apache-avro", "num-traits", "datafusion-common/avro"]backtrace = ["datafusion-common/backtrace"]compression = ["xz2", "bzip2", "flate2", "zstd", "async-compression", "tokio-util"]crypto_expressions = ["datafusion-physical-expr/crypto_expressions", "datafusion-optimizer/crypto_expressions"]-default = ["array_expressions", "crypto_expressions", "encoding_expressions", "regex_expressions", "unicode_expressions", "compression", "parquet"]+default = [+ "array_expressions",+ "crypto_expressions",+ "encoding_expressions",+ "regex_expressions",+ "unicode_expressions",+ "compression",+ "parquet",+]encoding_expressions = ["datafusion-functions/encoding_expressions"]# Used for testing ONLY: causes all values to hash to the same value (test for collisions)force_hash_collisions = []@@ -52,7 +60,11 @@ parquet = ["datafusion-common/parquet", "dep:parquet"]pyarrow = ["datafusion-common/pyarrow", "parquet"]regex_expressions = ["datafusion-physical-expr/regex_expressions", "datafusion-optimizer/regex_expressions"]serde = ["arrow-schema/serde"]-unicode_expressions = ["datafusion-physical-expr/unicode_expressions", "datafusion-optimizer/unicode_expressions", "datafusion-sql/unicode_expressions"]+unicode_expressions = [+ "datafusion-physical-expr/unicode_expressions",+ "datafusion-optimizer/unicode_expressions",+ "datafusion-sql/unicode_expressions",+][dependencies]ahash = { version = "0.8", default-features = false, features = ["runtime-rng"] }@@ -61,7 +73,14 @@ arrow = { workspace = true }arrow-array = { workspace = true }arrow-ipc = { workspace = true }arrow-schema = { workspace = true }-async-compression = { version = "0.4.0", features = ["bzip2", "gzip", "xz", "zstd", "futures-io", "tokio"], optional = true }+async-compression = { version = "0.4.0", features = [+ "bzip2",+ "gzip",+ "xz",+ "zstd",+ "futures-io",+ "tokio",+], optional = true }async-trait = { workspace = true }bytes = { workspace = true }bzip2 = { version = "0.4.3", optional = true }diff --git a/datafusion/functions/Cargo.toml b/datafusion/functions/Cargo.tomlindex 7109261cc7..f63f18f955 100644--- a/datafusion/functions/Cargo.toml+++ b/datafusion/functions/Cargo.toml@@ -38,7 +38,6 @@ encoding_expressions = ["base64", "hex"]# enable math functionsmath_expressions = []-[lib]name = "datafusion_functions"path = "src/lib.rs"diff --git a/datafusion/optimizer/Cargo.toml b/datafusion/optimizer/Cargo.tomlindex cac46eda98..7235dddc8d 100644--- a/datafusion/optimizer/Cargo.toml+++ b/datafusion/optimizer/Cargo.toml@@ -18,7 +18,7 @@[package]name = "datafusion-optimizer"description = "DataFusion Query Optimizer"-keywords = [ "datafusion", "query", "optimizer" ]+keywords = ["datafusion", "query", "optimizer"]readme = "README.md"version = { workspace = true }edition = { workspace = true }diff --git a/datafusion/physical-expr/Cargo.toml b/datafusion/physical-expr/Cargo.tomlindex 719dc425fc..a46ad42f67 100644--- a/datafusion/physical-expr/Cargo.toml+++ b/datafusion/physical-expr/Cargo.toml@@ -34,7 +34,11 @@ path = "src/lib.rs"[features]crypto_expressions = ["md-5", "sha2", "blake2", "blake3"]-default = ["crypto_expressions", "regex_expressions", "unicode_expressions", "encoding_expressions",+default = [+ "crypto_expressions",+ "regex_expressions",+ "unicode_expressions",+ "encoding_expressions",]encoding_expressions = ["base64", "hex"]regex_expressions = ["regex"]diff --git a/dev/rust_lint.sh b/dev/rust_lint.shindex 1191071330..af0fce72cc 100755--- a/dev/rust_lint.sh+++ b/dev/rust_lint.sh@@ -21,9 +21,9 @@# DataFusion CI doesset -e-if ! command -v cargo-tomlfmt &> /dev/null; then- echo "Installing cargo-tomlfmt using cargo"- cargo install cargo-tomlfmt+if ! command -v taplo &> /dev/null; then+ echo "Installing taplo using cargo"+ cargo install taplo-clifici/scripts/rust_fmt.shdiff --git a/taplo.toml b/taplo.tomlnew file mode 100644index 0000000000..b7089c5016--- /dev/null+++ b/taplo.toml@@ -0,0 +1,62 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++## https://taplo.tamasfe.dev/configuration/file.html++include = ["**/Cargo.toml"]++[formatting]+# Align consecutive entries vertically.+align_entries = false+# Append trailing commas for multi-line arrays.+array_trailing_comma = true+# Expand arrays to multiple lines that exceed the maximum column width.+array_auto_expand = true+# Collapse arrays that don't exceed the maximum column width and don't contain comments.+array_auto_collapse = false+# Omit white space padding from single-line arrays+compact_arrays = true+# Omit white space padding from the start and end of inline tables.+compact_inline_tables = false+# Maximum column width in characters, affects array expansion and collapse, this doesn't take whitespace into account.+# Note that this is not set in stone, and works on a best-effort basis.+column_width = 120+# Indent based on tables and arrays of tables and their subtables, subtables out of order are not indented.+indent_tables = false+# The substring that is used for indentation, should be tabs or spaces (but technically can be anything).+indent_string = ' '+# Add trailing newline at the end of the file if not present.+trailing_newline = true+# Alphabetically reorder keys that are not separated by empty lines.+reorder_keys = false+# Maximum amount of allowed consecutive blank lines. This does not affect the whitespace at the end of the document, as it is always stripped.+allowed_blank_lines = 1+# Use CRLF for line endings.+crlf = false++[[rule]]+keys = [+ "build-dependencies",+ "dependencies",+ "dev-dependencies",+ "workspace.dependencies",+]+formatting = { reorder_keys = true }++[[rule]]+keys = ["package"]+formatting = { reorder_keys = false }