> gdlint --version
gdlint 4.2.2
> cat foo.gd
extends Node
func foo():
print(
func(s):
print(1)
print(2)
)
> gdlint foo.gd
Traceback (most recent call last):
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lexer.py", line 590, in lex
yield lexer.next_token(lexer_state, parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lexer.py", line 528, in next_token
raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column,
lark.exceptions.UnexpectedCharacters: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 134, in _lint_file
problems = lint_code(content, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/linter/__init__.py", line 118, in lint_code
parse_tree = parser.parse(gdscript_code, gather_metadata=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/parser/parser.py", line 62, in parse
self._parser_with_metadata.parse(adjusted_code)
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lark.py", line 645, in parse
return self.parser.parse(text, start=start, on_error=on_error)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/parser_frontends.py", line 96, in parse
return self.parser.parse(stream, chosen_start, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 41, in parse
return self.parser.parse(lexer, start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 171, in parse
return self.parse_from_state(parser_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 193, in parse_from_state
raise e
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/parsers/lalr_parser.py", line 183, in parse_from_state
for token in state.lexer.lex(state):
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/indenter.py", line 45, in _process
for token in stream:
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lexer.py", line 599, in lex
raise UnexpectedToken(token, e.allowed, state=parser_state, token_history=[last_token], terminals_by_name=self.root_lexer.terminals_by_name)
lark.exceptions.UnexpectedToken: <exception str() failed>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/common/exceptions.py", line 14, in lark_unexpected_token_to_str
return f"{exception.get_context(code)}\n{exception}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 142, in <listcomp>
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/.local/bin/gdlint", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 66, in main
problems_total += _lint_file(file_path, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 148, in _lint_file
lark_unexpected_token_to_str(exception, content),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/gdtoolkit/common/exceptions.py", line 16, in lark_unexpected_token_to_str
return f"{exception}".strip()
^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 256, in __str__
% (self.token, self.line, self.column, self._format_expected(self.accepts or self.expected)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 142, in _format_expected
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/exceptions.py", line 142, in <listcomp>
expected = [d[t_name].user_repr() if t_name in d else t_name for t_name in expected]
^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.local/pipx/venvs/gdtoolkit/lib/python3.11/site-packages/lark/lexer.py", line 124, in user_repr
return self.pattern.raw or self.name
^^^^^^^^^^^^^^^^
AttributeError: 'PatternStr' object has no attribute 'raw'