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

Fix handling of multi-line function declarations #1705

Merged
merged 5 commits into from
Dec 2, 2023

Conversation

kajakaj
Copy link

@kajakaj kajakaj commented Nov 30, 2023

Resolves #684

The cause of this problem is the method of checking whether a particular clause should be excluded. In a file parser.py in function _raw_parse (line 161) only the line that ends with : is checked for excluded expressions, not all the lines in a statement that ends with a colon. The solution is to add checking if at least one line in the multi-line statement ended with : has to be excluded and if that is the case - to exclude that clause. Multi-line statements are added after a token \n, so after checking for excluded clauses in one-line statements. Because of that, checking if a clause after multi-line statement should be excluded was added starting from the line 193.
Tests with different use cases were added.

@nedbat
Copy link
Owner

nedbat commented Nov 30, 2023

Thanks, this looks promising. I will take a look soon.

kajakaj and others added 5 commits December 2, 2023 08:49

Verified

This commit was signed with the committer’s verified signature.
Fil Philippe Rivière

Verified

This commit was signed with the committer’s verified signature.
Fil Philippe Rivière

Verified

This commit was signed with the committer’s verified signature.
Fil Philippe Rivière

Verified

This commit was signed with the committer’s verified signature.
Fil Philippe Rivière

Verified

This commit was signed with the committer’s verified signature.
Fil Philippe Rivière
@nedbat nedbat force-pushed the fix_bug_from_684_issue branch from fe23ff4 to 5a4073e Compare December 2, 2023 13:57
@nedbat
Copy link
Owner

nedbat commented Dec 2, 2023

I'm going to merge this. I've thanked Jan Rusak in the changelog and contributors file. I'll gladly add other names, but I'm not sure what they are! :)

@nedbat nedbat merged commit ac184ab into nedbat:master Dec 2, 2023
@kajakaj
Copy link
Author

kajakaj commented Dec 4, 2023

Thanks - we did it together: Jan Rusak, Maciej Kowalczyk and Joanna Ejzel.

nedbat added a commit that referenced this pull request Dec 4, 2023
@nedbat
Copy link
Owner

nedbat commented Dec 4, 2023

Thanks again, I added the names in 470e086

@nedbat
Copy link
Owner

nedbat commented Dec 14, 2023

This is now released as part of coverage 7.3.3.

renovate bot referenced this pull request in allenporter/flux-local 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:[https://github.com/nedbat/coveragepy/issues/684](https://togithub.com/nedbat/coveragepy/issues/684)4
.. \_pull
1705[https://github.com/nedbat/coveragepy/pull/1705](https://togithub.com/nedbat/coveragepy/pull/1705)05
.. \_issue
170[https://github.com/nedbat/coveragepy/issues/1709](https://togithub.com/nedbat/coveragepy/issues/1709)709

.. \_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>
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.

Line break within function declaration disables exclusion of the function body
3 participants