From 650f6ed0a4e70fbda31e2f5c1974dbbfa7ec5cf1 Mon Sep 17 00:00:00 2001 From: Tapish Rathore Date: Wed, 1 Nov 2023 22:23:27 +0530 Subject: [PATCH 1/3] Add file and hunk deletion filter --- vibi-dpu/src/utils/gitops.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/vibi-dpu/src/utils/gitops.rs b/vibi-dpu/src/utils/gitops.rs index 6bde3d64..6f33b2eb 100644 --- a/vibi-dpu/src/utils/gitops.rs +++ b/vibi-dpu/src/utils/gitops.rs @@ -151,21 +151,22 @@ pub fn get_excluded_files(review: &Review) -> Option<(Vec, Vec Option<(Vec, Vec)>{ let statvec = process_statitems(statstr); - let mut bigfiles = Vec::::new(); - let mut smallfiles = Vec::::new(); + let mut excluded_files = Vec::::new(); + let mut filtered_files = Vec::::new(); let line_threshold = 500; for item in statvec { // logic for exclusion if (item.additions > line_threshold) || (item.deletions > line_threshold) || - (item.additions + item.deletions > line_threshold) { - bigfiles.push(item); + (item.additions + item.deletions > line_threshold) || + (item.deletions < 1) { + excluded_files.push(item); } else { - smallfiles.push(item); + filtered_files.push(item); } } - return Some((bigfiles, smallfiles)); + return Some((excluded_files, filtered_files)); } fn generate_statitem(statitems: &Vec<&str>) -> StatItem { @@ -253,7 +254,9 @@ fn process_diff(filepath: &str, diff: &str, linemap: &mut HashMap bool { + // Split the hunk into lines + let lines = hunk.split('\n').collect::>(); + + // Iterate through the lines to check for deletions + for line in lines.iter() { + if line.starts_with('-') && !line.starts_with("---") { + return true; + } + } + + return false; +} + pub fn process_diffmap(diffmap: &HashMap) -> HashMap> { let mut linemap: HashMap> = HashMap::new(); for (filepath, diff) in diffmap { From b6710df8d7442ab42f7e18a858c25ffc5089b8e2 Mon Sep 17 00:00:00 2001 From: Avikalp Kumar Gupta Date: Fri, 3 Nov 2023 14:05:51 +0530 Subject: [PATCH 2/3] Update README.md: replace team-monitor-website with vibinex-server --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4c656d68..a6d06bcf 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ To run Vibi-DPU locally: 1. Generate public url using ngrok - `ngrok http 3000`. We will run our next server locally on port 3000 in later steps. 2. Paste this in OAuth consumers in callback_url field. -3. Clone [team-monitor-webiste](https://github.com/Alokit-Innovations/team-monitor-website/) locally. -4. Paste the client id and secret in team-monitor-wesite in .env.local in root directory. Also use them in the docker command below. +3. Clone [vibinex-server](https://github.com/Alokit-Innovations/vibinex-server/) locally. +4. Paste the client id and secret in vibinex-server in .env.local in root directory. Also use them in the docker command below. 5. Fire up cloud sql proxy - `./cloud-sql-proxy --port 5432 vibi-test-394606:asia-south1:test-db` -6. Change url in team-monitor-website in .env.local - `NEXTAUTH_URL=https://example.ngrok-free.app` -7. Start team-monitor-website - `npm run dev` +6. Change url in vibinex-server in .env.local - `NEXTAUTH_URL=https://example.ngrok-free.app` +7. Start vibinex-server - `npm run dev` 8. Build vibi-dpu, go to vibi-dpu/vibi-dpu and run - `cargo build` 9. Go up to the root directory of vibi-dpu - `cd ../` 10. **Build the Docker image**: In the root directory of the project, run the following command to build a Docker image with the name "dpu". @@ -50,4 +50,4 @@ We welcome contributions from the community! Please read our contributing guidel ## License -This project is licensed under the terms of the GNU-GPLv3. \ No newline at end of file +This project is licensed under the terms of the GNU-GPLv3. From bd7cf822c64617d23137aa202d4ff50cee6411d6 Mon Sep 17 00:00:00 2001 From: Tapish Rathore Date: Thu, 16 Nov 2023 18:20:52 +0530 Subject: [PATCH 3/3] fix git diff command with 3 dots, like git diff numstat --- vibi-dpu/src/utils/gitops.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vibi-dpu/src/utils/gitops.rs b/vibi-dpu/src/utils/gitops.rs index 6f33b2eb..4187d878 100644 --- a/vibi-dpu/src/utils/gitops.rs +++ b/vibi-dpu/src/utils/gitops.rs @@ -223,8 +223,8 @@ pub fn generate_diff(review: &Review, smallfiles: &Vec) -> HashMap