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

Line break within function declaration disables exclusion of the function body #684

Closed
fuine opened this issue Jul 20, 2018 · 11 comments · Fixed by #1705
Closed

Line break within function declaration disables exclusion of the function body #684

fuine opened this issue Jul 20, 2018 · 11 comments · Fixed by #1705
Labels
bug Something isn't working exclude

Comments

@fuine
Copy link

fuine commented Jul 20, 2018

.coveragerc file:

[report]
exclude_lines =
    long_function_name.+

Code:

def long_function_name(some_long_argument,  another_long_argument):
    pass

This setup works and results in the following report:

Name      Stmts   Miss  Cover   Missing
---------------------------------------
file.py       0      0   100%

However, if a line break is introduced between arguments and the second line gets indented in compliance to the PEP-8:

def long_function_name(some_long_argument,
                       another_long_argument):
    pass

Then the body isn't excluded anymore:

Name      Stmts   Miss  Cover   Missing
---------------------------------------
file.py       1      1     0%   4

I'm not really sure if this is a bug, but I haven't found a way to bypass this behaviour - I would like the whole function excluded, regardless of the formatting of function arguments. Is this possible?

@nedbat
Copy link
Owner

nedbat commented Dec 31, 2018

Hmm, there is logic in coverage.py to make multi-line statements act as a single unit. I'll need to look into why that isn't happening in this case.

Can you tell me more about your actual code and configuration? Why exclude functions based on their name?

@tailaiw
Copy link

tailaiw commented Feb 25, 2020

I ran into exactly the same issue. So we have an update on it? Thanks!

I'm using python3.8, coverage 5.0.3, pytest 5.3.5, and pytest-cov 2.8.1.

Here is my main.py code

def my_func(
    super_long_input_argument_0=0,
    super_long_input_argument_1=1,
    super_long_input_argument_2=2):
    pass

def my_func_2(super_long_input_argument_0=0, super_long_input_argument_1=1, super_long_input_argument_2=2):
    pass

def test_main():
    assert 1 == 1

Here is my .coveragerc

[report]
show_missing = True
exclude_lines =
    def my_func
    def my_func_2

And here is the output running pytest main.py --cov=.

platform linux -- Python 3.8.1, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: blablabla
plugins: cov-2.8.1
collected 1 item                                                                                                                                                                            

main.py .                                                                                                                                                                             [100%]

----------- coverage: platform linux, python 3.8.1-final-0 -----------
Name      Stmts   Miss  Cover   Missing
---------------------------------------
main.py       3      1    67%   5

@FateScript
Copy link

Gently ask, any progress of this issue?
I work around this problem by using ast module and expect a more elegent way, thanks.

@nedbat
Copy link
Owner

nedbat commented Aug 29, 2023

@FateScript Thanks for chiming in. Can you say more about how you are using the ast module?

@FateScript
Copy link

@FateScript Thanks for chiming in. Can you say more about how you are using the ast module?

@nedbat My idea is simple, if a function like

def long_function_name(some_long_argument,
                       another_long_argument):
    # python code here

is marked as executed, the lineno of def long_function_name(some_long_argument, will be recorded.
I get the lineno and determine if it's a definition of function, and if it is, my target is to parse a function like

def long_function_name(some_long_argument,
                       another_long_argument):
    pass

Here is a sketch of my code:

def complete_definition(code: List[str], executed_lineno: int) -> List[int]:
    src_code = code[executed_lineno-1]  # -1 because lineno starts from 1
    select_lineno = [executed_lineno]
    if is_function_def(src_code):
        func_suffix = (count_blank_prefix(src_code) + 4) * " " + "pass"  # indent length is 4 here
        while True:
            if pass_ast_parse(src_code + func_suffix):
                break
            # add next line of code
            executed_lineno += 1
            select_lineno.add(executed_lineno)
            src_code = src_code + "\n" + code[executed_lineno-1]
    return select_lineno

The method might not be perfect but somehow fix my issue.
May it help someone.

@nedbat
Copy link
Owner

nedbat commented Aug 31, 2023

One solution to this is to use pragma comments instead of omit settings:

def my_func(
    super_long_input_argument_0=0,
    super_long_input_argument_1=1,
    super_long_input_argument_2=2):     # pragma: no cover
    pass

You'll need to be sure your exclude_lines setting still includes "pragma: no cover", or use the newer [report] exclude_also setting for your custom exclusions:

[report]
show_missing = True
exclude_also =
    def my_func
    def my_func_2

@FateScript
Copy link

FateScript commented Sep 1, 2023

@nedbat Thanks for your solution : )
However, I'm writing a tracing tools with coveragepy to trace code execution in packages like pytorch or langchain, so I couldn't modify the source code of those packages and I'm not sure which function will be executed.

