Skip to content

Commit

Permalink
CI: add toml-fmt (#450)
Browse files Browse the repository at this point in the history
* add toml-fmt (taplo)

* fix `pull_request_chunk_size` ("model overloaded" in auto-review workflow)

* reformat toml files a little bit 🤏
  • Loading branch information
boozook authored Jan 30, 2025
1 parent 0ac7da7 commit e007ee0
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
model: "gemini-1.5-pro-latest"
pull_request_diff: |-
${{ steps.get_diff.outputs.pull_request_diff }}
pull_request_chunk_size: "5000"
pull_request_chunk_size: 3500
extra_prompt: You are an expert software engineer and understand algorithms, math and logic. You are also an expert in system design. Your job is to analyze changes and briefly point out potential bugs and issues, as well as API ambiguities. All code is in Rust programming language. Provide short explanation for each case you have found. Otherwise, if there is no problem, just say "LGTM".
log_level: INFO
19 changes: 16 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@ jobs:
contents: read
pull-requests: write

# TODO:
# 1. check and/or fix
# 2. if we have rights (edit PR) - commit-push
# 3. otherwise:
# - suggestions (can failt too)
# - fail with error
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -479,24 +485,31 @@ jobs:
cargo fmt --all -- --check
# (echo "::error::Rust format error." && exit 1)
- name: Format
- name: Format (rs)
id: format
if: steps.check.outcome == 'failure'
run: |
cargo fmt --all
cargo fmt --all
# second time is for anti-flickering, because using nightly rustfmt
- name: Install Taplo
uses: uncenter/setup-taplo@v1.0.8
with:
version: "0.9.3"
- name: Format (toml)
run: taplo fmt "**/*.toml"

- name: Suggestions
uses: reviewdog/action-suggester@v1
with:
filter_mode: diff_context
fail_level: none
tool_name: Rustfmt
tool_name: Format
cleanup: false

clippy:
name: Clippy # with fmt suggestions
name: Clippy # with fmt suggestions needed after clippy fix.
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
defaults:
run:
Expand Down
30 changes: 30 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# doc: https://taplo.tamasfe.dev/configuration/formatter-options.html

include = ["**/*.toml"]
exclude = ["**/target/*.toml"]

[formatting]
align_entries = false # Align entries vertically. Entries that have table headers, comments, or blank lines between them are not aligned.
align_comments = true # Align consecutive comments after entries and items vertically. This applies to comments that are after entries or array items.
array_trailing_comma = true # Put trailing commas for multiline arrays.
array_auto_expand = true # Automatically expand arrays to multiple lines when they exceed column_width characters.
array_auto_collapse = true # Automatically collapse arrays if they fit in one line.
compact_arrays = true # Omit whitespace padding inside single-line arrays.
compact_inline_tables = false # Omit whitespace padding inside inline tables.
inline_table_expand = true # Expand values (e.g. arrays) inside inline tables.
compact_entries = false # Omit whitespace around `=`.
column_width = 114 # Target maximum column width after which arrays are expanded into new lines.
indent_tables = false # Indent subtables if they come in order.
indent_entries = false # Indent entries under tables.
indent_string = "\t" # Indentation to use, should be tabs or spaces but technically could be anything.
trailing_newline = true # Add trailing newline to the source.
reorder_keys = false # Alphabetically reorder keys that are not separated by blank lines.
reorder_arrays = false # Alphabetically reorder array values that are not separated by blank lines.
reorder_inline_tables = false # Alphabetically reorder inline tables.
allowed_blank_lines = 2 # The maximum amount of consecutive blank lines allowed.
crlf = false # Use CRLF line endings.


[[rule]]
include = ["**/{.,}taplo.toml"]
formatting.align_entries = true
6 changes: 1 addition & 5 deletions api/color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
8 changes: 2 additions & 6 deletions api/ctrl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ system = { workspace = true, default-features = false }
[dev-dependencies]
gfx = { workspace = true, default-features = false }
display = { workspace = true, default-features = false }
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }

[[example]]
name = "buttons"
Expand Down Expand Up @@ -61,8 +61,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
6 changes: 1 addition & 5 deletions api/display/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
8 changes: 2 additions & 6 deletions api/fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ workspace = true
default-features = false

[dev-dependencies]
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }

[[example]]
name = "simple"
Expand All @@ -53,8 +53,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
8 changes: 2 additions & 6 deletions api/gfx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ color = { workspace = true, default-features = false }

[dev-dependencies]
display = { workspace = true, default-features = false }
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }

[[example]]
name = "bitmap"
Expand Down Expand Up @@ -62,8 +62,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
6 changes: 1 addition & 5 deletions api/lua/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
8 changes: 2 additions & 6 deletions api/menu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ system = { workspace = true, default-features = false }

