File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1111 - Default regex for names of constants now allows underscore as a prefix to denote private contants (#223 )
1212 - Fixed parsing of files without newline at the end of file ending with comment (#237 )
1313 - Fixed linter support for docstrings (#233 )
14+ - Fixed linter support for trailing comma in function's args list (#206 )
1415
1516## [ 4.1.0] 2023-07-06
1617
Original file line number Diff line number Diff line change 44from lark import Tree , Token
55
66from ..common .utils import find_name_token_among_children , get_line , get_column
7- from ..formatter .expression_utils import remove_outer_parentheses
7+ from ..formatter .expression_utils import remove_outer_parentheses , is_trailing_comma
88
99from .problem import Problem
1010
@@ -127,7 +127,7 @@ def _unused_argument_check(parse_tree: Tree) -> List[Problem]:
127127 argument_definitions = {} # type: Dict[str, int]
128128 argument_tokens = {}
129129 func_args = func_header .children [1 ]
130- for func_arg in func_args .children :
130+ for func_arg in [ r for r in func_args .children if not is_trailing_comma ( r )] :
131131 arg_name_token = find_name_token_among_children (func_arg )
132132 arg_name = arg_name_token .value # type: ignore
133133 argument_definitions [arg_name ] = (
Original file line number Diff line number Diff line change @@ -14,3 +14,12 @@ def test_newlineless_code():
1414def test_docstring ():
1515 code = '"""\n hello world!\n """'
1616 lint_code (code )
17+
18+
19+ def test_trailing_comma_in_params_list ():
20+ code = """static func _is_agent_placement_position_valid(
21+ position,
22+ radius,
23+ existing_units,
24+ navigation_map_rid,):pass"""
25+ lint_code (code )
You can’t perform that action at this time.
0 commit comments