Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 --changed throws No such file or directory when file is deleted #4952

Open
1 task done
Loskir opened this issue Jan 23, 2025 · 4 comments
Open
1 task done

🐛 --changed throws No such file or directory when file is deleted #4952

Loskir opened this issue Jan 23, 2025 · 4 comments
Assignees
Labels
A-CLI Area: CLI good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Loskir
Copy link

Loskir commented Jan 23, 2025

Environment information

CLI:
  Version:                      1.9.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v18.17.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/9.6.7"

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. git checkout main
  2. echo "const a=1" > test.ts
  3. git commit -m "1"
  4. git checkout -b test
  5. echo "const a=2" > test.ts
  6. git commit -m "2"
  7. mv test.ts test2.ts
  8. npx biome check --changed
test.ts internalError/io  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ No such file or directory (os error 2)
  
  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.

Expected result

Should not show an error

I get that --changed is supposed to be used in CI, but it can also be useful locally, e.g. for precommit checks. Probably it should treat uncommited local changes the same way as commits

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Loskir Loskir added the S-Needs triage Status: this issue needs to be triaged label Jan 23, 2025
@ematipico
Copy link
Member

ematipico commented Jan 23, 2025

I get that --changed is supposed to be used in CI, but it can also be useful locally

For local usage, you're supposed to use the check command, with the --staged option. There's a reason why ci is meant for CI environments, it isn't meant to be used locally as it does different assumptions that could result in unexpected behaviours, like this one.

@Loskir
Copy link
Author

Loskir commented Jan 23, 2025

I'm referring to the help text for biome check:

--changed             When set to true, only the files that have been changed compared to
                              your `defaultBranch` configuration will be linted. This option should
                              be used in CI environments.

@ematipico
Copy link
Member

AAAAAAAAHHHH! 😱

It shouldn't be there, that's a bug. --changed doesn't check staged files, so it fails locally. Using --staged should work

@ematipico ematipico added good first issue Good for newcomers A-CLI Area: CLI S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jan 23, 2025
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Jan 23, 2025
@manojks1999
Copy link

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI good first issue Good for newcomers S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

3 participants