Skip to content

Conversation

@damienallen
Copy link
Contributor

Fixes: #1953

@charliermarsh thank you for the tips in the issue.

I'm not very familiar with Rust, so please excuse if my string formatting syntax is messy.

In terms of testing, I compared output of flake8 --format=pylint and cargo run --format=pylint on the same code and the output syntax seems to check out.

charliermarsh and others added 3 commits January 19, 2023 07:40
@charliermarsh charliermarsh merged commit 6ddfe50 into astral-sh:main Jan 19, 2023
@charliermarsh
Copy link
Member

Looks great, thank you for putting this together!

(GitLab CI code quality report).
(machine-readable), `"junit"` (machine-readable XML), `"github"` (GitHub
Actions annotations), `"gitlab"` (GitLab CI code quality report), or
`"pylint"` (Pylint text format).
Copy link
Member

Choose a reason for hiding this comment

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

Just for the future: all these references are auto-generated from the documentation, so this needed to be changed in src/settings/options.rs (followed by an invocation of cargo dev generate-all).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good to know!

// See: https://flake8.pycqa.org/en/latest/internal/formatters.html#pylint-formatter
for message in &diagnostics.messages {
let label = format!(
"{}:{}: [{}] {}",
Copy link
Member

Choose a reason for hiding this comment

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

Tweaked this to put some of the plain-text characters in the format string directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was unsure about this but this is more what I would expect.

@damienallen
Copy link
Contributor Author

Looks great, thank you for putting this together!

Cheers, thanks for the merge!

renovate bot referenced this pull request in ixm-one/pytest-cmake-presets Jan 20, 2023
[![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://togithub.com/charliermarsh/ruff) | `^0.0.226` ->
`^0.0.227` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.227/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.227/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.227/compatibility-slim/0.0.226)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.227/confidence-slim/0.0.226)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.227`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.227)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.226...v0.0.227)

#### What's Changed

- Drop `RuleCode` in favor of `Rule` enum with human-friendly names by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/1941](https://togithub.com/charliermarsh/ruff/pull/1941)
- Make define_rule_mapping! set rule code as doc comment of variants by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/1991](https://togithub.com/charliermarsh/ruff/pull/1991)
- Added pylint formatter by
[@&#8203;damienallen](https://togithub.com/damienallen) in
[https://github.com/charliermarsh/ruff/pull/1995](https://togithub.com/charliermarsh/ruff/pull/1995)
- Preserve unmatched comparators in `SIM109` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/1998](https://togithub.com/charliermarsh/ruff/pull/1998)
- Drop `Violation::placeholder` by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/1996](https://togithub.com/charliermarsh/ruff/pull/1996)
- Apply #\[derive(Default)] fixes suggested by Clippy by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/2000](https://togithub.com/charliermarsh/ruff/pull/2000)
- Avoid `SIM201` and `SIM202` errors in `__ne__` et al by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2001](https://togithub.com/charliermarsh/ruff/pull/2001)
- Fix that --explain panics by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/2002](https://togithub.com/charliermarsh/ruff/pull/2002)
- Split up pydocstyle rules by [@&#8203;akx](https://togithub.com/akx)
in
[https://github.com/charliermarsh/ruff/pull/2003](https://togithub.com/charliermarsh/ruff/pull/2003)
- Add RUF005 "unpack instead of concatenating" check by
[@&#8203;akx](https://togithub.com/akx) in
[https://github.com/charliermarsh/ruff/pull/1957](https://togithub.com/charliermarsh/ruff/pull/1957)
- Enable autofix for `FitsOnOneLine` (`D200`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2006](https://togithub.com/charliermarsh/ruff/pull/2006)
- Change AsRef<str> impl for Rule to kebab-case by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/2009](https://togithub.com/charliermarsh/ruff/pull/2009)
- Upgrade RustPython by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2011](https://togithub.com/charliermarsh/ruff/pull/2011)
- Avoid SIM401 in `elif` blocks by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2012](https://togithub.com/charliermarsh/ruff/pull/2012)
- Improve --explain output by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/2010](https://togithub.com/charliermarsh/ruff/pull/2010)
- Avoid checking row types for single-name
[@&#8203;parametrize](https://togithub.com/parametrize) decorators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2013](https://togithub.com/charliermarsh/ruff/pull/2013)

#### New Contributors

- [@&#8203;damienallen](https://togithub.com/damienallen) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/1995](https://togithub.com/charliermarsh/ruff/pull/1995)

**Full Changelog**:
astral-sh/ruff@v0.0.226...v0.0.227

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, 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://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDUuNCIsInVwZGF0ZWRJblZlciI6IjM0LjEwNS40In0=-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
ntBre added a commit that referenced this pull request Jul 14, 2025
Summary
--

This is a very simple output format, the only decision is what to do if the file
is missing from the diagnostic. For now, I opted to `unwrap_or_default` both the
path and the `OneIndexed` row number, giving `:1: main diagnostic message` in
the test without a file.

Another quirk here is that the path is relativized. I just pasted in the
`relativize_path` and `get_cwd` implementations from `ruff_linter::fs` for now,
but maybe there's a better place for them.

I didn't see any details about why this needs to be relativized in the original
[issue](#1953),
[PR](#1995), or in the pylint
[docs](https://flake8.pycqa.org/en/latest/internal/formatters.html#pylint-formatter),
but it did change the results of the CLI integration test when I tried deleting
it. I haven't been able to reproduce that in the CLI, though, so it may only
happen with `Command::current_dir`.

Test Plan
--

Tests ported from `ruff_linter` and a new test for the case with no file
ntBre added a commit that referenced this pull request Jul 14, 2025
Summary
--

This is a very simple output format, the only decision is what to do if the file
is missing from the diagnostic. For now, I opted to `unwrap_or_default` both the
path and the `OneIndexed` row number, giving `:1: main diagnostic message` in
the test without a file.

Another quirk here is that the path is relativized. I just pasted in the
`relativize_path` and `get_cwd` implementations from `ruff_linter::fs` for now,
but maybe there's a better place for them.

I didn't see any details about why this needs to be relativized in the original
[issue](#1953),
[PR](#1995), or in the pylint
[docs](https://flake8.pycqa.org/en/latest/internal/formatters.html#pylint-formatter),
but it did change the results of the CLI integration test when I tried deleting
it. I haven't been able to reproduce that in the CLI, though, so it may only
happen with `Command::current_dir`.

Test Plan
--

Tests ported from `ruff_linter` and a new test for the case with no file
ntBre added a commit that referenced this pull request Jul 15, 2025
Summary
--

This is a very simple output format, the only decision is what to do if
the file
is missing from the diagnostic. For now, I opted to `unwrap_or_default`
both the
path and the `OneIndexed` row number, giving `:1: main diagnostic
message` in
the test without a file.

Another quirk here is that the path is relativized. I just pasted in the
`relativize_path` and `get_cwd` implementations from `ruff_linter::fs`
for now,
but maybe there's a better place for them.

I didn't see any details about why this needs to be relativized in the
original
[issue](#1953),
[PR](#1995), or in the pylint

[docs](https://flake8.pycqa.org/en/latest/internal/formatters.html#pylint-formatter),
but it did change the results of the CLI integration test when I tried
deleting
it. I haven't been able to reproduce that in the CLI, though, so it may
only
happen with `Command::current_dir`.

Test Plan
--

Tests ported from `ruff_linter` and a new test for the case with no file

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for pylint format

3 participants