Skip to content

Commit 6376b20

Browse files
committed
chore: improve ci
1 parent 48ab52e commit 6376b20

File tree

14 files changed

+70
-70
lines changed

14 files changed

+70
-70
lines changed

.config/selfci/ci.sh

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,8 @@ set -eou pipefail
33

44

55
function job_lint() {
6-
set -x
7-
8-
# Get zero-terminated list of non-symlink files (reusable)
9-
git_ls_files="$(git ls-files -z | while IFS= read -r -d '' file; do
10-
[ ! -L "$file" ] && printf '%s\0' "$file"
11-
done)"
12-
13-
selfci step start "check leftover dbg!"
14-
while IFS= read -r -d '' path; do
15-
if grep -q 'dbg!(' "$path"; then
16-
>&2 echo "$path contains dbg! macro"
17-
selfci step fail
18-
fi
19-
done <<< "$git_ls_files"
20-
21-
selfci step start "nixfmt"
22-
nix_files=()
23-
while IFS= read -r -d '' path; do
24-
[[ "$path" == *.nix ]] && nix_files+=("$path")
25-
done <<< "$git_ls_files"
26-
if [ ${#nix_files[@]} -gt 0 ]; then
27-
if ! nixfmt -c "${nix_files[@]}"; then
28-
selfci step fail
29-
fi
30-
fi
31-
32-
selfci step start "cargo fmt"
33-
if ! cargo fmt --all --check ; then
6+
selfci step start "treefmt"
7+
if ! treefmt --ci ; then
348
selfci step fail
359
fi
3610
}

.treefmt.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[formatter.nix]
2+
command = "nixfmt"
3+
includes = ["*.nix"]
4+
5+
[formatter.rust]
6+
command = "rustfmt"
7+
options = ["--edition", "2024"]
8+
includes = ["*.rs"]

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ description = "A p2p (f2f) social network."
2626
[workspace.lints.clippy]
2727
collapsible_if = "allow"
2828
collapsible_else_if = "allow"
29+
dbg_macro = "deny"
30+
literal_string_with_formatting_args = "deny"
2931

3032
[workspace.metadata]
3133
name = "rostra"

crates/rostra-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ divan = { workspace = true }
5050
test-log = { workspace = true, features = ["trace"] }
5151
serde_json = { workspace = true }
5252
tracing = { workspace = true }
53+
54+
[lints]
55+
workspace = true

crates/rostra-p2p-api/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ snafu = { workspace = true }
1414
tokio = { workspace = true }
1515
tracing = { workspace = true }
1616
tracing-subscriber = { workspace = true }
17+
18+
[lints]
19+
workspace = true

crates/rostra-p2p/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ snafu = { workspace = true }
2323
tokio = { workspace = true }
2424
tracing = { workspace = true }
2525
tracing-subscriber = { workspace = true }
26+
27+
[lints]
28+
workspace = true

crates/rostra-util-bind-addr/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ version.workspace = true
44
edition.workspace = true
55
license.workspace = true
66

7+
[lints]
8+
workspace = true
9+
710
[dependencies]
811
serde = { workspace = true, features = ["derive"] }

crates/rostra-util-dedup-chan/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ tokio = { workspace = true }
1515

1616
[dev-dependencies]
1717
test-log = { workspace = true, features = ["trace"] }
18+
19+
[lints]
20+
workspace = true

crates/rostra-util-error/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ version = { workspace = true }
99
[features]
1010
default = []
1111

12+
[lints]
13+
workspace = true
14+
1215
[dependencies]
1316
snafu = { workspace = true }

crates/rostra-util-fmt/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ version = { workspace = true }
99
[features]
1010
default = []
1111

12+
[lints]
13+
workspace = true
14+
1215
[dependencies]

0 commit comments

Comments
 (0)