-
-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support '# pragma: no branch' in multi-line if statements (fix #754) #1773
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nedbat
force-pushed
the
fix_lines_matching_multiline
branch
from
May 2, 2024 21:31
31b10a0
to
0dd522e
Compare
Thanks! A simple fix, I should have thought of it. |
This is now released as part of coverage 7.5.1. |
renovate bot
referenced
this pull request
in allenporter/flux-local
May 4, 2024
[![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://github.com/nedbat/coveragepy) | `==7.5.0` -> `==7.5.1` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/coverage/7.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/coverage/7.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/coverage/7.5.0/7.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/coverage/7.5.0/7.5.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>nedbat/coveragepy (coverage)</summary> ### [`v7.5.1`](https://github.com/nedbat/coveragepy/blob/HEAD/CHANGES.rst#Version-751--2024-05-04) [Compare Source](https://github.com/nedbat/coveragepy/compare/7.5.0...7.5.1) - Fix: a pragma comment on the continuation lines of a multi-line statement now excludes the statement and its body, the same as if the pragma is on the first line. This closes `issue 754`*. The fix was contributed by `Daniel Diniz <pull 1773_>`*. - Fix: very complex source files like `this one <resolvent_lookup_>`\_ could cause a maximum recursion error when creating an HTML report. This is now fixed, closing `issue 1774`\_. - HTML report improvements: - Support files (JavaScript and CSS) referenced by the HTML report now have hashes added to their names to ensure updated files are used instead of stale cached copies. - Missing branch coverage explanations that said "the condition was never false" now read "the condition was always true" because it's easier to understand. - Column sort order is remembered better as you move between the index pages, fixing `issue 1766`*. Thanks, `Daniel Diniz <pull 1768_>`*. .. \_resolvent_lookup: https://github.com/sympy/sympy/blob/130950f3e6b3f97fcc17f4599ac08f70fdd2e9d4/sympy/polys/numberfields/resolvent_lookup.py .. \_issue 754[https://github.com/nedbat/coveragepy/issues/754](https://github.com/nedbat/coveragepy/issues/754)54 .. \_issue 176[https://github.com/nedbat/coveragepy/issues/1766](https://github.com/nedbat/coveragepy/issues/1766)766 .. \_pull 17[https://github.com/nedbat/coveragepy/pull/1768](https://github.com/nedbat/coveragepy/pull/1768)1768 .. \_pull 1[https://github.com/nedbat/coveragepy/pull/1773](https://github.com/nedbat/coveragepy/pull/1773)/1773 .. \_issue [https://github.com/nedbat/coveragepy/issues/1774](https://github.com/nedbat/coveragepy/issues/1774)s/1774 .. \_changes\_7-5-0: </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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMzEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjMzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PythonParser.lines_matching()
records a set of lines matching a given regex. However, it doesn't take multi-line statements into account. That causes statements that should be marked as "# pragma: no branch" to be counted as partial branches. IOW, "a pragma comment on the continuation lines of a multi-line if-statement won't have an effect".This PR fixes that by mapping line numbers through
parser._multiline
, so that the number of the first line in a multi-line statement gets recorded instead.Fixes #754.