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
5 changes: 5 additions & 0 deletions .changeset/gentle-ears-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@biomejs/biome": patch
---

Fixed [#7788](https://github.com/biomejs/biome/issues/7788). Removes some error logging that were emitted when loading possible configuration files.
69 changes: 32 additions & 37 deletions crates/biome_fs/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::panic::RefUnwindSafe;
use std::path::Path;
use std::sync::Arc;
use std::{fmt, io};
use tracing::{error, info};
use tracing::info;

mod memory;
mod os;
Expand Down Expand Up @@ -143,26 +143,33 @@ pub trait FileSystem: Send + Sync + RefUnwindSafe {
) -> Option<AutoSearchResult> {
let mut current_search_dir = search_dir.to_path_buf();
let mut is_searching_in_parent_dir = false;

loop {
// Iterate all possible file names
for file_name in search_files {
let file_path = current_search_dir.join(file_name);
if let Ok(content) = self.read_file_from_path(&file_path) {
if !predicate(&file_path, &content) {
break;
match self.read_file_from_path(&file_path) {
Ok(content) => {
if !predicate(&file_path, &content) {
break;
}
if is_searching_in_parent_dir {
info!(
"Biome auto discovered the file at the following path that isn't in the working directory:\n{:?}",
current_search_dir
);
}
return Some(AutoSearchResult {
content,
file_path,
directory_path: current_search_dir,
});
}
if is_searching_in_parent_dir {
Err(_) => {
info!(
"Biome auto discovered the file at the following path that isn't in the working directory:\n{:?}",
current_search_dir
"Couldn't find the configuration file at {}.",
file_path.as_str()
);
}
return Some(AutoSearchResult {
content,
file_path,
directory_path: current_search_dir,
});
}
}

Expand Down Expand Up @@ -191,32 +198,20 @@ pub trait FileSystem: Send + Sync + RefUnwindSafe {
let mut content = String::new();
match file.read_to_string(&mut content) {
Ok(_) => Ok(content),
Err(err) => {
error!(
"Biome couldn't read the file {:?}, reason:\n{:?}",
file_path, err
);
Err(FileSystemDiagnostic {
path: file_path.to_string(),
severity: Severity::Error,
error_kind: FsErrorKind::CantReadFile,
source: Some(Error::from(IoError::from(err))),
})
}
Err(err) => Err(FileSystemDiagnostic {
path: file_path.to_string(),
severity: Severity::Error,
error_kind: FsErrorKind::CantReadFile,
source: Some(Error::from(IoError::from(err))),
}),
}
}
Err(err) => {
error!(
"Biome couldn't open the file {:?}, reason:\n{:?}",
file_path, err
);
Err(FileSystemDiagnostic {
path: file_path.to_string(),
severity: Severity::Error,
error_kind: FsErrorKind::CantReadFile,
source: Some(Error::from(IoError::from(err))),
})
}
Err(err) => Err(FileSystemDiagnostic {
path: file_path.to_string(),
severity: Severity::Error,
error_kind: FsErrorKind::CantReadFile,
source: Some(Error::from(IoError::from(err))),
}),
}
}

Expand Down
Loading