Skip to content

Commit 8040a34

Browse files
committed
🧪 fix(build): fmt + resolve clippy warnings
- Updated build.rs to automatically fix format string patterns in generated code - Applied format string replacements to eliminate clippy::uninlined_format_args warnings - Fixed format strings in telemetry test for consistency
1 parent f0fe93d commit 8040a34

File tree

5 files changed

+300
-51
lines changed

5 files changed

+300
-51
lines changed

‎.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ jobs:
3737
run: cargo fmt --all -- --check
3838

3939
- name: Run clippy
40-
run: cargo clippy --all-targets --all-features -- -D warnings
40+
run: SQLX_OFFLINE=true cargo clippy --all-targets --all-features -- -D warnings
4141

4242
- name: Build workspace
43-
run: cargo build --workspace
43+
run: SQLX_OFFLINE=true cargo build --workspace
4444

4545
# Start services for both unit tests (with external access) and integration tests
4646
- name: Start services for testing
4747
run: |
4848
echo "Starting Docker services..."
49-
docker compose up -d --build
49+
docker compose --profile ci up -d --build
5050
5151
echo "Waiting for core services (DB, Kafka) to be ready..."
5252
max_attempts=20
@@ -135,4 +135,4 @@ jobs:
135135
136136
- name: Cleanup
137137
if: always()
138-
run: docker compose down -v
138+
run: docker compose --profile ci down -v

‎client/build.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,26 @@ fn main() {
2929
.generate_tokens(&spec)
3030
.expect("Could not generate tokens");
3131
let ast = syn::parse2(tokens).unwrap();
32-
let content = prettyplease::unparse(&ast);
32+
let mut content = prettyplease::unparse(&ast);
33+
34+
// Fix clippy::uninlined_format_args warnings by replacing format string patterns
35+
content = content.replace(
36+
r#"format!("error converting supplied value for author: {}", e)"#,
37+
r#"format!("error converting supplied value for author: {e}")"#,
38+
);
39+
content = content.replace(
40+
r#"format!("error converting supplied value for id: {}", e)"#,
41+
r#"format!("error converting supplied value for id: {e}")"#,
42+
);
43+
content = content.replace(
44+
r#"format!("error converting supplied value for title: {}", e)"#,
45+
r#"format!("error converting supplied value for title: {e}")"#,
46+
);
47+
content = content.replace(
48+
r#"format!("conversion to `BookCreateIn` for body failed: {}", s)"#,
49+
r#"format!("conversion to `BookCreateIn` for body failed: {s}")"#,
50+
);
51+
3352
let content = format!("#![allow(clippy::all)]\n{content}");
3453

3554
let mut out_file = std::path::Path::new("src").to_path_buf();

‎client/src/generated.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub mod types {
170170
{
171171
self.author = value
172172
.try_into()
173-
.map_err(|e| format!("error converting supplied value for author: {}", e));
173+
.map_err(|e| format!("error converting supplied value for author: {e}"));
174174
self
175175
}
176176
pub fn id<T>(mut self, value: T) -> Self
@@ -180,7 +180,7 @@ pub mod types {
180180
{
181181
self.id = value
182182
.try_into()
183-
.map_err(|e| format!("error converting supplied value for id: {}", e));
183+
.map_err(|e| format!("error converting supplied value for id: {e}"));
184184
self
185185
}
186186
pub fn title<T>(mut self, value: T) -> Self
@@ -190,7 +190,7 @@ pub mod types {
190190
{
191191
self.title = value
192192
.try_into()
193-
.map_err(|e| format!("error converting supplied value for title: {}", e));
193+
.map_err(|e| format!("error converting supplied value for title: {e}"));
194194
self
195195
}
196196
}
@@ -240,7 +240,7 @@ pub mod types {
240240
{
241241
self.author = value
242242
.try_into()
243-
.map_err(|e| format!("error converting supplied value for author: {}", e));
243+
.map_err(|e| format!("error converting supplied value for author: {e}"));
244244
self
245245
}
246246
pub fn title<T>(mut self, value: T) -> Self
@@ -250,7 +250,7 @@ pub mod types {
250250
{
251251
self.title = value
252252
.try_into()
253-
.map_err(|e| format!("error converting supplied value for title: {}", e));
253+
.map_err(|e| format!("error converting supplied value for title: {e}"));
254254
self
255255
}
256256
}
@@ -498,7 +498,7 @@ pub mod builder {
498498
self.body = value
499499
.try_into()
500500
.map(From::from)
501-
.map_err(|s| format!("conversion to `BookCreateIn` for body failed: {}", s));
501+
.map_err(|s| format!("conversion to `BookCreateIn` for body failed: {s}"));
502502
self
503503
}
504504
pub fn body_map<F>(mut self, f: F) -> Self
@@ -714,7 +714,7 @@ pub mod builder {
714714
self.body = value
715715
.try_into()
716716
.map(From::from)
717-
.map_err(|s| format!("conversion to `BookCreateIn` for body failed: {}", s));
717+
.map_err(|s| format!("conversion to `BookCreateIn` for body failed: {s}"));
718718
self
719719
}
720720
pub fn body_map<F>(mut self, f: F) -> Self

‎docker-compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ services:
124124
target: builder # Use the builder stage from the Dockerfile
125125
environment:
126126
OTEL_EXPORTER_OTLP_ENDPOINT: http://telemetry:4317
127+
APP_BASE_URL: "http://app:8000"
128+
TELEMETRY_BASE_URL: "http://telemetry:3000"
129+
TEMPO_DIRECT_URL: "http://telemetry:3200"
127130
RUST_LOG: "info,integration_tests=trace,integration_tests::telemetry_test=trace" # Enable trace logs for our test crate and specific test module
128131
RUST_BACKTRACE: "1"
129132
# DATABASE_URL is not strictly needed by this test unless tests evolve to touch DB directly

0 commit comments

Comments
 (0)