[dev-dependencies]
gfx = { workspace = true, default-features = false }
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }


[[example]]
Expand All @@ -58,8 +58,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
6 changes: 1 addition & 5 deletions api/playdate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
8 changes: 2 additions & 6 deletions api/scoreboards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ erased_set = "0.8"


[dev-dependencies]
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }


[[example]]
Expand All @@ -55,8 +55,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
13 changes: 3 additions & 10 deletions api/sound/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ default = ["sys/default", "fs/default"]
bindgen-runtime = ["sys/bindgen-runtime", "fs/bindgen-runtime"]
bindgen-static = ["sys/bindgen-static", "fs/bindgen-static"]

bindings-derive-debug = [
"sys/bindings-derive-debug",
"fs/bindings-derive-debug",
]
bindings-derive-debug = ["sys/bindings-derive-debug", "fs/bindings-derive-debug"]


[dependencies]
Expand All @@ -32,7 +29,7 @@ fs = { workspace = true, default-features = false }

[dev-dependencies]
gfx = { workspace = true, default-features = false }
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }

[[example]]
name = "sp"
Expand Down Expand Up @@ -68,8 +65,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
21 changes: 4 additions & 17 deletions api/sprite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ version = "0.3.0"
readme = "README.md"
description = "High-level sprite API built on-top of Playdate API"
keywords = ["playdate", "sdk", "api", "gamedev"]
categories = [
"game-development",
"api-bindings",
"rendering::graphics-api",
"graphics",
"no-std",
]
categories = ["game-development", "api-bindings", "rendering::graphics-api", "graphics", "no-std"]
edition.workspace = true
license.workspace = true
authors.workspace = true
Expand All @@ -26,10 +20,7 @@ default = ["sys/default", "gfx/default"]

bindgen-runtime = ["sys/bindgen-runtime", "gfx/bindgen-runtime"]
bindgen-static = ["sys/bindgen-static", "gfx/bindgen-static"]
bindings-derive-debug = [
"sys/bindings-derive-debug",
"gfx/bindings-derive-debug",
]
bindings-derive-debug = ["sys/bindings-derive-debug", "gfx/bindings-derive-debug"]


[dependencies]
Expand All @@ -38,7 +29,7 @@ gfx = { workspace = true, default-features = false }

[dev-dependencies]
display = { workspace = true, default-features = false }
system = { workspace = true, default-features = false, features = [ "try-trait-v2" ] }
system = { workspace = true, default-features = false, features = ["try-trait-v2"] }


[[example]]
Expand Down Expand Up @@ -71,8 +62,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
15 changes: 3 additions & 12 deletions api/sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
[package]
name = "playdate-sys"
version = "0.4.9"
version = "0.4.10"
build = "src/build.rs"
readme = "README.md"
description = "Low-level Playdate API bindings"
keywords = ["playdate", "bindings", "ffi", "gamedev"]
categories = [
"external-ffi-bindings",
"development-tools::ffi",
"game-development",
"no-std",
]
categories = ["external-ffi-bindings", "development-tools::ffi", "game-development", "no-std"]
edition.workspace = true
license.workspace = true
authors.workspace = true
Expand Down Expand Up @@ -86,11 +81,7 @@ features = [
# rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]


[[example]]
Expand Down
2 changes: 1 addition & 1 deletion api/sys/src/sys/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use core::alloc::{GlobalAlloc, Layout};
use core::ffi::c_void;


// #[cfg_attr(feature = "allocator-global", global_allocator)]
#[global_allocator]
#[cfg(feature = "allocator")]
pub static GLOBAL: PlaydateAllocator = PlaydateAllocator;
Expand All @@ -43,6 +42,7 @@ unsafe impl GlobalAlloc for PlaydateAllocator {


#[track_caller]
#[allow(static_mut_refs)]
unsafe fn realloc(ptr: *mut c_void, size: usize) -> *mut c_void {
// Cached pointer to the OS's realloc function.
static mut REALLOC: Option<unsafe extern "C" fn(ptr: *mut c_void, size: usize) -> *mut c_void> = None;
Expand Down
6 changes: 1 addition & 5 deletions api/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,4 @@ features = [
]
rustdoc-args = ["--cfg", "docsrs", "--show-type-layout"]
default-target = "thumbv7em-none-eabihf"
cargo-args = [
"-Zunstable-options",
"-Zrustdoc-scrape-examples",
"-Zbuild-std=core,alloc",
]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples", "-Zbuild-std=core,alloc"]
1 change: 0 additions & 1 deletion cargo/tests/crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies = true
overwrite = true



[lib]
path = "../simple/lib.rs"
crate-type = ["dylib", "staticlib"]
Expand Down
Loading

0 comments on commit e007ee0

Please sign in to comment.