Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
| let kind = if path.is_dir() { | ||
| FileKinds::Directory | ||
| } else { | ||
| path.file_name().map(Self::priority).unwrap_or_default() | ||
| }; |
There was a problem hiding this comment.
This is introduced in 4309234, but it seems not used. Utf8Path::is_dir() requires an I/O syscall, that is relatively heavy when it's called many times.
There was a problem hiding this comment.
I've been bothered by that one for a while, and wished to remove it too. Glad you did!
| let ignore_directory = if gitignore.path().is_file() { | ||
| // SAFETY: if it's a file, it always has a parent | ||
| gitignore.path().parent().unwrap() | ||
| } else { | ||
| gitignore.path() | ||
| }; |
There was a problem hiding this comment.
Based on doc comments, gitignore.path() is always a directory path where contains the .gitignore file.
There was a problem hiding this comment.
I hope you're right 😅 This may be something @ematipico can say better than I can.
There was a problem hiding this comment.
It's a good change. I initially added this because I didn't understand completely how the library works. But now we always store folders, so this piece of code can go away
| Vec::new() | ||
| }, | ||
| }); | ||
| let (diagnostics, errors, skipped_diagnostics) = if categories.is_lint() |
There was a problem hiding this comment.
format_with_guard() calls Workspace::pull_diagnostics to collect parse diagnostics, but it also lead calling lint(), which is not necessary and takes some time.
431fbd6 to
420fdcf
Compare
| i Example of suppression: // biome-ignore lint: reason | ||
|
|
||
|
|
||
| ``` |
There was a problem hiding this comment.
This was duplicated diagnostic!
CodSpeed Performance ReportMerging #7122 will not alter performanceComparing Summary
Footnotes |
arendjr
left a comment
There was a problem hiding this comment.
LGTM, but I would recommend to check the gitignore thing with Ema.
| i Example of suppression: // biome-ignore lint: reason | ||
|
|
||
|
|
||
| ``` |
| let kind = if path.is_dir() { | ||
| FileKinds::Directory | ||
| } else { | ||
| path.file_name().map(Self::priority).unwrap_or_default() | ||
| }; |
There was a problem hiding this comment.
I've been bothered by that one for a while, and wished to remove it too. Glad you did!
| let ignore_directory = if gitignore.path().is_file() { | ||
| // SAFETY: if it's a file, it always has a parent | ||
| gitignore.path().parent().unwrap() | ||
| } else { | ||
| gitignore.path() | ||
| }; |
There was a problem hiding this comment.
I hope you're right 😅 This may be something @ematipico can say better than I can.
| let (diagnostics, errors, skipped_diagnostics) = if (categories.is_lint() | ||
| || categories.is_assist()) |
There was a problem hiding this comment.
When do we call pull_diagnostics() when the category is not either lint or assist? I suppose this change is what fixed the duplicate diagnostic, so it seems a good change, but I'm curious at why this works...
There was a problem hiding this comment.
@arendjr format_with_guard() calls pull_diagnostics() with RuleCategories::Syntax.
biome/crates/biome_cli/src/execute/process_file/format.rs
Lines 37 to 45 in b9642ab
There was a problem hiding this comment.
Can you add a test that tries to format a code that violates a syntax rule? Ideally it shouldn't format it, and it should emit the diagnostic
Summary
Performed some minor performance tweaks.
In my private repo, this reduced ~700ms of the execution time.
Test Plan
N/A
Docs
N/A