@nedbat
Copy link
Owner

nedbat commented Sep 1, 2023

@FateScript this gets more and more interesting! Can you say more about why you want to omit certain functions within pytorch/langchain?

@FateScript
Copy link

@nedbat The tracing tool will show users what code is executed for a specific function. However, when import a package likeimport torch, it will introduce some functions that might to omit and only a small part of code is needed.
For example, if someone wonder what code is executed when running

x = MyModule()
x(1)

The tracing tool will show something like the following

filename: path to torch.nn.module

class Module():
    def __init__(self, xxx):
        # code of init
    def __call__(self, xxx):
        # code of init

In this case, class Module, __init__ , __call__ is executed when import torch and code of __init__, __call__ is executed when running my code. So I need to omit some function when import torch and I couldn't list them all before executing.
Looking forward to your suggestions or constructive ideas. Thanks : )

@altendky
Copy link

My use case, present in the example in #1691, is to exclude my benchmark tests since they are executed in a separate test run without coverage measurement. They all use a common pytest fixture so that would be what I try to exclude.

@nedbat
Copy link
Owner

nedbat commented Dec 14, 2023

This is now released as part of coverage 7.3.3.

renovate bot added a commit to allenporter/flux-local that referenced this issue Dec 16, 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 |
|---|---|---|---|---|---|
| [coverage](https://togithub.com/nedbat/coveragepy) | `==7.3.2` ->
`==7.3.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/coverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/coverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/coverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/coverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy (coverage)</summary>

###
[`v7.3.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-733--2023-12-14)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.3.2...7.3.3)

- Fix: function definitions with multi-line signatures can now be
excluded by
matching any of the lines, closing `issue 684`*. Thanks, `Jan Rusak,
    Maciej Kowalczyk and Joanna Ejzel <pull 1705_>`*.

- Fix: XML reports could fail with a TypeError if files had numeric
components
    that were duplicates except for leading zeroes, like `file1.py` and
    `file001.py`.  Fixes `issue 1709`\_.

- The `coverage annotate` command used to announce that it would be
removed
in a future version. Enough people got in touch to say that they use it,
so
it will stay. Don't expect it to keep up with other new features though.

-   Added new :ref:`debug options <cmd_run_debug>`:

    -   `pytest` writes the pytest test name into the debug output.

- `dataop2` writes the full data being added to CoverageData objects.

