File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1494,9 +1494,6 @@ def is_unannotated_any(t: Type) -> bool:
14941494 show_untyped = not self .is_typeshed_stub or self .options .warn_incomplete_stub
14951495 check_incomplete_defs = self .options .disallow_incomplete_defs and has_explicit_annotation
14961496 if show_untyped and (self .options .disallow_untyped_defs or check_incomplete_defs ):
1497- # TODO: changing end line and column here changes this information for the node itself
1498- # fdef.end_line = fdef.line
1499- # fdef.end_column = fdef.column + 1
15001497 if fdef .type is None and self .options .disallow_untyped_defs :
15011498 if not fdef .arguments or (
15021499 len (fdef .arguments ) == 1
Original file line number Diff line number Diff line change @@ -979,22 +979,21 @@ def do_func_def(
979979 _dummy_fallback ,
980980 )
981981
982- # End position is always the same.
983982 end_line = getattr (n , "end_lineno" , None )
984983 end_column = getattr (n , "end_col_offset" , None )
985984
986- # Determine end of the function definition itself
987- # Fall back to the end of the function definition including its body
985+ # End line and column span the whole function including its body.
986+ # Determine end of the function definition itself.
987+ # Fall back to the end of the function definition including its body.
988988 def_end_line : int | None = n .lineno
989- # TODO: to go to the end of the function name: n.col_offset + 4 + len(n.name)
990989 def_end_column : int | None = n .col_offset
991990
992991 returns = n .returns
993- # use the return type hint if defined
992+ # Use the return type hint if defined.
994993 if returns is not None :
995994 def_end_line = returns .end_lineno
996995 def_end_column = returns .end_col_offset
997- # otherwise use the last argument in the function definition
996+ # Otherwise use the last argument in the function definition.
998997 elif len (args ) > 0 :
999998 last_arg = args [- 1 ]
1000999 initializer = last_arg .initializer
Original file line number Diff line number Diff line change @@ -259,9 +259,7 @@ def span_from_context(ctx: Context) -> Iterable[int]:
259259 end_line = context .end_line if context else - 1
260260 end_column = context .end_column if context else - 1
261261
262- # set end line and column to same as start of context for function definitions
263- # this avoids errors being reported in IDEs for the whole function
264- # TODO: figure out if it's possible to find the end of the function definition line
262+ # FuncDef's end includes the body, use the def's end information if available.
265263 if isinstance (context , FuncDef ):
266264 end_line = context .def_end_line
267265 # column is 1-based, see also format_messages in errors.py
You can’t perform that action at this time.
0 commit comments