Skip to content

Conversation

@pylint-backport
Copy link
Contributor

Backport 8fa18c7 from #2880.

Getting the lineno of the start of the block for function definition(`FunctionDef.blockstart_tolineno`) can be quite tricky. Take below example:

```python
# Case A
def foo(bar: str) -> None:
    pass
# should returns line=1

# Case B
def foo(
        bar:str):
    pass
# should returns line=2

# Case C
def foo(
    bar:str
) -> None:
    pass
# should returns line=3

# Case D
def foo(
    bar:str
):
# should returns line=3
    pass
```

Currently we only handled Case A, B. With this commit we can cover case C.

But for Case D, we will need a better solution

(cherry picked from commit 8fa18c7)
@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.2 milestone Nov 8, 2025
@Pierre-Sassoulas Pierre-Sassoulas enabled auto-merge (squash) November 8, 2025 08:35
@codecov
Copy link

codecov bot commented Nov 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (maintenance/4.0.x@e127630). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                  @@
##             maintenance/4.0.x    #2881   +/-   ##
====================================================
  Coverage                     ?   93.36%           
====================================================
  Files                        ?       92           
  Lines                        ?    11158           
  Branches                     ?        0           
====================================================
  Hits                         ?    10418           
  Misses                       ?      740           
  Partials                     ?        0           
Flag Coverage Δ
linux 93.23% <100.00%> (?)
pypy 93.36% <100.00%> (?)
windows 93.35% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
astroid/nodes/scoped_nodes/scoped_nodes.py 93.67% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pierre-Sassoulas Pierre-Sassoulas merged commit d71bfac into maintenance/4.0.x Nov 8, 2025
16 of 17 checks passed
@Pierre-Sassoulas Pierre-Sassoulas deleted the backport-2880-to-maintenance/4.0.x branch November 8, 2025 08:43
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.

3 participants