.. \_issue
684:[nedbat/coveragepy#684
.. \_pull
1705[nedbat/coveragepy#1705
.. \_issue
170[nedbat/coveragepy#1709

.. \_changes\_7-3-2:

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy45My4xIiwidXBkYXRlZEluVmVyIjoiMzcuOTMuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
lengau pushed a commit to canonical/craftcraft that referenced this issue Dec 19, 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 |
|---|---|---|---|---|---|
| [dev/coverage](https://togithub.com/nedbat/coveragepy) | `==7.3.2` ->
`==7.3.3` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/dev%2fcoverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/dev%2fcoverage/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/dev%2fcoverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/dev%2fcoverage/7.3.2/7.3.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [lint/black](https://togithub.com/psf/black)
([changelog](https://togithub.com/psf/black/blob/main/CHANGES.md)) |
`==23.11.0` -> `==23.12.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/lint%2fblack/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/lint%2fblack/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/lint%2fblack/23.11.0/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/lint%2fblack/23.11.0/23.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [lint/ruff](https://docs.astral.sh/ruff)
([source](https://togithub.com/astral-sh/ruff),
[changelog](https://togithub.com/astral-sh/ruff/blob/main/CHANGELOG.md))
| `==0.1.6` -> `==0.1.8` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/lint%2fruff/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/lint%2fruff/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/lint%2fruff/0.1.6/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/lint%2fruff/0.1.6/0.1.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [types/pyright](https://togithub.com/RobertCraigie/pyright-python) |
`==1.1.338` -> `==1.1.341` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/types%2fpyright/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/types%2fpyright/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/types%2fpyright/1.1.338/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/types%2fpyright/1.1.338/1.1.341?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>nedbat/coveragepy (dev/coverage)</summary>

###
[`v7.3.3`](https://togithub.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-733--2023-12-14)

[Compare
Source](https://togithub.com/nedbat/coveragepy/compare/7.3.2...7.3.3)

- Fix: function definitions with multi-line signatures can now be
excluded by
matching any of the lines, closing `issue 684`*. Thanks, `Jan Rusak,
    Maciej Kowalczyk and Joanna Ejzel <pull 1705_>`*.

- Fix: XML reports could fail with a TypeError if files had numeric
components
    that were duplicates except for leading zeroes, like `file1.py` and
    `file001.py`.  Fixes `issue 1709`\_.

- The `coverage annotate` command used to announce that it would be
removed
in a future version. Enough people got in touch to say that they use it,
so
it will stay. Don't expect it to keep up with other new features though.

-   Added new :ref:`debug options <cmd_run_debug>`:

    -   `pytest` writes the pytest test name into the debug output.

- `dataop2` writes the full data being added to CoverageData objects.

.. \_issue
684:[nedbat/coveragepy#684
.. \_pull
1705[nedbat/coveragepy#1705
.. \_issue
170[nedbat/coveragepy#1709

.. \_changes\_7-3-2:

</details>

<details>
<summary>psf/black (lint/black)</summary>

###
[`v23.12.0`](https://togithub.com/psf/black/blob/HEAD/CHANGES.md#23120)

[Compare
Source](https://togithub.com/psf/black/compare/23.11.0...23.12.0)

##### Highlights

It's almost 2024, which means it's time for a new edition of *Black*'s
stable style!
Together with this release, we'll put out an alpha release 24.1a1
showcasing the draft
2024 stable style, which we'll finalize in the January release. Please
try it out and
[share your feedback](https://togithub.com/psf/black/issues/4042).

This release (23.12.0) will still produce the 2023 style. Most but not
all of the
changes in `--preview` mode will be in the 2024 stable style.

##### Stable style

- Fix bug where `# fmt: off` automatically dedents when used with the
`--line-ranges`
option, even when it is not within the specified line range.
([#&#8203;4084](https://togithub.com/psf/black/issues/4084))
- Fix feature detection for parenthesized context managers
([#&#8203;4104](https://togithub.com/psf/black/issues/4104))

##### Preview style

- Prefer more equal signs before a break when splitting chained
assignments ([#&#8203;4010](https://togithub.com/psf/black/issues/4010))
- Standalone form feed characters at the module level are no longer
removed ([#&#8203;4021](https://togithub.com/psf/black/issues/4021))
- Additional cases of immediately nested tuples, lists, and dictionaries
are now
indented less
([#&#8203;4012](https://togithub.com/psf/black/issues/4012))
- Allow empty lines at the beginning of all blocks, except immediately
before a
docstring ([#&#8203;4060](https://togithub.com/psf/black/issues/4060))
- Fix crash in preview mode when using a short `--line-length`
([#&#8203;4086](https://togithub.com/psf/black/issues/4086))
- Keep suites consisting of only an ellipsis on their own lines if they
are not
functions or class definitions
([#&#8203;4066](https://togithub.com/psf/black/issues/4066))
([#&#8203;4103](https://togithub.com/psf/black/issues/4103))

##### Configuration

- `--line-ranges` now skips *Black*'s internal stability check in
`--safe` mode. This
avoids a crash on rare inputs that have many unformatted same-content
lines. ([#&#8203;4034](https://togithub.com/psf/black/issues/4034))

##### Packaging

- Upgrade to mypy 1.7.1
([#&#8203;4049](https://togithub.com/psf/black/issues/4049))
([#&#8203;4069](https://togithub.com/psf/black/issues/4069))
- Faster compiled wheels are now available for CPython 3.12
([#&#8203;4070](https://togithub.com/psf/black/issues/4070))

##### Integrations

- Enable 3.12 CI
([#&#8203;4035](https://togithub.com/psf/black/issues/4035))
- Build docker images in parallel
([#&#8203;4054](https://togithub.com/psf/black/issues/4054))
- Build docker images with 3.12
([#&#8203;4055](https://togithub.com/psf/black/issues/4055))

</details>

<details>
<summary>astral-sh/ruff (lint/ruff)</summary>

###
[`v0.1.8`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#018)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.1.7...v0.1.8)

This release includes opt-in support for formatting Python snippets
within
docstrings via the `docstring-code-format` setting.
[Check out the blog post](https://astral.sh/blog/ruff-v0.1.8) for more
details!

##### Preview features

- Add `"preserve"` quote-style to mimic Black's
skip-string-normalization
([#&#8203;8822](https://togithub.com/astral-sh/ruff/pull/8822))
- Implement `prefer_splitting_right_hand_side_of_assignments` preview
style ([#&#8203;8943](https://togithub.com/astral-sh/ruff/pull/8943))
- \[`pycodestyle`] Add fix for
`unexpected-spaces-around-keyword-parameter-equals`
([#&#8203;9072](https://togithub.com/astral-sh/ruff/pull/9072))
- \[`pycodestyle`] Add fix for comment-related whitespace rules
([#&#8203;9075](https://togithub.com/astral-sh/ruff/pull/9075))
- \[`pycodestyle`] Allow `sys.path` modifications between imports
([#&#8203;9047](https://togithub.com/astral-sh/ruff/pull/9047))
- \[`refurb`] Implement `hashlib-digest-hex` (`FURB181`)
([#&#8203;9077](https://togithub.com/astral-sh/ruff/pull/9077))

##### Rule changes

- Allow `flake8-type-checking` rules to automatically quote
runtime-evaluated references
([#&#8203;6001](https://togithub.com/astral-sh/ruff/pull/6001))
- Allow transparent cell magics in Jupyter Notebooks
([#&#8203;8911](https://togithub.com/astral-sh/ruff/pull/8911))
- \[`flake8-annotations`] Avoid `ANN2xx` fixes for abstract methods with
empty bodies
([#&#8203;9034](https://togithub.com/astral-sh/ruff/pull/9034))
- \[`flake8-self`] Ignore underscore references in type annotations
([#&#8203;9036](https://togithub.com/astral-sh/ruff/pull/9036))
- \[`pep8-naming`] Allow class names when `apps.get_model` is a
non-string
([#&#8203;9065](https://togithub.com/astral-sh/ruff/pull/9065))
- \[`pycodestyle`] Allow `matplotlib.use` calls to intersperse imports
([#&#8203;9094](https://togithub.com/astral-sh/ruff/pull/9094))
- \[`pyflakes`] Support fixing unused assignments in tuples by renaming
variables (`F841`)
([#&#8203;9107](https://togithub.com/astral-sh/ruff/pull/9107))
- \[`pylint`] Add fix for `subprocess-run-without-check` (`PLW1510`)
([#&#8203;6708](https://togithub.com/astral-sh/ruff/pull/6708))

##### Formatter

- Add `docstring-code-format` knob to enable docstring snippet
formatting
([#&#8203;8854](https://togithub.com/astral-sh/ruff/pull/8854))
- Use double quotes for all docstrings, including single-quoted
docstrings
([#&#8203;9020](https://togithub.com/astral-sh/ruff/pull/9020))
- Implement "dynamic" line width mode for docstring code formatting
([#&#8203;9098](https://togithub.com/astral-sh/ruff/pull/9098))
- Support reformatting Markdown code blocks
([#&#8203;9030](https://togithub.com/astral-sh/ruff/pull/9030))
- add support for formatting reStructuredText code snippets
([#&#8203;9003](https://togithub.com/astral-sh/ruff/pull/9003))
- Avoid trailing comma for single-argument with positional separator
([#&#8203;9076](https://togithub.com/astral-sh/ruff/pull/9076))
- Fix handling of trailing target comment
([#&#8203;9051](https://togithub.com/astral-sh/ruff/pull/9051))

##### CLI

- Hide unsafe fix suggestions when explicitly disabled
([#&#8203;9095](https://togithub.com/astral-sh/ruff/pull/9095))
- Add SARIF support to `--output-format`
([#&#8203;9078](https://togithub.com/astral-sh/ruff/pull/9078))

##### Bug fixes

- Apply unnecessary index rule prior to enumerate rewrite
([#&#8203;9012](https://togithub.com/astral-sh/ruff/pull/9012))
- \[`flake8-err-msg`] Allow `EM` fixes even if `msg` variable is defined
([#&#8203;9059](https://togithub.com/astral-sh/ruff/pull/9059))
- \[`flake8-pie`] Prevent keyword arguments duplication
([#&#8203;8450](https://togithub.com/astral-sh/ruff/pull/8450))
- \[`flake8-pie`] Respect trailing comma in `unnecessary-dict-kwargs`
(`PIE804`)
([#&#8203;9015](https://togithub.com/astral-sh/ruff/pull/9015))
- \[`flake8-raise`] Avoid removing parentheses on ctypes.WinError
([#&#8203;9027](https://togithub.com/astral-sh/ruff/pull/9027))
- \[`isort`] Avoid invalid combination of `force-sort-within-types` and
`lines-between-types`
([#&#8203;9041](https://togithub.com/astral-sh/ruff/pull/9041))
- \[`isort`] Ensure that from-style imports are always ordered first in
`__future__`
([#&#8203;9039](https://togithub.com/astral-sh/ruff/pull/9039))
- \[`pycodestyle`] Allow tab indentation before keyword
([#&#8203;9099](https://togithub.com/astral-sh/ruff/pull/9099))
- \[`pylint`] Ignore `@overrides` and `@overloads` for
`too-many-positional`
([#&#8203;9000](https://togithub.com/astral-sh/ruff/pull/9000))
- \[`pyupgrade`] Enable `printf-string-formatting` fix with comments on
right-hand side
([#&#8203;9037](https://togithub.com/astral-sh/ruff/pull/9037))
- \[`refurb`] Make `math-constant` (`FURB152`) rule more targeted
([#&#8203;9054](https://togithub.com/astral-sh/ruff/pull/9054))
- \[`refurb`] Support floating-point base in `redundant-log-base`
(`FURB163`)
([#&#8203;9100](https://togithub.com/astral-sh/ruff/pull/9100))
- \[`ruff`] Detect `unused-asyncio-dangling-task` (`RUF006`) on unused
assignments
([#&#8203;9060](https://togithub.com/astral-sh/ruff/pull/9060))

###
[`v0.1.7`](https://togithub.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#017)

[Compare
Source](https://togithub.com/astral-sh/ruff/compare/v0.1.6...v0.1.7)

##### Preview features

- Implement multiline dictionary and list hugging for preview style
([#&#8203;8293](https://togithub.com/astral-sh/ruff/pull/8293))
- Implement the `fix_power_op_line_length` preview style
([#&#8203;8947](https://togithub.com/astral-sh/ruff/pull/8947))
- Use Python version to determine typing rewrite safety
([#&#8203;8919](https://togithub.com/astral-sh/ruff/pull/8919))
- \[`flake8-annotations`] Enable auto-return-type involving `Optional`
and `Union` annotations
([#&#8203;8885](https://togithub.com/astral-sh/ruff/pull/8885))
- \[`flake8-bandit`] Implement `django-raw-sql` (`S611`)
([#&#8203;8651](https://togithub.com/astral-sh/ruff/pull/8651))
- \[`flake8-bandit`] Implement `tarfile-unsafe-members` (`S202`)
([#&#8203;8829](https://togithub.com/astral-sh/ruff/pull/8829))
- \[`flake8-pyi`] Implement fix for `unnecessary-literal-union`
(`PYI030`)
([#&#8203;7934](https://togithub.com/astral-sh/ruff/pull/7934))
- \[`flake8-simplify`] Extend `dict-get-with-none-default` (`SIM910`) to
non-literals
([#&#8203;8762](https://togithub.com/astral-sh/ruff/pull/8762))
- \[`pylint`] - add `unnecessary-list-index-lookup` (`PLR1736`) +
autofix ([#&#8203;7999](https://togithub.com/astral-sh/ruff/pull/7999))
- \[`pylint`] - implement R0202 and R0203 with autofixes
([#&#8203;8335](https://togithub.com/astral-sh/ruff/pull/8335))
- \[`pylint`] Implement `repeated-keyword` (`PLe1132`)
([#&#8203;8706](https://togithub.com/astral-sh/ruff/pull/8706))
- \[`pylint`] Implement `too-many-positional` (`PLR0917`)
([#&#8203;8995](https://togithub.com/astral-sh/ruff/pull/8995))
- \[`pylint`] Implement `unnecessary-dict-index-lookup` (`PLR1733`)
([#&#8203;8036](https://togithub.com/astral-sh/ruff/pull/8036))
- \[`refurb`] Implement `redundant-log-base` (`FURB163`)
([#&#8203;8842](https://togithub.com/astral-sh/ruff/pull/8842))

##### Rule changes

- \[`flake8-boolean-trap`] Allow booleans in `@override` methods
([#&#8203;8882](https://togithub.com/astral-sh/ruff/pull/8882))
- \[`flake8-bugbear`] Avoid `B015`,`B018` for last expression in a cell
([#&#8203;8815](https://togithub.com/astral-sh/ruff/pull/8815))
- \[`flake8-pie`] Allow ellipses for enum values in stub files
([#&#8203;8825](https://togithub.com/astral-sh/ruff/pull/8825))
- \[`flake8-pyi`] Check PEP 695 type aliases for `snake-case-type-alias`
and `t-suffixed-type-alias`
([#&#8203;8966](https://togithub.com/astral-sh/ruff/pull/8966))
- \[`flake8-pyi`] Check for kwarg and vararg `NoReturn` type annotations
([#&#8203;8948](https://togithub.com/astral-sh/ruff/pull/8948))
- \[`flake8-simplify`] Omit select context managers from `SIM117`
([#&#8203;8801](https://togithub.com/astral-sh/ruff/pull/8801))
- \[`pep8-naming`] Allow Django model loads in
`non-lowercase-variable-in-function` (`N806`)
([#&#8203;8917](https://togithub.com/astral-sh/ruff/pull/8917))
- \[`pycodestyle`] Avoid `E703` for last expression in a cell
([#&#8203;8821](https://togithub.com/astral-sh/ruff/pull/8821))
- \[`pycodestyle`] Update `E402` to work at cell level for notebooks
([#&#8203;8872](https://togithub.com/astral-sh/ruff/pull/8872))
- \[`pydocstyle`] Avoid `D100` for Jupyter Notebooks
([#&#8203;8816](https://togithub.com/astral-sh/ruff/pull/8816))
- \[`pylint`] Implement fix for `unspecified-encoding` (`PLW1514`)
([#&#8203;8928](https://togithub.com/astral-sh/ruff/pull/8928))

##### Formatter

- Avoid unstable formatting in ellipsis-only body with trailing comment
([#&#8203;8984](https://togithub.com/astral-sh/ruff/pull/8984))
- Inline trailing comments for type alias similar to assignments
([#&#8203;8941](https://togithub.com/astral-sh/ruff/pull/8941))
- Insert trailing comma when function breaks with single argument
([#&#8203;8921](https://togithub.com/astral-sh/ruff/pull/8921))

##### CLI

- Update `ruff check` and `ruff format` to default to the current
directory
([#&#8203;8791](https://togithub.com/astral-sh/ruff/pull/8791))
- Stop at the first resolved parent configuration
([#&#8203;8864](https://togithub.com/astral-sh/ruff/pull/8864))

##### Configuration

- \[`pylint`] Default `max-positional-args` to `max-args`
([#&#8203;8998](https://togithub.com/astral-sh/ruff/pull/8998))
- \[`pylint`] Add `allow-dunder-method-names` setting for
`bad-dunder-method-name` (`PLW3201`)
([#&#8203;8812](https://togithub.com/astral-sh/ruff/pull/8812))
- \[`isort`] Add support for `from-first` setting
([#&#8203;8663](https://togithub.com/astral-sh/ruff/pull/8663))
- \[`isort`] Add support for `length-sort` settings
([#&#8203;8841](https://togithub.com/astral-sh/ruff/pull/8841))

##### Bug fixes

- Add support for `@functools.singledispatch`
([#&#8203;8934](https://togithub.com/astral-sh/ruff/pull/8934))
- Avoid off-by-one error in stripping noqa following multi-byte char
([#&#8203;8979](https://togithub.com/astral-sh/ruff/pull/8979))
- Avoid off-by-one error in with-item named expressions
([#&#8203;8915](https://togithub.com/astral-sh/ruff/pull/8915))
- Avoid syntax error via invalid ur string prefix
([#&#8203;8971](https://togithub.com/astral-sh/ruff/pull/8971))
- Avoid underflow in `get_model` matching
([#&#8203;8965](https://togithub.com/astral-sh/ruff/pull/8965))
- Avoid unnecessary index diagnostics when value is modified
([#&#8203;8970](https://togithub.com/astral-sh/ruff/pull/8970))
- Convert over-indentation rule to use number of characters
([#&#8203;8983](https://togithub.com/astral-sh/ruff/pull/8983))
- Detect implicit returns in auto-return-types
([#&#8203;8952](https://togithub.com/astral-sh/ruff/pull/8952))
- Fix start >= end error in over-indentation
([#&#8203;8982](https://togithub.com/astral-sh/ruff/pull/8982))
- Ignore `@overload` and `@override` methods for too-many-arguments
checks ([#&#8203;8954](https://togithub.com/astral-sh/ruff/pull/8954))
- Lexer start of line is false only for `Mode::Expression`
([#&#8203;8880](https://togithub.com/astral-sh/ruff/pull/8880))
- Mark `pydantic_settings.BaseSettings` as having default copy semantics
([#&#8203;8793](https://togithub.com/astral-sh/ruff/pull/8793))
- Respect dictionary unpacking in `NamedTuple` assignments
([#&#8203;8810](https://togithub.com/astral-sh/ruff/pull/8810))
- Respect local subclasses in `flake8-type-checking`
([#&#8203;8768](https://togithub.com/astral-sh/ruff/pull/8768))
- Support type alias statements in simple statement positions
([#&#8203;8916](https://togithub.com/astral-sh/ruff/pull/8916))
- \[`flake8-annotations`] Avoid filtering out un-representable types in
return annotation
([#&#8203;8881](https://togithub.com/astral-sh/ruff/pull/8881))
- \[`flake8-pie`] Retain extra ellipses in protocols and abstract
methods ([#&#8203;8769](https://togithub.com/astral-sh/ruff/pull/8769))
- \[`flake8-pyi`] Respect local enum subclasses in `simple-defaults`
(`PYI052`)
([#&#8203;8767](https://togithub.com/astral-sh/ruff/pull/8767))
- \[`flake8-trio`] Use correct range for `TRIO115` fix
([#&#8203;8933](https://togithub.com/astral-sh/ruff/pull/8933))
- \[`flake8-trio`] Use full arguments range for zero-sleep-call
([#&#8203;8936](https://togithub.com/astral-sh/ruff/pull/8936))
- \[`isort`] fix: mark `__main__` as first-party import
([#&#8203;8805](https://togithub.com/astral-sh/ruff/pull/8805))
- \[`pep8-naming`] Avoid `N806` errors for type alias statements
([#&#8203;8785](https://togithub.com/astral-sh/ruff/pull/8785))
- \[`perflint`] Avoid `PERF101` if there's an append in loop body
([#&#8203;8809](https://togithub.com/astral-sh/ruff/pull/8809))
- \[`pycodestyle`] Allow space-before-colon after end-of-slice
([#&#8203;8838](https://togithub.com/astral-sh/ruff/pull/8838))
- \[`pydocstyle`] Avoid non-character breaks in `over-indentation`
(`D208`) ([#&#8203;8866](https://togithub.com/astral-sh/ruff/pull/8866))
- \[`pydocstyle`] Ignore underlines when determining docstring logical
lines ([#&#8203;8929](https://togithub.com/astral-sh/ruff/pull/8929))
- \[`pylint`] Extend `self-assigning-variable` to multi-target
assignments
([#&#8203;8839](https://togithub.com/astral-sh/ruff/pull/8839))
- \[`tryceratops`] Avoid repeated triggers in nested `tryceratops`
diagnostics
([#&#8203;8772](https://togithub.com/astral-sh/ruff/pull/8772))

##### Documentation

- Add advice for fixing RUF008 when mutability is not desired
([#&#8203;8853](https://togithub.com/astral-sh/ruff/pull/8853))
- Added the command to run ruff using pkgx to the installation.md
([#&#8203;8955](https://togithub.com/astral-sh/ruff/pull/8955))
- Document fix safety for flake8-comprehensions and some pyupgrade rules
([#&#8203;8918](https://togithub.com/astral-sh/ruff/pull/8918))
- Fix doc formatting for zero-sleep-call
([#&#8203;8937](https://togithub.com/astral-sh/ruff/pull/8937))
- Remove duplicate imports from os-stat documentation
([#&#8203;8930](https://togithub.com/astral-sh/ruff/pull/8930))
- Replace generated reference to MkDocs
([#&#8203;8806](https://togithub.com/astral-sh/ruff/pull/8806))
- Update Arch Linux package URL in installation.md
([#&#8203;8802](https://togithub.com/astral-sh/ruff/pull/8802))
- \[`flake8-pyi`] Fix error in `t-suffixed-type-alias` (`PYI043`)
example ([#&#8203;8963](https://togithub.com/astral-sh/ruff/pull/8963))
- \[`flake8-pyi`] Improve motivation for `custom-type-var-return-type`
(`PYI019`)
([#&#8203;8766](https://togithub.com/astral-sh/ruff/pull/8766))

</details>

<details>
<summary>RobertCraigie/pyright-python (types/pyright)</summary>

###
[`v1.1.341`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.340...v1.1.341)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.340...v1.1.341)

###
[`v1.1.340`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.339...v1.1.340)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.339...v1.1.340)

###
[`v1.1.339`](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.338...v1.1.339)

[Compare
Source](https://togithub.com/RobertCraigie/pyright-python/compare/v1.1.338...v1.1.339)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" in timezone Etc/UTC,
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- 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/canonical/craftcraft).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exclude
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants