Skip to content

Commit

Permalink
chore: standardize project configuration files and add pre-commit hooks
Browse files Browse the repository at this point in the history
- Add comprehensive pre-commit hooks for code quality:
  - Add `check-toml`, `pretty-format-json`, and `pretty-format-toml` hooks
  - Add `forbid-crlf` and `remove-tabs` for consistent line endings
  - Add `cargo-test` hook using `nextest` for push events

- Standardize TOML file formatting across workspace:
  - Sort package fields consistently
  - Normalize dependency declarations
  - Fix trailing commas and whitespace

- Update version constraints and dependencies:
  - Add `nom = "8.0.0-alpha2"`
  - Update various workspace dependencies

- Clean up configuration files:
  - Sort deny.toml sections logically
  - Standardize .cargo/config.toml
  - Format JSON files consistently
  • Loading branch information
andrewgazelka committed Oct 30, 2024
1 parent 7490b44 commit ab75123
Show file tree
Hide file tree
Showing 28 changed files with 393 additions and 438 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable", "-Ctarget-cpu=native"]
rustflags = ["--cfg", "tokio_unstable", "-Ctarget-cpu=native"]
4 changes: 3 additions & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "Debian",
"forwardPorts": [25565],
"forwardPorts": [
25565
],
"features": {
"ghcr.io/devcontainers/features/rust:1": {}
},
Expand Down
12 changes: 6 additions & 6 deletions .github/chart/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[project]
name = "chart"
version = "0.1.0"
dependencies = [
"matplotlib>=3.9.2",
"numpy>=2.1.2"
]
description = "Add your description here"
name = "chart"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"matplotlib>=3.9.2",
"numpy>=2.1.2",
]
version = "0.1.0"
30 changes: 29 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,31 @@ repos:
description: Detects presence of private keys
- id: check-yaml
description: Validates YAML files
- id: check-toml
- id: mixed-line-ending
args: [ --fix=lf ]
description: Replaces mixed line endings with LF
- id: check-executables-have-shebangs
description: Ensures executable files have shebangs
- id: pretty-format-json
args: [ --autofix, --no-sort-keys ]
description: Checks that JSON files are properly formatted

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [ --autofix ]
description: Formats TOML files

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-crlf
description: Prevents CRLF line endings
- id: remove-tabs
description: Replaces tabs with spaces

- repo: local
hooks:
- id: cargo-fmt
Expand Down Expand Up @@ -55,4 +75,12 @@ repos:
entry: cargo deny check
language: system
types: [rust]
pass_filenames: false
pass_filenames: false
- id: cargo-test
name: cargo test
description: Run cargo tests
entry: cargo nextest run
language: system
types: [ rust ]
pass_filenames: false
stages: [ push ] # Only run on push, not every commit
9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[profile]

[profile.release-debug]
debug = true
inherits = 'release'
Expand Down Expand Up @@ -28,7 +29,7 @@ members = [
'crates/hyperion-utils',
'events/proof-of-concept',
'crates/hyperion-circle-buf',
'crates/hyperion-permission',
'crates/hyperion-permission'
]
resolver = '2'

Expand All @@ -38,7 +39,6 @@ approx = '0.5.1'
arrayvec = '0.7.4'
base64 = '0.22.1'
bitfield-struct = '0.9.2'
nom = "8.0.0-alpha2"
bitvec = '1.0.1'
bumpalo = '3.16'
byteorder = '1.5.0'
Expand All @@ -62,6 +62,7 @@ libdeflater = '1.20.0'
memmap2 = '0.9.5'
more-asserts = '0.3.1'
no_denormals = '0.1.2'
nom = "8.0.0-alpha2"
once_cell = '1.19.0'
ordered-float = '4.2.0'
ouroboros = '0.18.4'
Expand All @@ -82,7 +83,7 @@ thiserror = '1.0.63'
tikv-jemallocator = '0.6.0'
tokio = '1.40.0'
toml = '0.8.14'
tracing-tracy = { version = "0.11.3", features = ["timer-fallback"] }
tracing-tracy = {version = "0.11.3", features = ["timer-fallback"]}
uuid = '1.8.0'

[workspace.dependencies.bvh]
Expand Down Expand Up @@ -219,6 +220,7 @@ branch = 'feat-open'
git = 'https://github.com/andrewgazelka/valence'

[workspace.lints]

[workspace.lints.clippy]
cast_precision_loss = 'allow'
future_not_send = 'allow'
Expand Down Expand Up @@ -254,6 +256,7 @@ level = 'deny'
priority = -1

[workspace.lints.rust]

[workspace.lints.rust.future_incompatible]
level = 'deny'
priority = -1
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://doc.rust-lang.org/nightly/clippy/lint_configuration.html

cognitive-complexity-threshold = 200
excessive-nesting-threshold = 7
too-many-lines-threshold = 200
64 changes: 32 additions & 32 deletions crates/bvh-region/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
[package]
name = "bvh-region"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false
[[bench]]
harness = false
name = "sort"

[features]
plot = ["dep:plotters", "dep:plotters-bitmap"]
default = []
[[bench]]
harness = false
name = "bvh"

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

[dependencies]
fastrand.workspace = true
glam = { workspace = true, features = ["serde"] }
rayon.workspace = true
glam = {workspace = true, features = ["serde"]}
plotters = {workspace = true, features = [
"plotters-bitmap",
"image"
], optional = true}
plotters-bitmap = {workspace = true, optional = true}
serde = {workspace = true, features = ["derive"]}
arrayvec.workspace = true
ordered-float.workspace = true
fastrand.workspace = true
itertools.workspace = true
plotters = { workspace = true, features = [
"plotters-bitmap",
"image",
], optional = true }
plotters-bitmap = { workspace = true, optional = true }
ordered-float.workspace = true
rayon.workspace = true
tracing.workspace = true
serde = { workspace = true, features = ["derive"] }

[dev-dependencies]
divan.workspace = true
criterion.workspace = true
divan.workspace = true
rand.workspace = true
tango-bench.workspace = true
tracing-subscriber.workspace = true

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

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

[[bench]]
name = "side_by_side"
harness = false
[features]
default = []
plot = ["dep:plotters", "dep:plotters-bitmap"]

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "bvh-region"
publish = false
readme = "README.md"
version = "0.1.0"
16 changes: 8 additions & 8 deletions crates/hyperion-circle-buf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "hyperion-circle-buf"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[dependencies]

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-circle-buf"
publish = false
readme = "README.md"
version = "0.1.0"
20 changes: 10 additions & 10 deletions crates/hyperion-crafting/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "hyperion-crafting"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[dependencies]
valence_protocol.workspace = true
anyhow.workspace = true
flecs_ecs.workspace = true
derive-build.workspace = true
flecs_ecs.workspace = true
slotmap.workspace = true
valence_protocol.workspace = true

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-crafting"
publish = false
readme = "README.md"
version = "0.1.0"
26 changes: 13 additions & 13 deletions crates/hyperion-event-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[package]
name = "hyperion-event-macros"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[lib]
proc-macro = true

[dependencies]
quote = "1.0.37"
syn = "2.0.79"
convert_case = "0.6.0"
proc-macro2 = "1.0.88"
quote = "1.0.37"
syn = "2.0.79"

[dev-dependencies]
trybuild = "1.0.100"
hyperion.workspace = true

[lib]
proc-macro = true

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-event-macros"
publish = false
readme = "README.md"
version = "0.1.0"
20 changes: 10 additions & 10 deletions crates/hyperion-inventory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "hyperion-inventory"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[dependencies]
valence_protocol.workspace = true
flecs_ecs.workspace = true
snafu.workspace = true
hyperion-crafting.workspace = true
roaring.workspace = true
snafu.workspace = true
valence_protocol.workspace = true

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-inventory"
publish = false
readme = "README.md"
version = "0.1.0"
16 changes: 8 additions & 8 deletions crates/hyperion-minecraft-proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "hyperion-minecraft-proto"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[dependencies]

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-minecraft-proto"
publish = false
readme = "README.md"
version = "0.1.0"
16 changes: 8 additions & 8 deletions crates/hyperion-nerd-font/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "hyperion-nerd-font"
version = "0.1.0"
edition = "2021"
authors = ["Andrew Gazelka <[email protected]>"]
readme = "README.md"
publish = false

[dependencies]

[lints]
workspace = true

[package]
authors = ["Andrew Gazelka <[email protected]>"]
edition = "2021"
name = "hyperion-nerd-font"
publish = false
readme = "README.md"
version = "0.1.0"
Loading

0 comments on commit ab75123

Please sign in to comment.