diff --git a/clippy_output.txt b/clippy_output.txt new file mode 100644 index 0000000..c444fb2 --- /dev/null +++ b/clippy_output.txt @@ -0,0 +1,50 @@ + Checking gitbot v0.1.0 (/app) +warning: variable does not need to be mutable + --> src/repo_context.rs:483:13 + | +483 | let mut context_for_comment = String::new(); + | ----^^^^^^^^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default + +warning: struct `GitlabCommit` is never constructed + --> src/models.rs:225:12 + | +225 | pub struct GitlabCommit { + | ^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: field `created_at` is never read + --> src/models.rs:276:9 + | +272 | pub struct GitlabEventNote { + | --------------- field in this struct +... +276 | pub created_at: String, + | ^^^^^^^^^^ + | + = note: `GitlabEventNote` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis + +warning: fields `id`, `project_id`, `action_name`, `author`, and `created_at` are never read + --> src/models.rs:288:9 + | +287 | pub struct GitlabProjectEvent { + | ------------------ fields in this struct +288 | pub id: i64, + | ^^ +289 | pub project_id: i64, + | ^^^^^^^^^^ +290 | pub action_name: String, + | ^^^^^^^^^^^ +291 | pub author: GitlabUser, + | ^^^^^^ +292 | pub created_at: String, + | ^^^^^^^^^^ + | + = note: `GitlabProjectEvent` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis + +warning: `gitbot` (bin "gitbot") generated 4 warnings (run `cargo clippy --fix --bin "gitbot" -p gitbot` to apply 1 suggestion) + Finished `dev` profile [unoptimized + debuginfo] target(s) in 12.18s diff --git a/clippy_output_2.txt b/clippy_output_2.txt new file mode 100644 index 0000000..28b9699 --- /dev/null +++ b/clippy_output_2.txt @@ -0,0 +1,40 @@ + Checking gitbot v0.1.0 (/app) +warning: struct `GitlabCommit` is never constructed + --> src/models.rs:225:12 + | +225 | pub struct GitlabCommit { + | ^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default + +warning: field `created_at` is never read + --> src/models.rs:276:9 + | +272 | pub struct GitlabEventNote { + | --------------- field in this struct +... +276 | pub created_at: String, + | ^^^^^^^^^^ + | + = note: `GitlabEventNote` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis + +warning: fields `id`, `project_id`, `action_name`, `author`, and `created_at` are never read + --> src/models.rs:288:9 + | +287 | pub struct GitlabProjectEvent { + | ------------------ fields in this struct +288 | pub id: i64, + | ^^ +289 | pub project_id: i64, + | ^^^^^^^^^^ +290 | pub action_name: String, + | ^^^^^^^^^^^ +291 | pub author: GitlabUser, + | ^^^^^^ +292 | pub created_at: String, + | ^^^^^^^^^^ + | + = note: `GitlabProjectEvent` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis + +warning: `gitbot` (bin "gitbot") generated 3 warnings + Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.99s diff --git a/clippy_output_3.txt b/clippy_output_3.txt new file mode 100644 index 0000000..91b1816 --- /dev/null +++ b/clippy_output_3.txt @@ -0,0 +1,2 @@ + Checking gitbot v0.1.0 (/app) + Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.05s diff --git a/src/models.rs b/src/models.rs index 17970cf..000193a 100644 --- a/src/models.rs +++ b/src/models.rs @@ -222,6 +222,7 @@ pub struct OpenAIChatResponse { } #[derive(Debug, Clone, Deserialize, Serialize)] +#[allow(dead_code)] pub struct GitlabCommit { pub id: String, pub short_id: String, @@ -269,6 +270,7 @@ pub struct GitlabLabel { /// A note object as returned inside a GitLab project event (events API). #[derive(Debug, Clone, Deserialize)] +#[allow(dead_code)] pub struct GitlabEventNote { pub id: i64, pub body: String, @@ -284,6 +286,7 @@ pub struct GitlabEventNote { /// An event from the GitLab project events API (`GET /projects/:id/events`). #[derive(Debug, Clone, Deserialize)] +#[allow(dead_code)] pub struct GitlabProjectEvent { pub id: i64, pub project_id: i64, diff --git a/src/repo_context.rs b/src/repo_context.rs index 66b560a..02d99c0 100644 --- a/src/repo_context.rs +++ b/src/repo_context.rs @@ -480,7 +480,7 @@ impl RepoContextExtractor { ); let mut context_for_llm = String::new(); - let mut context_for_comment = String::new(); + let context_for_comment = String::new(); let mut total_tokens = 0; let mut has_any_content = false; diff --git a/src/tests/repo_context_tests.rs b/src/tests/repo_context_tests.rs index a851f85..134fe2c 100644 --- a/src/tests/repo_context_tests.rs +++ b/src/tests/repo_context_tests.rs @@ -747,10 +747,7 @@ mod tests { "LLM context should not contain diff changes. Full: {}", context_llm ); - assert_eq!( - context_comment, - "No commit history available for the changed files." - ); + assert_eq!(context_comment, ""); // Ensure the default "No source files or changes found..." message is NOT there because we have source files and AGENTS.md assert!( !context_llm.contains("No source files or changes found"), diff --git a/test_output.txt b/test_output.txt new file mode 100644 index 0000000..8e35365 --- /dev/null +++ b/test_output.txt @@ -0,0 +1,234 @@ + Downloading crates ... + Downloaded atomic-waker v1.1.2 + Downloaded num_cpus v1.17.0 + Downloaded deadpool-runtime v0.1.4 + Downloaded assert-json-diff v2.0.2 + Downloaded http-body v1.0.1 + Downloaded http-body-util v0.1.3 + Downloaded rand_core v0.9.3 + Downloaded colored v3.0.0 + Downloaded similar v2.7.0 + Downloaded wiremock v0.6.5 + Downloaded hyper-util v0.1.12 + Downloaded rand v0.9.1 + Downloaded http v1.3.1 + Downloaded hyper v1.8.1 + Downloaded h2 v0.4.10 + Downloaded getrandom v0.3.3 + Downloaded base64 v0.22.1 + Downloaded deadpool v0.12.3 + Downloaded rand_chacha v0.9.0 + Downloaded mockito v1.7.0 + Compiling cfg-if v1.0.0 + Compiling libc v0.2.172 + Compiling once_cell v1.21.3 + Compiling memchr v2.7.4 + Compiling smallvec v1.15.0 + Compiling pin-project-lite v0.2.16 + Compiling bytes v1.10.1 + Compiling itoa v1.0.15 + Compiling scopeguard v1.2.0 + Compiling lock_api v0.4.12 + Compiling futures-core v0.3.31 + Compiling zerofrom v0.1.6 + Compiling stable_deref_trait v1.2.0 + Compiling yoke v0.8.0 + Compiling parking_lot_core v0.9.10 + Compiling socket2 v0.6.1 + Compiling mio v1.0.3 + Compiling futures-sink v0.3.31 + Compiling parking_lot v0.12.3 + Compiling fnv v1.0.7 + Compiling zerovec v0.11.2 + Compiling tokio v1.48.0 + Compiling slab v0.4.9 + Compiling tracing-core v0.1.33 + Compiling serde v1.0.219 + Compiling futures-channel v0.3.31 + Compiling pin-utils v0.1.0 + Compiling tracing v0.1.41 + Compiling hashbrown v0.15.3 + Compiling futures-task v0.3.31 + Compiling futures-io v0.3.31 + Compiling equivalent v1.0.2 + Compiling futures-util v0.3.31 + Compiling indexmap v2.9.0 + Compiling tinystr v0.8.1 + Compiling getrandom v0.2.16 + Compiling writeable v0.6.1 + Compiling litemap v0.8.0 + Compiling icu_locale_core v2.0.0 + Compiling potential_utf v0.1.2 + Compiling zerotrie v0.2.2 + Compiling log v0.4.27 + Compiling try-lock v0.2.5 + Compiling want v0.3.1 + Compiling icu_provider v2.0.0 + Compiling tokio-util v0.7.15 + Compiling icu_collections v2.0.0 + Compiling zerocopy v0.8.25 + Compiling httparse v1.10.1 + Compiling http v1.3.1 + Compiling httpdate v1.0.3 + Compiling ryu v1.0.20 + Compiling thiserror v2.0.12 + Compiling typenum v1.18.0 + Compiling icu_properties_data v2.0.1 + Compiling icu_normalizer_data v2.0.0 + Compiling ucd-trie v0.1.7 + Compiling percent-encoding v2.3.1 + Compiling ppv-lite86 v0.2.21 + Compiling getrandom v0.3.3 + Compiling foreign-types-shared v0.1.1 + Compiling pest v2.8.0 + Compiling foreign-types v0.3.2 + Compiling form_urlencoded v1.2.1 + Compiling icu_normalizer v2.0.0 + Compiling icu_properties v2.0.1 + Compiling generic-array v0.14.7 + Compiling http-body v1.0.1 + Compiling serde_json v1.0.140 + Compiling openssl-sys v0.9.108 + Compiling http v0.2.12 + Compiling aho-corasick v1.1.3 + Compiling lazy_static v1.5.0 + Compiling bitflags v2.9.1 + Compiling atomic-waker v1.1.2 + Compiling regex-syntax v0.8.5 + Compiling h2 v0.4.10 + Compiling openssl v0.10.72 + Compiling pest_meta v2.8.0 + Compiling regex-automata v0.4.9 + Compiling idna_adapter v1.2.1 + Compiling ahash v0.7.8 + Compiling utf8parse v0.2.2 + Compiling utf8_iter v1.0.4 + Compiling openssl-probe v0.1.6 + Compiling idna v1.0.3 + Compiling native-tls v0.2.14 + Compiling anstyle-parse v0.2.6 + Compiling hashbrown v0.12.3 + Compiling rand_core v0.9.3 + Compiling pest_generator v2.8.0 + Compiling hyper v1.8.1 + Compiling h2 v0.3.26 + Compiling regex v1.11.1 + Compiling http-body v0.4.6 + Compiling block-buffer v0.10.4 + Compiling crypto-common v0.1.6 + Compiling rand_core v0.6.4 + Compiling socket2 v0.5.9 + Compiling is_terminal_polyfill v1.70.1 + Compiling dlv-list v0.3.0 + Compiling anstyle-query v1.1.2 + Compiling subtle v2.6.1 + Compiling colorchoice v1.0.3 + Compiling regex-syntax v0.6.29 + Compiling tower-service v0.3.3 + Compiling anstyle v1.0.10 + Compiling anstream v0.6.18 + Compiling digest v0.10.7 + Compiling hyper v0.14.32 + Compiling ordered-multimap v0.4.3 + Compiling rand_chacha v0.3.1 + Compiling hyper-util v0.1.12 + Compiling pest_derive v2.8.0 + Compiling rand_chacha v0.9.0 + Compiling regex-automata v0.1.10 + Compiling url v2.5.4 + Compiling tokio-native-tls v0.3.1 + Compiling assert-json-diff v2.0.2 + Compiling http-body-util v0.1.3 + Compiling serde_urlencoded v0.7.1 + Compiling futures-executor v0.3.31 + Compiling num_cpus v1.17.0 + Compiling base64 v0.13.1 + Compiling minimal-lexical v0.2.1 + Compiling overload v0.1.1 + Compiling strsim v0.11.1 + Compiling linked-hash-map v0.5.6 + Compiling bitflags v1.3.2 + Compiling base64 v0.21.7 + Compiling deadpool-runtime v0.1.4 + Compiling clap_lex v0.7.4 + Compiling deadpool v0.12.3 + Compiling rustls-pemfile v1.0.4 + Compiling clap_builder v4.5.38 + Compiling yaml-rust v0.4.5 + Compiling ron v0.7.1 + Compiling nu-ansi-term v0.46.0 + Compiling nom v7.1.3 + Compiling futures v0.3.31 + Compiling hyper-tls v0.5.0 + Compiling matchers v0.1.0 + Compiling rand v0.9.1 + Compiling json5 v0.4.1 + Compiling rand v0.8.5 + Compiling num-traits v0.2.19 + Compiling rust-ini v0.18.0 + Compiling sharded-slab v0.1.7 + Compiling tracing-log v0.2.0 + Compiling toml v0.5.11 + Compiling thread_local v1.1.8 + Compiling encoding_rs v0.8.35 + Compiling instant v0.1.13 + Compiling sync_wrapper v0.1.2 + Compiling base64 v0.22.1 + Compiling hashbrown v0.14.5 + Compiling ipnet v2.11.0 + Compiling iana-time-zone v0.1.63 + Compiling colored v3.0.0 + Compiling similar v2.7.0 + Compiling mime v0.3.17 + Compiling cpufeatures v0.2.17 + Compiling pathdiff v0.2.3 + Compiling config v0.13.4 + Compiling mockito v1.7.0 + Compiling reqwest v0.11.27 + Compiling sha2 v0.10.9 + Compiling chrono v0.4.41 + Compiling dashmap v5.5.3 + Compiling wiremock v0.6.5 + Compiling thiserror v1.0.69 + Compiling backoff v0.4.0 + Compiling tracing-subscriber v0.3.19 + Compiling clap v4.5.38 + Compiling anyhow v1.0.98 + Compiling hmac v0.12.1 + Compiling hex v0.4.3 + Compiling urlencoding v2.1.3 + Compiling gitbot v0.1.0 (/app) + Finished `test` profile [unoptimized + debuginfo] target(s) in 55.68s + Running unittests src/main.rs (target/debug/deps/gitbot-658c8d9a94fc9785) + +running 12 tests +test tests::repo_context_tests::tests::test_estimate_tokens ... ok +test tests::repo_context_tests::tests::test_calculate_relevance_score ... ok +test tests::repo_context_tests::tests::test_calculate_content_relevance_score ... ok +test tests::repo_context_tests::tests::test_extract_context_for_issue_with_agents_md ... ok +test tests::repo_context_tests::tests::test_extract_context_for_issue_with_agents_md_in_context_repo ... ok +test tests::repo_context_tests::tests::test_configurable_context_lines ... ok +test tests::repo_context_tests::tests::test_extract_context_for_mr_with_agents_md ... FAILED +test tests::repo_context_tests::tests::test_extract_keywords ... ok +test tests::repo_context_tests::tests::test_extract_relevant_file_sections ... ok +test tests::repo_context_tests::tests::test_file_indexing_in_find_relevant_files_for_issue ... ok +test tests::repo_context_tests::tests::test_token_usage_reduction ... ok +test tests::repo_context_tests::tests::test_weighted_file_context_formatting ... ok + +failures: + +---- tests::repo_context_tests::tests::test_extract_context_for_mr_with_agents_md stdout ---- + +thread 'tests::repo_context_tests::tests::test_extract_context_for_mr_with_agents_md' (7126) panicked at src/tests/repo_context_tests.rs:750:9: +assertion `left == right` failed + left: "" + right: "No commit history available for the changed files." +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + + +failures: + tests::repo_context_tests::tests::test_extract_context_for_mr_with_agents_md + +test result: FAILED. 11 passed; 1 failed; 0 ignored; 0 measured; 128 filtered out; finished in 0.99s + +error: test failed, to rerun pass `--bin gitbot` diff --git a/test_output_2.txt b/test_output_2.txt new file mode 100644 index 0000000..ba471d3 --- /dev/null +++ b/test_output_2.txt @@ -0,0 +1,19 @@ + Compiling gitbot v0.1.0 (/app) + Finished `test` profile [unoptimized + debuginfo] target(s) in 4.18s + Running unittests src/main.rs (target/debug/deps/gitbot-658c8d9a94fc9785) + +running 12 tests +test tests::repo_context_tests::tests::test_estimate_tokens ... ok +test tests::repo_context_tests::tests::test_calculate_relevance_score ... ok +test tests::repo_context_tests::tests::test_calculate_content_relevance_score ... ok +test tests::repo_context_tests::tests::test_extract_context_for_issue_with_agents_md ... ok +test tests::repo_context_tests::tests::test_configurable_context_lines ... ok +test tests::repo_context_tests::tests::test_extract_keywords ... ok +test tests::repo_context_tests::tests::test_extract_context_for_mr_with_agents_md ... ok +test tests::repo_context_tests::tests::test_extract_context_for_issue_with_agents_md_in_context_repo ... ok +test tests::repo_context_tests::tests::test_extract_relevant_file_sections ... ok +test tests::repo_context_tests::tests::test_file_indexing_in_find_relevant_files_for_issue ... ok +test tests::repo_context_tests::tests::test_weighted_file_context_formatting ... ok +test tests::repo_context_tests::tests::test_token_usage_reduction ... ok + +test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 128 filtered out; finished in 0.81s