-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Handle io errors gracefully #5611
Conversation
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
c16ac31
to
b87738a
Compare
let source_file = SourceFileBuilder::new(path.to_string_lossy(), contents).finish(); | ||
lint_pyproject_toml(source_file, &settings.lib)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these not already treated as IOError
via the IOError
handling in run.rs
? Like this block:
error!(
"{}{}{} {message}",
"Failed to lint ".bold(),
fs::relativize_path(path).bold(),
":".bold()
);
let settings = resolver.resolve(path, pyproject_config);
if settings.rules.enabled(Rule::IOError) {
let file =
SourceFileBuilder::new(path.to_string_lossy().as_ref(), "").finish();
Diagnostics::new(
vec![Message::from_diagnostic(
Diagnostic::new(IOError { message }, TextRange::default()),
file,
TextSize::default(),
)],
ImportMap::default(),
)
} else {
Diagnostics::default()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, do we not lose that warning message that appears separately from the diagnostics?
98b2871
to
a9ea03b
Compare
a9ea03b
to
75b33f6
Compare
the diagnostics now check whether |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `0.0.278` -> `0.0.280` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.280`](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280) ### [`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279) <!-- Release notes generated using configuration in .github/release.yml at v0.0.279 --> #### What's Changed ##### Rules - \[`flake8-pyi`] Implement flake8-pyi's PYI026 by [@​LaBatata101](https://togithub.com/LaBatata101) in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) - \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/5895](https://togithub.com/astral-sh/ruff/pull/5895) - \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5668](https://togithub.com/astral-sh/ruff/pull/5668) - \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5722](https://togithub.com/astral-sh/ruff/pull/5722) - \[`flake8-use-pathlib`] Implement `os-path-getsize` and `os-path-get(a|m|c)-time` (`PTH202-205`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5835](https://togithub.com/astral-sh/ruff/pull/5835) - \[`flake8-use-pathlib`] Implement `path-constructor-default-argument` (`PTH201`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5833](https://togithub.com/astral-sh/ruff/pull/5833) - \[`pandas-vet`] Implement constant series rule (`PD101`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5802](https://togithub.com/astral-sh/ruff/pull/5802) - \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5193](https://togithub.com/astral-sh/ruff/pull/5193) ##### Rule changes - \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5601](https://togithub.com/astral-sh/ruff/pull/5601) - \[`flake8-bugbear`] Add autofix for B004 by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5788](https://togithub.com/astral-sh/ruff/pull/5788) - \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5751](https://togithub.com/astral-sh/ruff/pull/5751) - \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5935](https://togithub.com/astral-sh/ruff/pull/5935) - \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5766](https://togithub.com/astral-sh/ruff/pull/5766) - \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5725](https://togithub.com/astral-sh/ruff/pull/5725) - \[`ruff`] Expand `RUF015` to include all expression types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5767](https://togithub.com/astral-sh/ruff/pull/5767) ##### Bug Fixes - Consider single element subscript expr for implicit optional by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5717](https://togithub.com/astral-sh/ruff/pull/5717) - Ignore `Enum`-and-`str` subclasses for slots enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5749](https://togithub.com/astral-sh/ruff/pull/5749) - Avoid removing raw strings in comparison fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5755](https://togithub.com/astral-sh/ruff/pull/5755) - Fix nested calls to `sorted` with differing arguments by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5761](https://togithub.com/astral-sh/ruff/pull/5761) - Use unused variable detection to power `incorrect-dict-iterator` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5763](https://togithub.com/astral-sh/ruff/pull/5763) - Include alias when formatting import-from structs by [@​guillaumeLepape](https://togithub.com/guillaumeLepape) in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - Make `lint_only` aware of the source kind by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5876](https://togithub.com/astral-sh/ruff/pull/5876) - Restore `redefined-while-unused` violations in classes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5926](https://togithub.com/astral-sh/ruff/pull/5926) - Flatten nested tuples when fixing UP007 violations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5724](https://togithub.com/astral-sh/ruff/pull/5724) - Ignore Jupyter Notebooks for `--add-noqa` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5727](https://togithub.com/astral-sh/ruff/pull/5727) - Avoid checking `EXE001` and `EXE002` on WSL by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5735](https://togithub.com/astral-sh/ruff/pull/5735) - Properly group assignment targets by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/astral-sh/ruff/pull/5728](https://togithub.com/astral-sh/ruff/pull/5728) - Avoid stack overflow for non-BitOr binary types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5743](https://togithub.com/astral-sh/ruff/pull/5743) - Move function visit out of `Expr::Call` branches by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5772](https://togithub.com/astral-sh/ruff/pull/5772) - \[B006] Add bytes to immutable types by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5776](https://togithub.com/astral-sh/ruff/pull/5776) - Format `SetComp` by [@​lkh42t](https://togithub.com/lkh42t) in [https://github.com/astral-sh/ruff/pull/5774](https://togithub.com/astral-sh/ruff/pull/5774) - Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled flag by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5789](https://togithub.com/astral-sh/ruff/pull/5789) - perf: only compute start offset for overlong lines by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5811](https://togithub.com/astral-sh/ruff/pull/5811) - Change `pandas-use-of-dot-read-table` rule to emit only when `read_table` is used on CSV data by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5807](https://togithub.com/astral-sh/ruff/pull/5807) - Do not fix `NamedTuple` calls containing both a list of fields and keywords by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5799](https://togithub.com/astral-sh/ruff/pull/5799) - Ignore directories when collecting files to lint by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5775](https://togithub.com/astral-sh/ruff/pull/5775) - Add filename to `noqa` warnings by [@​sobolevn](https://togithub.com/sobolevn) in [https://github.com/astral-sh/ruff/pull/5856](https://togithub.com/astral-sh/ruff/pull/5856) - Handle io errors gracefully by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/5611](https://togithub.com/astral-sh/ruff/pull/5611) - Allow `respect_gitignore` when not in a git repo by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5937](https://togithub.com/astral-sh/ruff/pull/5937) #### New Contributors - [@​eggplants](https://togithub.com/eggplants) made their first contribution in [https://github.com/astral-sh/ruff/pull/5741](https://togithub.com/astral-sh/ruff/pull/5741) - [@​guillaumeLepape](https://togithub.com/guillaumeLepape) made their first contribution in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - [@​odiseo0](https://togithub.com/odiseo0) made their first contribution in [https://github.com/astral-sh/ruff/pull/5888](https://togithub.com/astral-sh/ruff/pull/5888) - [@​DavidCain](https://togithub.com/DavidCain) made their first contribution in [https://github.com/astral-sh/ruff/pull/5889](https://togithub.com/astral-sh/ruff/pull/5889) - [@​LaBatata101](https://togithub.com/LaBatata101) made their first contribution in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) **Full Changelog**: astral-sh/ruff@v0.0.278...v0.0.279 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/jankatins/pr-workflow-example). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.278` -> `==0.0.280` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.280`](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280) ### [`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279) <!-- Release notes generated using configuration in .github/release.yml at v0.0.279 --> #### What's Changed ##### Rules - \[`flake8-pyi`] Implement flake8-pyi's PYI026 by [@​LaBatata101](https://togithub.com/LaBatata101) in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) - \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/5895](https://togithub.com/astral-sh/ruff/pull/5895) - \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5668](https://togithub.com/astral-sh/ruff/pull/5668) - \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5722](https://togithub.com/astral-sh/ruff/pull/5722) - \[`flake8-use-pathlib`] Implement `os-path-getsize` and `os-path-get(a|m|c)-time` (`PTH202-205`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5835](https://togithub.com/astral-sh/ruff/pull/5835) - \[`flake8-use-pathlib`] Implement `path-constructor-default-argument` (`PTH201`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5833](https://togithub.com/astral-sh/ruff/pull/5833) - \[`pandas-vet`] Implement constant series rule (`PD101`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5802](https://togithub.com/astral-sh/ruff/pull/5802) - \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5193](https://togithub.com/astral-sh/ruff/pull/5193) ##### Rule changes - \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5601](https://togithub.com/astral-sh/ruff/pull/5601) - \[`flake8-bugbear`] Add autofix for B004 by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5788](https://togithub.com/astral-sh/ruff/pull/5788) - \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5751](https://togithub.com/astral-sh/ruff/pull/5751) - \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5935](https://togithub.com/astral-sh/ruff/pull/5935) - \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5766](https://togithub.com/astral-sh/ruff/pull/5766) - \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5725](https://togithub.com/astral-sh/ruff/pull/5725) - \[`ruff`] Expand `RUF015` to include all expression types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5767](https://togithub.com/astral-sh/ruff/pull/5767) ##### Bug Fixes - Consider single element subscript expr for implicit optional by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5717](https://togithub.com/astral-sh/ruff/pull/5717) - Ignore `Enum`-and-`str` subclasses for slots enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5749](https://togithub.com/astral-sh/ruff/pull/5749) - Avoid removing raw strings in comparison fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5755](https://togithub.com/astral-sh/ruff/pull/5755) - Fix nested calls to `sorted` with differing arguments by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5761](https://togithub.com/astral-sh/ruff/pull/5761) - Use unused variable detection to power `incorrect-dict-iterator` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5763](https://togithub.com/astral-sh/ruff/pull/5763) - Include alias when formatting import-from structs by [@​guillaumeLepape](https://togithub.com/guillaumeLepape) in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - Make `lint_only` aware of the source kind by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5876](https://togithub.com/astral-sh/ruff/pull/5876) - Restore `redefined-while-unused` violations in classes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5926](https://togithub.com/astral-sh/ruff/pull/5926) - Flatten nested tuples when fixing UP007 violations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5724](https://togithub.com/astral-sh/ruff/pull/5724) - Ignore Jupyter Notebooks for `--add-noqa` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5727](https://togithub.com/astral-sh/ruff/pull/5727) - Avoid checking `EXE001` and `EXE002` on WSL by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5735](https://togithub.com/astral-sh/ruff/pull/5735) - Properly group assignment targets by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/astral-sh/ruff/pull/5728](https://togithub.com/astral-sh/ruff/pull/5728) - Avoid stack overflow for non-BitOr binary types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5743](https://togithub.com/astral-sh/ruff/pull/5743) - Move function visit out of `Expr::Call` branches by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5772](https://togithub.com/astral-sh/ruff/pull/5772) - \[B006] Add bytes to immutable types by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5776](https://togithub.com/astral-sh/ruff/pull/5776) - Format `SetComp` by [@​lkh42t](https://togithub.com/lkh42t) in [https://github.com/astral-sh/ruff/pull/5774](https://togithub.com/astral-sh/ruff/pull/5774) - Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled flag by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5789](https://togithub.com/astral-sh/ruff/pull/5789) - perf: only compute start offset for overlong lines by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5811](https://togithub.com/astral-sh/ruff/pull/5811) - Change `pandas-use-of-dot-read-table` rule to emit only when `read_table` is used on CSV data by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5807](https://togithub.com/astral-sh/ruff/pull/5807) - Do not fix `NamedTuple` calls containing both a list of fields and keywords by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5799](https://togithub.com/astral-sh/ruff/pull/5799) - Ignore directories when collecting files to lint by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5775](https://togithub.com/astral-sh/ruff/pull/5775) - Add filename to `noqa` warnings by [@​sobolevn](https://togithub.com/sobolevn) in [https://github.com/astral-sh/ruff/pull/5856](https://togithub.com/astral-sh/ruff/pull/5856) - Handle io errors gracefully by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/5611](https://togithub.com/astral-sh/ruff/pull/5611) - Allow `respect_gitignore` when not in a git repo by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5937](https://togithub.com/astral-sh/ruff/pull/5937) #### New Contributors - [@​eggplants](https://togithub.com/eggplants) made their first contribution in [https://github.com/astral-sh/ruff/pull/5741](https://togithub.com/astral-sh/ruff/pull/5741) - [@​guillaumeLepape](https://togithub.com/guillaumeLepape) made their first contribution in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - [@​odiseo0](https://togithub.com/odiseo0) made their first contribution in [https://github.com/astral-sh/ruff/pull/5888](https://togithub.com/astral-sh/ruff/pull/5888) - [@​DavidCain](https://togithub.com/DavidCain) made their first contribution in [https://github.com/astral-sh/ruff/pull/5889](https://togithub.com/astral-sh/ruff/pull/5889) - [@​LaBatata101](https://togithub.com/LaBatata101) made their first contribution in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) **Full Changelog**: astral-sh/ruff@v0.0.278...v0.0.279 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/pyrainbird). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.278` -> `==0.0.280` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.278/0.0.280?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.280`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.280) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.279...v0.0.280) <!-- Release notes generated using configuration in .github/release.yml at v0.0.280 --> #### What's Changed ##### Bug Fixes - Avoid collapsing `elif` and `else` branches during import sorting by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5964](https://togithub.com/astral-sh/ruff/pull/5964) **Full Changelog**: astral-sh/ruff@v0.0.279...v0.0.280 ### [`v0.0.279`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.279) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.278...v0.0.279) <!-- Release notes generated using configuration in .github/release.yml at v0.0.279 --> #### What's Changed ##### Rules - \[`flake8-pyi`] Implement flake8-pyi's PYI026 by [@​LaBatata101](https://togithub.com/LaBatata101) in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) - \[`flake8-pyi`] Implement flake8-pyi's `PYI017` by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/5895](https://togithub.com/astral-sh/ruff/pull/5895) - \[`flake8-pyi`] Implement flake8-pyi's `PYI036` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5668](https://togithub.com/astral-sh/ruff/pull/5668) - \[`flake8-pyi`] Implement flake8-pyi's `PYI041` by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5722](https://togithub.com/astral-sh/ruff/pull/5722) - \[`flake8-use-pathlib`] Implement `os-path-getsize` and `os-path-get(a|m|c)-time` (`PTH202-205`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5835](https://togithub.com/astral-sh/ruff/pull/5835) - \[`flake8-use-pathlib`] Implement `path-constructor-default-argument` (`PTH201`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5833](https://togithub.com/astral-sh/ruff/pull/5833) - \[`pandas-vet`] Implement constant series rule (`PD101`) by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5802](https://togithub.com/astral-sh/ruff/pull/5802) - \[`pylint`] Implement Pylint's `consider-using-in` (`PLR1714`) by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5193](https://togithub.com/astral-sh/ruff/pull/5193) ##### Rule changes - \[`flake8-annotations`] Check for `Any` in other types for `ANN401` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5601](https://togithub.com/astral-sh/ruff/pull/5601) - \[`flake8-bugbear`] Add autofix for B004 by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5788](https://togithub.com/astral-sh/ruff/pull/5788) - \[`flake8-bugbear`] Remove `B904`'s lowercase exemption by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5751](https://togithub.com/astral-sh/ruff/pull/5751) - \[`flake8-use-pathlib`] extend PTH118 with `os.sep` by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5935](https://togithub.com/astral-sh/ruff/pull/5935) - \[`pyupgrade`] Expand scope of `quoted-annotation` rule (`UP037`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5766](https://togithub.com/astral-sh/ruff/pull/5766) - \[`pyupgrade`] Extend PEP 604 rewrites to support some quoted annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5725](https://togithub.com/astral-sh/ruff/pull/5725) - \[`ruff`] Expand `RUF015` to include all expression types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5767](https://togithub.com/astral-sh/ruff/pull/5767) ##### Bug Fixes - Consider single element subscript expr for implicit optional by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5717](https://togithub.com/astral-sh/ruff/pull/5717) - Ignore `Enum`-and-`str` subclasses for slots enforcement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5749](https://togithub.com/astral-sh/ruff/pull/5749) - Avoid removing raw strings in comparison fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5755](https://togithub.com/astral-sh/ruff/pull/5755) - Fix nested calls to `sorted` with differing arguments by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/5761](https://togithub.com/astral-sh/ruff/pull/5761) - Use unused variable detection to power `incorrect-dict-iterator` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5763](https://togithub.com/astral-sh/ruff/pull/5763) - Include alias when formatting import-from structs by [@​guillaumeLepape](https://togithub.com/guillaumeLepape) in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - Make `lint_only` aware of the source kind by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5876](https://togithub.com/astral-sh/ruff/pull/5876) - Restore `redefined-while-unused` violations in classes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5926](https://togithub.com/astral-sh/ruff/pull/5926) - Flatten nested tuples when fixing UP007 violations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5724](https://togithub.com/astral-sh/ruff/pull/5724) - Ignore Jupyter Notebooks for `--add-noqa` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5727](https://togithub.com/astral-sh/ruff/pull/5727) - Avoid checking `EXE001` and `EXE002` on WSL by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5735](https://togithub.com/astral-sh/ruff/pull/5735) - Properly group assignment targets by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/astral-sh/ruff/pull/5728](https://togithub.com/astral-sh/ruff/pull/5728) - Avoid stack overflow for non-BitOr binary types by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5743](https://togithub.com/astral-sh/ruff/pull/5743) - Move function visit out of `Expr::Call` branches by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5772](https://togithub.com/astral-sh/ruff/pull/5772) - \[B006] Add bytes to immutable types by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5776](https://togithub.com/astral-sh/ruff/pull/5776) - Format `SetComp` by [@​lkh42t](https://togithub.com/lkh42t) in [https://github.com/astral-sh/ruff/pull/5774](https://togithub.com/astral-sh/ruff/pull/5774) - Gate `runtime-import-in-type-checking-block` (`TCH004`) behind enabled flag by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/5789](https://togithub.com/astral-sh/ruff/pull/5789) - perf: only compute start offset for overlong lines by [@​sbrugman](https://togithub.com/sbrugman) in [https://github.com/astral-sh/ruff/pull/5811](https://togithub.com/astral-sh/ruff/pull/5811) - Change `pandas-use-of-dot-read-table` rule to emit only when `read_table` is used on CSV data by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/5807](https://togithub.com/astral-sh/ruff/pull/5807) - Do not fix `NamedTuple` calls containing both a list of fields and keywords by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5799](https://togithub.com/astral-sh/ruff/pull/5799) - Ignore directories when collecting files to lint by [@​harupy](https://togithub.com/harupy) in [https://github.com/astral-sh/ruff/pull/5775](https://togithub.com/astral-sh/ruff/pull/5775) - Add filename to `noqa` warnings by [@​sobolevn](https://togithub.com/sobolevn) in [https://github.com/astral-sh/ruff/pull/5856](https://togithub.com/astral-sh/ruff/pull/5856) - Handle io errors gracefully by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/5611](https://togithub.com/astral-sh/ruff/pull/5611) - Allow `respect_gitignore` when not in a git repo by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/5937](https://togithub.com/astral-sh/ruff/pull/5937) #### New Contributors - [@​eggplants](https://togithub.com/eggplants) made their first contribution in [https://github.com/astral-sh/ruff/pull/5741](https://togithub.com/astral-sh/ruff/pull/5741) - [@​guillaumeLepape](https://togithub.com/guillaumeLepape) made their first contribution in [https://github.com/astral-sh/ruff/pull/5786](https://togithub.com/astral-sh/ruff/pull/5786) - [@​odiseo0](https://togithub.com/odiseo0) made their first contribution in [https://github.com/astral-sh/ruff/pull/5888](https://togithub.com/astral-sh/ruff/pull/5888) - [@​DavidCain](https://togithub.com/DavidCain) made their first contribution in [https://github.com/astral-sh/ruff/pull/5889](https://togithub.com/astral-sh/ruff/pull/5889) - [@​LaBatata101](https://togithub.com/LaBatata101) made their first contribution in [https://github.com/astral-sh/ruff/pull/5844](https://togithub.com/astral-sh/ruff/pull/5844) **Full Changelog**: astral-sh/ruff@v0.0.278...v0.0.279 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Summary
It can happen that we can't read a file (a python file, a jupyter notebook or pyproject.toml), which needs to be handled and handled consistently for all file types. Instead of using
Err
orerror!
, we emit E602 with the io error as message and continue. This PR makes sure we handle all three cases consistently, emit E602.I'm not convinced that it should be possible to disable io errors, but we now handle the regular case consistently and at least print warning consistently.
I went with
warn!
but i can change them all toerror!
, too.It also checks the error case when a pyproject.toml is not readable. The error message is not very helpful, but it's now a bit clearer that actually ruff itself failed instead vs this being a diagnostic.
Examples
This is how an Err of
run
looks now:With an unreadable file and
IOError
disabled:(we lint zero files but count files before linting not during so we exit 0)
I'm not sure if it should (or if we should take a different path with manual ExitStatus), but this currently also triggers when
files
is empty:Test Plan
Unix only: Create a temporary directory with files with permissions
000
(not readable by the owner) and run on that directory. Since this breaks the assumptions of most of the test code (single file,ruff
instead ofruff_cli
), the test code is rather cumbersome and looks a bit misplaced; i'm happy about suggestions to fit it in closer with the other tests or streamline it in other ways. I added another test for when the entire directory is not readable.