Skip to content

fix(cli): skip includes check for stdin file path#8446

Closed
tt-a1i wants to merge 2 commits intobiomejs:mainfrom
tt-a1i:fix/stdin-file-path-includes
Closed

fix(cli): skip includes check for stdin file path#8446
tt-a1i wants to merge 2 commits intobiomejs:mainfrom
tt-a1i:fix/stdin-file-path-includes

Conversation

@tt-a1i
Copy link
Contributor

@tt-a1i tt-a1i commented Dec 14, 2025

Summary

Fix --stdin-file-path being blocked by includes configuration. Stdin input now bypasses all path-based ignore checks, since the path is only used for language detection and the content is explicitly provided by the user.

Details

When using --stdin-file-path, the path should not participate in ignore checks:

  • files.includes patterns
  • formatter.includes / linter.includes patterns
  • VCS ignore patterns

Changes

  • Add is_stdin flag to SupportsFeatureParams
  • Skip all path-based ignore checks in get_file_features when is_stdin=true
  • Update std_in.rs to set is_stdin: true

Test plan

  • Run existing stdin tests (cargo test -p biome_cli format_stdin)
  • Add new test format_stdin_ignores_includes_pattern that verifies stdin bypasses includes check

Fixes #6783

@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2025

🦋 Changeset detected

Latest commit: e81a35a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Formatter Area: formatter A-LSP Area: language server protocol labels Dec 14, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 14, 2025

Walkthrough

This change adds an is_stdin: bool flag to workspace/service parameter structs and call sites. get_file_features gains an is_stdin parameter and, when true, skips path-based include/ignore and VCS-ignore checks (while still using the stdin path for language detection). CLI, LSP, formatter test, and workspace server call sites are updated to pass the flag. A test verifies stdin formatting ignores configured files.includes patterns.

Possibly related PRs

Suggested labels

A-Core

Suggested reviewers

  • ematipico
  • dyc3
  • siketyan

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: skipping includes checks for stdin file paths, which is the core fix implemented across all modified files.
Description check ✅ Passed The description clearly relates to the changeset, explaining the fix for stdin path blocking by includes configuration and detailing implementation approach.
Linked Issues check ✅ Passed The PR successfully addresses issue #6783 by adding is_stdin flag to SupportsFeatureParams, skipping path-based ignore checks for stdin, and including a regression test.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the stdin bypass fix: adding is_stdin field, propagating it through call sites, conditionally skipping checks, and testing.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
crates/biome_service/src/projects.rs (1)

235-251: Correct implementation of stdin bypass logic.

The two conditional blocks properly skip includes checks when is_stdin is true, whilst still respecting protected file checks. The protected file check at lines 259-261 is intentionally not bypassed, which is correct — even stdin content shouldn't bypass protected file restrictions.

Minor: The comment "Skip includes check for stdin - path is only used for language detection" appears on both line 238 and 241. Consider consolidating with a single comment before line 235 if you prefer, though the current clarity is also fine:

+        // Skip includes check for stdin - path is only used for language detection
         } else if !is_stdin
             && self.is_ignored(fs, project_key, path, features, IgnoreKind::Ancestors)
         {
-            // Skip includes check for stdin - path is only used for language detection
             file_features.set_ignored_for_all_features();
         } else if !is_stdin {
-            // Skip includes check for stdin - path is only used for language detection
             for feature in features.iter() {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a392c06 and 21490b6.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/tests/snapshots/main_commands_format/format_stdin_ignores_includes_pattern.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (12)
  • .changeset/fix-stdin-file-path-includes.md (1 hunks)
  • crates/biome_cli/src/execute/process_file.rs (1 hunks)
  • crates/biome_cli/src/execute/std_in.rs (2 hunks)
  • crates/biome_cli/src/execute/traverse.rs (1 hunks)
  • crates/biome_cli/tests/commands/format.rs (1 hunks)
  • crates/biome_formatter_test/src/spec.rs (1 hunks)
  • crates/biome_lsp/src/handlers/analysis.rs (2 hunks)
  • crates/biome_lsp/src/handlers/formatting.rs (3 hunks)
  • crates/biome_lsp/src/session.rs (1 hunks)
  • crates/biome_service/src/projects.rs (2 hunks)
  • crates/biome_service/src/workspace.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
crates/**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Files:

  • crates/biome_cli/src/execute/std_in.rs
  • crates/biome_service/src/projects.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_cli/src/execute/traverse.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_lsp/src/handlers/formatting.rs
crates/biome_service/src/workspace*.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Files:

  • crates/biome_service/src/workspace.rs
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Write changesets that are concise (1-3 sentences), user-focused, use past tense for actions taken and present tense for Biome behavior, include code examples for rules, and end sentences with periods

Files:

  • .changeset/fix-stdin-file-path-includes.md
crates/biome_service/src/workspace/server.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Files:

  • crates/biome_service/src/workspace/server.rs
🧠 Learnings (36)
📓 Common learnings
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
📚 Learning: 2025-12-12T10:11:05.549Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-12T10:11:05.549Z
Learning: Applies to crates/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Applied to files:

  • crates/biome_cli/src/execute/std_in.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging

Applied to files:

  • crates/biome_cli/src/execute/std_in.rs
  • crates/biome_service/src/projects.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/src/execute/traverse.rs
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope

Applied to files:

  • crates/biome_service/src/projects.rs
  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Applied to files:

  • crates/biome_service/src/projects.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_cli/src/execute/traverse.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_lsp/src/session.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`

Applied to files:

  • crates/biome_service/src/projects.rs
  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_cli/src/execute/traverse.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Create test infrastructure with `tests/specs` folder structure and `spec_test.rs`, `spec_tests.rs`, and `language.rs` files in test directories

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits

Applied to files:

  • crates/biome_formatter_test/src/spec.rs
  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Applied to files:

  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Use WorkspaceWatcher to keep workspace state in sync with the filesystem, and only activate it in daemon mode

Applied to files:

  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/client.rs : Use WorkspaceClient implementation for creating connections to the daemon and communicating with WorkspaceServer

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-12-12T10:11:05.549Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-12T10:11:05.549Z
Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in root `Cargo.toml` for internal crates with `workspace = true`, and use path dependencies for `dev-dependencies` to avoid requiring published versions

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Use quick testing via `tests/quick_test.rs` by removing the `#[ignore]` macro and modifying the `SOURCE` variable to rapidly validate rule behavior during development

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Code actions must specify a `fix_kind` field in the `declare_lint_rule!` macro as either `FixKind::Safe` or `FixKind::Unsafe` to indicate whether fixes always preserve program behavior

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions

Applied to files:

  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)

Applied to files:

  • crates/biome_lsp/src/handlers/formatting.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding

Applied to files:

  • crates/biome_lsp/src/handlers/formatting.rs
🧬 Code graph analysis (1)
crates/biome_service/src/projects.rs (1)
crates/biome_service/src/workspace/server.rs (3)
  • fs (2112-2114)
  • fs (2200-2202)
  • file_features (1152-1175)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (16)
crates/biome_cli/src/execute/process_file.rs (1)

139-139: Correct usage for filesystem processing.

Setting is_stdin: false is appropriate here as process_file handles actual filesystem paths, not stdin input.

.changeset/fix-stdin-file-path-includes.md (1)

1-5: Clear and accurate changeset.

The description correctly explains that --stdin-file-path is now used solely for language detection and stdin content bypasses includes matching.

crates/biome_lsp/src/handlers/analysis.rs (2)

81-81: Correct for LSP code actions.

LSP code actions operate on actual documents, so is_stdin: false is appropriate.


319-319: Consistent with LSP context.

Fix-all operations also work with real documents, correctly using is_stdin: false.

crates/biome_cli/src/execute/std_in.rs (2)

48-48: Essential change for stdin formatting.

Correctly sets is_stdin: true when processing stdin input, allowing format operations to bypass includes checks as intended by the fix.


130-130: Consistent stdin handling for check/lint.

Properly propagates is_stdin: true for check and lint operations on stdin input, maintaining consistency with format mode.

crates/biome_formatter_test/src/spec.rs (1)

73-73: Appropriate for test fixtures.

Test specifications process actual files from the test suite, so is_stdin: false is correct.

crates/biome_lsp/src/session.rs (1)

425-425: Correct for LSP document diagnostics.

LSP session handles actual workspace documents, appropriately using is_stdin: false.

crates/biome_cli/tests/commands/format.rs (1)

1296-1340: Excellent regression test.

This test properly validates that stdin formatting bypasses includes checks. The setup (config with includes: ["apps/**"] and stdin path mock.js) directly reproduces the issue from #6783, and the assertions confirm the fix works correctly.

crates/biome_lsp/src/handlers/formatting.rs (3)

41-41: Correct for LSP document formatting.

LSP format handler operates on actual documents, appropriately using is_stdin: false.


111-111: Consistent for range formatting.

Range formatting also works with real documents, correctly using is_stdin: false.


204-204: Appropriate for on-type formatting.

On-type formatting handles actual documents, properly using is_stdin: false.

crates/biome_cli/src/execute/traverse.rs (1)

579-579: LGTM!

Correctly passes is_stdin: false for filesystem traversal.

crates/biome_service/src/workspace.rs (1)

119-122: LGTM!

Well-documented field addition with proper default handling for backward compatibility.

crates/biome_service/src/workspace/server.rs (1)

1173-1173: LGTM!

Correctly forwards the is_stdin flag to the project-level feature query.

crates/biome_service/src/projects.rs (1)

210-210: LGTM!

Signature updated correctly to accept the is_stdin flag.

@tt-a1i tt-a1i force-pushed the fix/stdin-file-path-includes branch from 5a1aedb to 7b8299f Compare December 14, 2025 03:53
When using `--stdin-file-path`, the path should only be used for
language detection, not for path matching. Stdin content is explicitly
provided by the user, so it should bypass:

- `files.includes` patterns
- `formatter.includes` / `linter.includes` patterns
- VCS ignore patterns

Add `is_stdin` flag to `SupportsFeatureParams`. When set, skip all
path-based ignore checks in `get_file_features`.

Fixes biomejs#6783
@tt-a1i tt-a1i force-pushed the fix/stdin-file-path-includes branch from 7b8299f to 05f786e Compare December 14, 2025 03:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/biome_service/src/projects.rs (1)

201-254: Clarify the comment wording in the !is_stdin branches—it reads backwards.

At lines 239–241, the comment "Skip ignore checks for stdin…" sits inside the !is_stdin && is_ignored(...) branch, which is confusing; it should say "Non-stdin paths still respect ignore checks" instead. Similarly, line 245–246 should be reworded to "Non-stdin paths respect feature-level ignores" for clarity.

The protected-file concern (whether is_protected_file should apply to synthetic stdin paths) is a valid design question worth confirming with the team, but I cannot find where that logic is enforced in the current code flow.

🧹 Nitpick comments (1)
crates/biome_cli/tests/commands/format.rs (1)

1296-1340: Nice regression test; consider also covering files.includes (and maybe VCS ignore) for stdin.

This one proves formatter.includes is bypassed for --stdin-file-path, which matches the intent. To fully pin the bug class down, I’d add a sibling test for top-level "files": { "includes": [...] } (and optionally a .gitignore case), since the PR now skips those too.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21490b6 and e81a35a.

⛔ Files ignored due to path filters (2)
  • crates/biome_cli/tests/snapshots/main_commands_format/format_stdin_ignores_includes_pattern.snap is excluded by !**/*.snap and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
📒 Files selected for processing (12)
  • .changeset/fix-stdin-file-path-includes.md (1 hunks)
  • crates/biome_cli/src/execute/process_file.rs (1 hunks)
  • crates/biome_cli/src/execute/std_in.rs (2 hunks)
  • crates/biome_cli/src/execute/traverse.rs (1 hunks)
  • crates/biome_cli/tests/commands/format.rs (1 hunks)
  • crates/biome_formatter_test/src/spec.rs (1 hunks)
  • crates/biome_lsp/src/handlers/analysis.rs (2 hunks)
  • crates/biome_lsp/src/handlers/formatting.rs (3 hunks)
  • crates/biome_lsp/src/session.rs (1 hunks)
  • crates/biome_service/src/projects.rs (3 hunks)
  • crates/biome_service/src/workspace.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_cli/src/execute/std_in.rs
  • crates/biome_lsp/src/session.rs
  • .changeset/fix-stdin-file-path-includes.md
  • crates/biome_lsp/src/handlers/formatting.rs
  • crates/biome_cli/src/execute/process_file.rs
  • crates/biome_formatter_test/src/spec.rs
🧰 Additional context used
📓 Path-based instructions (2)
crates/**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Files:

  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/projects.rs
  • crates/biome_cli/src/execute/traverse.rs
crates/biome_service/src/workspace/server.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Files:

  • crates/biome_service/src/workspace/server.rs
🧠 Learnings (21)
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Use quick testing via `tests/quick_test.rs` by removing the `#[ignore]` macro and modifying the `SOURCE` variable to rapidly validate rule behavior during development

Applied to files:

  • crates/biome_cli/tests/commands/format.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Applied to files:

  • crates/biome_service/src/workspace/server.rs
  • crates/biome_service/src/projects.rs
  • crates/biome_cli/src/execute/traverse.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Use WorkspaceWatcher to keep workspace state in sync with the filesystem, and only activate it in daemon mode

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging

Applied to files:

  • crates/biome_service/src/projects.rs
  • crates/biome_cli/src/execute/traverse.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-12-12T10:11:05.549Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-12T10:11:05.549Z
Learning: Applies to crates/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style

Applied to files:

  • crates/biome_service/src/projects.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization

Applied to files:

  • crates/biome_service/src/projects.rs
🧬 Code graph analysis (2)
crates/biome_cli/tests/commands/format.rs (2)
crates/biome_test_utils/src/lib.rs (1)
  • markup_to_string (319-327)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_cli_snapshot (407-409)
crates/biome_service/src/projects.rs (1)
crates/biome_service/src/workspace/server.rs (3)
  • fs (2112-2114)
  • fs (2200-2202)
  • file_features (1152-1175)
🔇 Additional comments (2)
crates/biome_cli/src/execute/traverse.rs (1)

575-580: Good: explicit is_stdin: false for regular traversal.

Keeps the new stdin bypass scoped to actual stdin flows only.

crates/biome_service/src/workspace/server.rs (1)

1152-1175: LGTM: is_stdin is correctly plumbed into Projects::get_file_features.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. You're basically restoring the behaviour of v1, which we don't want at the moment.

Stdin is also used by editor extensions that don't support LSP, and in those cases the files.includes check is vital.

If we want to bypass the check, it must be done in a different way. Maybe let's continue the discussion on the issue.

@ematipico ematipico closed this Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Formatter Area: formatter A-LSP Area: language server protocol A-Project Area: project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: biome format with --stdin-file-path fails if includes is missing the value in --stdin-file-path.

2 participants