biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
15.19k stars 473 forks source link

🐛 `--changed` doesn't work when run on the base branch even if `--no-errors-on-unmatched` is enabled #1774

Closed antogyn closed 8 months ago

antogyn commented 8 months ago

Environment information

CLI:
  Version:                      1.5.3-nightly.24fcf19
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.14.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/1.22.19"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

  1. Set your defaultBranch to master
  2. Run git checkout master
  3. Run biome check --changed --no-errors-on-unmatched --files-ignore-unknown=true .

Alternatively

  1. Just run biome check --changed --no-errors-on-unmatched --since=head .

It shows this error:

internalError/io ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ No files were processed in the specified paths.

Expected result

It should not return an error

Code of Conduct

ematipico commented 8 months ago

Can you share a small repository with so we can replicate the issue?

antogyn commented 8 months ago

https://github.com/antogyn/biome-issue-1774

Same issue with 1.5.3 instead of 1.5.3-nightly.24fcf19 (which I needed because of a recent fix)

I think you can simply run this command on any project with git integration enabled to trigger the error:

biome check --changed --no-errors-on-unmatched --since=head .

Edit: in case it's useful

git -v
# git version 2.39.3 (Apple Git-145)
antogyn commented 8 months ago

Taking a glance at the code, it seems the error is triggered here:

https://github.com/biomejs/biome/blob/main/crates/biome_cli/src/changed.rs#L28

My suggestion would to simply drop this check, since the --no-errors-on-unmatched flag is handled later in execute_mode

ematipico commented 8 months ago

Yeah, that seems about right. Do you want to send a PR?

antogyn commented 8 months ago

I'm a Rust noob but I'll give it a shot

ematipico commented 8 months ago

I'm a Rust noob but I'll give it a shot

No worries! Let's start by deleting the lines and doing a draft PR. Then I will help you :)

antogyn commented 8 months ago

Can you give me pointers on tests? It looks like the change doesn't break any, and I'm not sure where to start

ray-peters commented 8 months ago

Hey team, any update on this front? ~Is there anything we can do to help move this along?~ I'm seeing helpful commentary on antogyn's PR.

Just integrated biome into our ci/cd pipeline and running into the same issue as reported above.

ematipico commented 8 months ago

You'll get the fix in the next release v1.6. If you require the fix ASAP, I can publish a nightly tomorrow

ray-peters commented 8 months ago

@ematipico Thank you for jumping on this issue. A nightly release would be really great, thank you!