Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpp-linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ thiserror = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }

[dependencies.git-bot-feedback]
version = "0.5.6"
version = "0.6.1"
features = ["file-changes"]
# path = "../../git-bot-feedback"
# git = "https://github.com/2bndy5/git-bot-feedback"
Expand Down
2 changes: 0 additions & 2 deletions cpp-linter/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ mod test {
use std::{
env::{self, current_dir, set_current_dir},
fs,
path::PathBuf,
process::Command,
};

Expand Down Expand Up @@ -104,7 +103,6 @@ mod test {
&LinesChangedOnly::Off.into(),
&base_diff,
ignore_staged,
&PathBuf::from("."),
)
.await
.unwrap()
Expand Down
12 changes: 2 additions & 10 deletions cpp-linter/src/rest_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::{
env,
path::{Path, PathBuf},
path::PathBuf,
sync::{Arc, Mutex},
};

Expand Down Expand Up @@ -69,7 +69,6 @@ impl RestClient {
lines_changed_only: &LinesChangedOnly,
base_diff: &Option<String>,
ignore_index: bool,
repo_root: &Path,
) -> Result<Vec<FileObj>, ClientError> {
let files = self
.client
Expand All @@ -89,14 +88,7 @@ impl RestClient {
.map(|hunk| hunk.start..=hunk.end)
.collect();
let file_path = PathBuf::from(file_name);
FileObj::from(
file_path
.strip_prefix(repo_root)
.map(PathBuf::from)
.unwrap_or(file_path),
diff_lines.added_lines.clone(),
diff_chunks,
)
FileObj::from(file_path, diff_lines.added_lines.clone(), diff_chunks)
})
.collect())
}
Expand Down
13 changes: 3 additions & 10 deletions cpp-linter/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
.collect::<Vec<&str>>(),
None,
);
file_filter.parse_submodules();
let gitmodules = cli.source_options.repo_root.join(".gitmodules");
file_filter.parse_submodules(Some(gitmodules.as_path()));
if let Some(files) = &cli.not_ignored {
file_filter.not_ignored.extend(files.clone());
}
Expand All @@ -101,7 +102,6 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
}

rest_api_client.start_log_group("Get list of specified source files");
let repo_root_path = PathBuf::from(&cli.source_options.repo_root);
let files = if !matches!(cli.source_options.lines_changed_only, LinesChangedOnly::Off)
|| cli.source_options.files_changed_only
{
Expand All @@ -112,7 +112,6 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
&cli.source_options.lines_changed_only.clone().into(),
&cli.source_options.diff_base,
cli.source_options.ignore_index,
&repo_root_path,
)
.await?
} else {
Expand All @@ -122,12 +121,7 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
.into_iter()
.map(|file_name| {
let file_path = PathBuf::from(&file_name);
FileObj::new(
file_path
.strip_prefix(&repo_root_path)
.map(PathBuf::from)
.unwrap_or(file_path),
)
FileObj::new(file_path)
})
.collect();
if is_pr && (cli.feedback_options.tidy_review || cli.feedback_options.format_review) {
Expand All @@ -137,7 +131,6 @@ pub async fn run_main(args: Vec<String>) -> Result<()> {
&LinesChangedOnly::Off.into(),
&cli.source_options.diff_base,
cli.source_options.ignore_index,
&repo_root_path,
)
.await?;
for changed_file in changed_files {
Expand Down
8 changes: 1 addition & 7 deletions cpp-linter/tests/paginated_changed_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,7 @@ async fn get_paginated_changes(lib_root: &Path, tmp_dir: &TempDir, test_params:

let file_filter = FileFilter::new(&[], &["cpp", "hpp"], None);
let files = client
.get_list_of_changed_files(
&file_filter,
&LinesChangedOnly::Off,
&None::<String>,
false,
tmp_dir.path(),
)
.get_list_of_changed_files(&file_filter, &LinesChangedOnly::Off, &None::<String>, false)
.await;
match files {
Err(e) => {
Expand Down
Loading