Skip to content

Commit

Permalink
chore: toml format and clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Jan 7, 2025
1 parent 0786cd0 commit dbbeb68
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 10 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@ jobs:
run: cargo build

- name: cargo fmt
run: cargo fmt
run: cargo fmt --all -- --check

- name: cargo fmt
run: cargo fmt --all -- --check

- name: cargo clippy
run: cargo clippy --tests -- -D warnings

- name: cargo clippy without default features
run: cargo clippy --no-default-features --tests -- -D warnings

# Only run taplo on linux to save some time.
# Also, taplo is broken on windows for some reason.
- name: Install taplo-cli
run: cargo install taplo-cli
if: matrix.os == 'ubuntu-latest'

- name: Run taplo check
run: ~/.cargo/bin/taplo format --check
if: matrix.os == 'ubuntu-latest'
11 changes: 11 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[formatting]
indent_string = " "
reorder_arrays = true
reorder_keys = true

[[rule]]
include = ["**/Cargo.toml"]
keys = ["package"]

[rule.formatting]
reorder_keys = false
20 changes: 11 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = "https://github.com/nukesor/comfy-table"
repository = "https://github.com/nukesor/comfy-table"
documentation = "https://docs.rs/comfy-table/"
license = "MIT"
keywords = ["terminal", "table", "unicode"]
keywords = ["table", "terminal", "unicode"]
readme = "README.md"
rust-version = "1.64"
edition = "2021"
Expand All @@ -16,12 +16,12 @@ edition = "2021"
maintenance = { status = "actively-developed" }

[[bench]]
name = "build_tables"
harness = false
name = "build_tables"

[[bench]]
name = "build_large_table"
harness = false
name = "build_large_table"

[[example]]
name = "no_tty"
Expand All @@ -39,10 +39,10 @@ required-features = ["custom_styling"]
[features]
# For more info about these flags, please check the README.
# Everything's explained over there.
default = ["tty"]
tty = ["crossterm"]
custom_styling = ["ansi-str", "console", "tty"]
default = ["tty"]
reexport_crossterm = ["tty"]
tty = ["crossterm"]
# ---- DEVELOPMENT FLAGS ----
# This flag is for comfy-table development debugging!
# You usually don't need this as a user of the library.
Expand All @@ -53,11 +53,11 @@ debug = []
integration_test = []

[dependencies]
ansi-str = { version = "0.8", optional = true }
console = { version = "0.15", optional = true }
strum = "0.26"
strum_macros = "0.26"
unicode-width = "0.2"
ansi-str = { version = "0.8", optional = true }
console = { version = "0.15", optional = true }

[dev-dependencies]
criterion = "0.5"
Expand All @@ -69,6 +69,8 @@ rstest = "0.23"
# We don't need any of the default features for crossterm.
# However, the windows build needs the windows feature enabled.
[target.'cfg(not(windows))'.dependencies]
crossterm = { version = "0.28", optional=true, default-features = false }
crossterm = { version = "0.28", optional = true, default-features = false }
[target.'cfg(windows)'.dependencies]
crossterm = { version = "0.28", optional=true, default-features = false, features=["windows"] }
crossterm = { version = "0.28", optional = true, default-features = false, features = [
"windows",
] }
26 changes: 26 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# If you change anything in here, make sure to also adjust the lint CI job!
lint:
just ensure-command cargo-nextest
cargo fmt --all -- --check
taplo format --check
cargo clippy --tests --workspace -- -D warnings

format:
just ensure-command taplo
cargo fmt
taplo format


# Ensures that one or more required commands are installed
ensure-command +command:
#!/usr/bin/env bash
set -euo pipefail
read -r -a commands <<< "{{ command }}"

for cmd in "${commands[@]}"; do
if ! command -v "$cmd" > /dev/null 2>&1 ; then
printf "Couldn't find required executable '%s'\n" "$cmd" >&2
exit 1
fi
done
1 change: 1 addition & 0 deletions tests/all/property_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ prop_compose! {
/// 2. Constraints for all columns.
/// 3. The alignment for each cell.
/// 3. The alignment for each column.
#[allow(clippy::type_complexity)]
fn columns_and_rows() -> impl Strategy<
Value = (
Vec<Vec<String>>,
Expand Down

0 comments on commit dbbeb68

Please sign in to comment.