Open pcarinhas opened 1 week ago
Also, running with -v:
:/tmp/junk]: rye lint --fix -v
[2024-10-13][15:42:25][ruff::resolve][DEBUG] Using Ruff default settings
[2024-10-13][15:42:25][ignore::walk][DEBUG] ignoring /tmp/junk/.venv: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/tmp/junk/.gitignore"), original: ".venv", actual: "**/.venv", is_whitelist: false, is_only_dir: false })))
[2024-10-13][15:42:25][ruff_workspace::resolver][DEBUG] Ignored path via `exclude`: "/tmp/junk/.ruff_cache"
[2024-10-13][15:42:25][ruff_workspace::resolver][DEBUG] Included path via `include`: "/tmp/junk/src/junk/__init__.py"
[2024-10-13][15:42:25][ruff_workspace::resolver][DEBUG] Included path via `include`: "/tmp/junk/pyproject.toml"
[2024-10-13][15:42:25][ruff_workspace::resolver][DEBUG] Ignored path via `exclude`: "/tmp/junk/.git"
[2024-10-13][15:42:25][ruff::commands::check][DEBUG] Identified files to lint in: 5.755612ms
[2024-10-13][15:42:25][ruff::diagnostics][DEBUG] Checking: /tmp/junk/src/junk/__init__.py
[2024-10-13][15:42:25][ruff::diagnostics][DEBUG] Checking: /tmp/junk/pyproject.toml
[2024-10-13][15:42:25][ruff_linter::rules::isort::categorize][DEBUG] Categorized 'pytz' as Known(ThirdParty) (NoMatch)
[2024-10-13][15:42:25][ruff::commands::check][DEBUG] Checked 2 files in: 371.453µs
src/junk/__init__.py:1:8: F401 `pytz` imported but unused
|
1 | import pytz
| ^^^^ F401
2 |
3 | def hello() -> str:
|
= help: Remove unused import: `pytz`
Found 1 error.
I tried using ruff directly from the .rye distribution and it also fails. So this may be a ruff issue:
~/.rye/self/bin]: ./ruff check --fix --fixable "F401" /tmp/junk/
/tmp/junk/src/junk/__init__.py:1:8: F401 `goodies` imported but unused
|
1 | import goodies
| ^^^^^^^ F401
|
= help: Remove unused import: `goodies`
Found 1 error.
This also fails if I remove the --fixable option too.
This is probably by design; fixes for F401
in __init__.py
files are unsafe.
Steps to Reproduce
Expected Result
Rye should both:
Actual Result
and
Version Info
:/tmp/junk]: rye --version rye 0.41.0 commit: 0.41.0 (10d691d16 2024-09-29) platform: linux (x86_64) self-python: cpython@3.12.6 symlink support: true uv enabled: true
Stacktrace
No response