Scony / godot-gdscript-toolkit

Independent set of GDScript tools - parser, linter, formatter, and more
MIT License
999 stars 68 forks source link

Unexpected exception with `gdlint`: `ValueError: Unknown options: dict_keys(['cache', 'regex'])` #227

Closed shackra closed 1 year ago

shackra commented 1 year ago

I'm using Python 3.11.4 in a venv. I have installed the following packages:

Package     Version
----------- --------
colorama    0.4.6
docopt-ng   0.8.1
gdtoolkit   4.1.0
lark        1.1.5
lark-parser 0.8.0
mando       0.7.1
pip         23.2.1
PyYAML      6.0.1
radon       6.0.1
regex       2023.8.8
setuptools  67.1.0
six         1.16.0
wheel       0.38.4

Here is the error:

➜  gdlint -v .
INFO:root:Config file found: '/home/jorge/Documentos/sotsf/proyectos/zombox/game/gdlintrc'
INFO:root:Loaded config:
INFO:root:('class-definitions-order', ['tools', 'classnames', 'extends', 'signals', 'enums', 'consts', 'exports', 'pubvars', 'prvvars', 'onreadypubvars', 'onreadyprvvars', 'others'])
INFO:root:('class-load-variable-name', '(([A-Z][a-z0-9]*)+|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)')
INFO:root:('class-name', '([A-Z][a-z0-9]*)+')
INFO:root:('class-variable-name', '_?[a-z][a-z0-9]*(_[a-z0-9]+)*')
INFO:root:('comparison-with-itself', None)
INFO:root:('constant-name', '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*')
INFO:root:('disable', [])
INFO:root:('duplicated-load', None)
INFO:root:('enum-element-name', '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*')
INFO:root:('enum-name', '([A-Z][a-z0-9]*)+')
INFO:root:('excluded_directories', {'.git'})
INFO:root:('expression-not-assigned', None)
INFO:root:('function-argument-name', '_?[a-z][a-z0-9]*(_[a-z0-9]+)*')
INFO:root:('function-arguments-number', 10)
INFO:root:('function-name', '(_on_([A-Z][a-z0-9]*)+(_[a-z0-9]+)*|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)')
INFO:root:('function-preload-variable-name', '([A-Z][a-z0-9]*)+')
INFO:root:('function-variable-name', '[a-z][a-z0-9]*(_[a-z0-9]+)*')
INFO:root:('load-constant-name', '(([A-Z][a-z0-9]*)+|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*)')
INFO:root:('loop-variable-name', '_?[a-z][a-z0-9]*(_[a-z0-9]+)*')
INFO:root:('max-file-lines', 1000)
INFO:root:('max-line-length', 100)
INFO:root:('max-public-methods', 20)
INFO:root:('max-returns', 6)
INFO:root:('mixed-tabs-and-spaces', None)
INFO:root:('no-elif-return', None)
INFO:root:('no-else-return', None)
INFO:root:('private-method-call', None)
INFO:root:('signal-name', '[a-z][a-z0-9]*(_[a-z0-9]+)*')
INFO:root:('sub-class-name', '_?([A-Z][a-z0-9]*)+')
INFO:root:('tab-characters', 1)
INFO:root:('trailing-whitespace', None)
INFO:root:('unnecessary-pass', None)
INFO:root:('unused-argument', None)
Traceback (most recent call last):
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/bin/gdlint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 66, in main
    problems_total += _lint_file(file_path, config)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/linter/__main__.py", line 134, in _lint_file
    problems = lint_code(content, config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/linter/__init__.py", line 115, in lint_code
    parse_tree = parser.parse(gdscript_code, gather_metadata=True)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/parser/parser.py", line 59, in parse
    self._parser_with_metadata.parse(code)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/parser/parser.py", line 38, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
                                               ^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/parser/parser.py", line 107, in _parser_with_metadata
    return self._get_parser("parser_with_metadata", add_metadata=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/gdtoolkit/parser/parser.py", line 88, in _get_parser
    a_parser = Lark.open(
               ^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/lark/lark.py", line 267, in open
    return cls(f, **options)
           ^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/lark/lark.py", line 123, in __init__
    self.options = LarkOptions(options)
                   ^^^^^^^^^^^^^^^^^^^^
  File "/home/jorge/Documentos/sotsf/proyectos/zombox/.venv/lib/python3.11/site-packages/lark/lark.py", line 97, in __init__
    raise ValueError("Unknown options: %s" % o.keys())
ValueError: Unknown options: dict_keys(['cache', 'regex'])

I'm using the gdlintrc dumped by gdlint v4.1.0.

shackra commented 1 year ago

nvm, I just uninstalled everything with pip freeze | xargs pip uninstall -y and installed again with pip install gdtoolkit==4.1.0 and now there are no exceptions anymore.