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

Linter fails on arg trailing comma #206

Closed
Scony opened this issue Mar 6, 2023 · 1 comment
Closed

Linter fails on arg trailing comma #206

Scony opened this issue Mar 6, 2023 · 1 comment
Labels
bug Something isn't working linter
Milestone

Comments

@Scony
Copy link
Owner

Scony commented Mar 6, 2023

static func _is_agent_placement_position_valid(position, radius, existing_units, navigation_map_rid,):pass
@Scony Scony added bug Something isn't working linter labels Mar 6, 2023
@Scony Scony added this to the 4.1 milestone Mar 23, 2023
@njs-guy
Copy link

njs-guy commented Oct 12, 2023

Just had this happen to me. The following code works but it causes an error in gdlint.

func set_turn_order(
	next_turn_order: Array[Enums.MonsterPosition],
	next_move_order: Array[Move],
):
	current_turn_order = next_turn_order
	current_move_order = next_move_order
Traceback (most recent call last):
  File "/home/nick/.local/bin/gdlint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 66, in main
    problems_total += _lint_file(file_path, config)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 134, in _lint_file
    problems = lint_code(content, config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/__init__.py", line 120, in lint_code
    problems += basic_checks.lint(parse_tree, config)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/basic_checks.py", line 39, in lint
    problems = [problem for cluster in problem_clusters for problem in cluster]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/basic_checks.py", line 39, in <listcomp>
    problems = [problem for cluster in problem_clusters for problem in cluster]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/basic_checks.py", line 37, in <genexpr>
    x[1](parse_tree) if x[0] not in disable else [] for x in checks_to_run_w_tree
    ^^^^^^^^^^^^^^^^
  File "/home/nick/.local/pipx/venvs/gdtoolkit/lib64/python3.11/site-packages/gdtoolkit/linter/basic_checks.py", line 132, in _unused_argument_check
    arg_name = arg_name_token.value  # type: ignore
               ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'value'

Gdlint works again after removing the trailing comma.

func set_turn_order(
	next_turn_order: Array[Enums.MonsterPosition], next_move_order: Array[Move]
):
	current_turn_order = next_turn_order
	current_move_order = next_move_order
Success: no problems found

@Scony Scony closed this as completed in fc94c28 Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linter
Projects
Status: Done
Development

No branches or pull requests

2 participants