Skip to content

Commit ef45056

Browse files
authored
chore: remove errors logs (#7819)
1 parent 303eec0 commit ef45056

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

.changeset/gentle-ears-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed [#7788](https://github.com/biomejs/biome/issues/7788). Removes some error logging that were emitted when loading possible configuration files.

crates/biome_fs/src/fs.rs

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::panic::RefUnwindSafe;
1111
use std::path::Path;
1212
use std::sync::Arc;
1313
use std::{fmt, io};
14-
use tracing::{error, info};
14+
use tracing::info;
1515

1616
mod memory;
1717
mod os;
@@ -143,26 +143,33 @@ pub trait FileSystem: Send + Sync + RefUnwindSafe {
143143
) -> Option<AutoSearchResult> {
144144
let mut current_search_dir = search_dir.to_path_buf();
145145
let mut is_searching_in_parent_dir = false;
146-
147146
loop {
148147
// Iterate all possible file names
149148
for file_name in search_files {
150149
let file_path = current_search_dir.join(file_name);
151-
if let Ok(content) = self.read_file_from_path(&file_path) {
152-
if !predicate(&file_path, &content) {
153-
break;
150+
match self.read_file_from_path(&file_path) {
151+
Ok(content) => {
152+
if !predicate(&file_path, &content) {
153+
break;
154+
}
155+
if is_searching_in_parent_dir {
156+
info!(
157+
"Biome auto discovered the file at the following path that isn't in the working directory:\n{:?}",
158+
current_search_dir
159+
);
160+
}
161+
return Some(AutoSearchResult {
162+
content,
163+
file_path,
164+
directory_path: current_search_dir,
165+
});
154166
}
155-
if is_searching_in_parent_dir {
167+
Err(_) => {
156168
info!(
157-
"Biome auto discovered the file at the following path that isn't in the working directory:\n{:?}",
158-
current_search_dir
169+
"Couldn't find the configuration file at {}.",
170+
file_path.as_str()
159171
);
160172
}
161-
return Some(AutoSearchResult {
162-
content,
163-
file_path,
164-
directory_path: current_search_dir,
165-
});
166173
}
167174
}
168175

@@ -191,32 +198,20 @@ pub trait FileSystem: Send + Sync + RefUnwindSafe {
191198
let mut content = String::new();
192199
match file.read_to_string(&mut content) {
193200
Ok(_) => Ok(content),
194-
Err(err) => {
195-
error!(
196-
"Biome couldn't read the file {:?}, reason:\n{:?}",
197-
file_path, err
198-
);
199-
Err(FileSystemDiagnostic {
200-
path: file_path.to_string(),
201-
severity: Severity::Error,
202-
error_kind: FsErrorKind::CantReadFile,
203-
source: Some(Error::from(IoError::from(err))),
204-
})
205-
}
201+
Err(err) => Err(FileSystemDiagnostic {
202+
path: file_path.to_string(),
203+
severity: Severity::Error,
204+
error_kind: FsErrorKind::CantReadFile,
205+
source: Some(Error::from(IoError::from(err))),
206+
}),
206207
}
207208
}
208-
Err(err) => {
209-
error!(
210-
"Biome couldn't open the file {:?}, reason:\n{:?}",
211-
file_path, err
212-
);
213-
Err(FileSystemDiagnostic {
214-
path: file_path.to_string(),
215-
severity: Severity::Error,
216-
error_kind: FsErrorKind::CantReadFile,
217-
source: Some(Error::from(IoError::from(err))),
218-
})
219-
}
209+
Err(err) => Err(FileSystemDiagnostic {
210+
path: file_path.to_string(),
211+
severity: Severity::Error,
212+
error_kind: FsErrorKind::CantReadFile,
213+
source: Some(Error::from(IoError::from(err))),
214+
}),
220215
}
221216
}
222217

0 commit comments

Comments
 (0)