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

TypeError: can only concatenate list (not "tuple") to list #644

Open
flopezag opened this issue Feb 26, 2024 · 6 comments
Open

TypeError: can only concatenate list (not "tuple") to list #644

flopezag opened this issue Feb 26, 2024 · 6 comments

Comments

@flopezag
Copy link

I am using python3.11.8 and robotframework-tidy 4.9.0 over Ubuntu Linux 22.04. I have installed it in the pre-commit and when I tried to make the git commit, I got the following message:

[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /home/xxx/.cache/pre-commit/patch1708974943-1119205.
[WARNING] Unexpected key(s) present on https://github.com/MarketSquare/robotframework-tidy: id
robotidy.................................................................Failed
- hook id: robotidy
- exit code: 1

Traceback (most recent call last):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/bin/robotidy", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/rich_click/rich_command.py", line 19, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 30, in wrapper
    raise err
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 21, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/cli.py", line 438, in cli
    global_config = config_module.MainConfig(cli_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 226, in __init__
    self.default_loaded = Config.from_raw_config(self.default)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 379, in from_raw_config
    return cls(
           ^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 321, in __init__
    self.load_transformers(transformers_config, force_order, target_version, skip)
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 400, in load_transformers
    transformers = load_transformers(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 480, in load_transformers
    for container in import_transformer(name, transformers_config, skip):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 324, in import_transformer
    yield create_transformer_instance(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 346, in create_transformer_instance
    positional, named, argument_names = resolve_args(short_name, spec, args, skip, handles_skip=handles_skip)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 424, in resolve_args
    argument_names = resolve_argument_names(spec.argument_names, handles_skip)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 368, in resolve_argument_names
    return new_args + argument_names
           ~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
Fatal exception occurred. You can create an issue at https://github.com/MarketSquare/robotframework-tidy/issues . Thanks!
Traceback (most recent call last):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/bin/robotidy", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/rich_click/rich_command.py", line 19, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 30, in wrapper
    raise err
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 21, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/cli.py", line 438, in cli
    global_config = config_module.MainConfig(cli_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 226, in __init__
    self.default_loaded = Config.from_raw_config(self.default)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 379, in from_raw_config
    return cls(
           ^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 321, in __init__
    self.load_transformers(transformers_config, force_order, target_version, skip)
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 400, in load_transformers
    transformers = load_transformers(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 480, in load_transformers
    for container in import_transformer(name, transformers_config, skip):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 324, in import_transformer
    yield create_transformer_instance(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 346, in create_transformer_instance
    positional, named, argument_names = resolve_args(short_name, spec, args, skip, handles_skip=handles_skip)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 424, in resolve_args
    argument_names = resolve_argument_names(spec.argument_names, handles_skip)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 368, in resolve_argument_names
    return new_args + argument_names
           ~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
Fatal exception occurred. You can create an issue at https://github.com/MarketSquare/robotframework-tidy/issues . Thanks!
Traceback (most recent call last):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/bin/robotidy", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/rich_click/rich_command.py", line 19, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 30, in wrapper
    raise err
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 21, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/cli.py", line 438, in cli
    global_config = config_module.MainConfig(cli_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 226, in __init__
    self.default_loaded = Config.from_raw_config(self.default)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 379, in from_raw_config
    return cls(
           ^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 321, in __init__
    self.load_transformers(transformers_config, force_order, target_version, skip)
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 400, in load_transformers
    transformers = load_transformers(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 480, in load_transformers
    for container in import_transformer(name, transformers_config, skip):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 324, in import_transformer
    yield create_transformer_instance(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 346, in create_transformer_instance
    positional, named, argument_names = resolve_args(short_name, spec, args, skip, handles_skip=handles_skip)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 424, in resolve_args
    argument_names = resolve_argument_names(spec.argument_names, handles_skip)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 368, in resolve_argument_names
    return new_args + argument_names
           ~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
Fatal exception occurred. You can create an issue at https://github.com/MarketSquare/robotframework-tidy/issues . Thanks!
Traceback (most recent call last):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/bin/robotidy", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/rich_click/rich_command.py", line 19, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 30, in wrapper
    raise err
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 21, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/cli.py", line 438, in cli
    global_config = config_module.MainConfig(cli_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 226, in __init__
    self.default_loaded = Config.from_raw_config(self.default)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 379, in from_raw_config
    return cls(
           ^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 321, in __init__
    self.load_transformers(transformers_config, force_order, target_version, skip)
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 400, in load_transformers
    transformers = load_transformers(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 480, in load_transformers
    for container in import_transformer(name, transformers_config, skip):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 324, in import_transformer
    yield create_transformer_instance(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 346, in create_transformer_instance
    positional, named, argument_names = resolve_args(short_name, spec, args, skip, handles_skip=handles_skip)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 424, in resolve_args
    argument_names = resolve_argument_names(spec.argument_names, handles_skip)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 368, in resolve_argument_names
    return new_args + argument_names
           ~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
Fatal exception occurred. You can create an issue at https://github.com/MarketSquare/robotframework-tidy/issues . Thanks!
Traceback (most recent call last):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/bin/robotidy", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/rich_click/rich_command.py", line 19, in main
    rv = super().main(*args, standalone_mode=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 30, in wrapper
    raise err
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/decorators.py", line 21, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/cli.py", line 438, in cli
    global_config = config_module.MainConfig(cli_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 226, in __init__
    self.default_loaded = Config.from_raw_config(self.default)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 379, in from_raw_config
    return cls(
           ^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 321, in __init__
    self.load_transformers(transformers_config, force_order, target_version, skip)
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/config.py", line 400, in load_transformers
    transformers = load_transformers(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 480, in load_transformers
    for container in import_transformer(name, transformers_config, skip):
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 324, in import_transformer
    yield create_transformer_instance(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 346, in create_transformer_instance
    positional, named, argument_names = resolve_args(short_name, spec, args, skip, handles_skip=handles_skip)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 424, in resolve_args
    argument_names = resolve_argument_names(spec.argument_names, handles_skip)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/xxx/.cache/pre-commit/repoql0jmo6e/py_env-python3.11/lib/python3.11/site-packages/robotidy/transformers/__init__.py", line 368, in resolve_argument_names
    return new_args + argument_names
           ~~~~~~~~~^~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
@Maninder416
Copy link

I encountered the same issue, but after following @bhirsz advice and changing the robotidy version to 4.8.1, it resolved the initial problem. However, this led to another issue. Let's consider the scenario with three commits:

Commit 1: Changes in the src folder.
Commit 2: Changes in the bdd.resource files.
Commit 3: Changes in the .robot files.

When I attempt to commit Commit 1, it should only add those specific changes. However, something unexpected happens. Robotidy throws an error, claiming it reformatted other files. Upon checking the differences using "git status" again, Commit 1 has already been committed. Suppose I commit these three commits and push the code. In my desired output, there should be three commits in my PR. However, when I check my PR, Commit 1 also includes changes from Commit 2, and Commit 2 includes changes from Commit 3. This results in an undesirable commit history. I'm uncertain how to resolve this issue.

@bhirsz
Copy link
Member

bhirsz commented Feb 27, 2024

@flopezag like @Maninder416 wrote, this issue was happening in the older version of Robotidy (that did not support Robot Framework 7). Can you make sure that your environment (precommit one) is using correct version of Robotidy?

@bhirsz
Copy link
Member

bhirsz commented Feb 27, 2024

I encountered the same issue, but after following @bhirsz advice and changing the robotidy version to 4.8.1, it resolved the initial problem. However, this led to another issue. Let's consider the scenario with three commits:

Commit 1: Changes in the src folder. Commit 2: Changes in the bdd.resource files. Commit 3: Changes in the .robot files.

When I attempt to commit Commit 1, it should only add those specific changes. However, something unexpected happens. Robotidy throws an error, claiming it reformatted other files. Upon checking the differences using "git status" again, Commit 1 has already been committed. Suppose I commit these three commits and push the code. In my desired output, there should be three commits in my PR. However, when I check my PR, Commit 1 also includes changes from Commit 2, and Commit 2 includes changes from Commit 3. This results in an undesirable commit history. I'm uncertain how to resolve this issue.

It looks weird. Typically precommit only passes single files that were staged for commit, not all modified files. It does work that way for me. But there could be something else going - for example can you check if you don't have configuration file (pyproject.toml etc) with 'src' defined? Robotidy should take configuration from cli over configuration file but I want to make sure. Also since precommit interrupts commit and we need to re-add modified files, we need to be cautious to not add files that we don't want to. Any whenever Robotidy modify the file, it should 'fail' so precommit should interrupt commit.

In meantime I will test on some example project with few files & few commits.

@flopezag
Copy link
Author

At the moment, I am using the following versions:

robotframework             6.1.1
robotframework-tidy        4.9.0

Which version should I use?

@bhirsz
Copy link
Member

bhirsz commented Feb 27, 2024

At the moment, I am using the following versions:

robotframework             6.1.1
robotframework-tidy        4.9.0

Which version should I use?

This error only happens for RF 7 and Robotidy < 4.8 if I recall correctly. I have just created fresh environment with RF 6.1.1 and Robotidy 4.9.0 and I didn't get this issue. So I'm sure somewhere in your configuration you're using RF 7 with older version of Robotidy than 4.9.0. How is your precommit file looking like? Note that precommit creates its own run environment, separate from your other environments.

@Maninder416
Copy link

Hi @bhirsz,
Thanks for you reply:
I am using the same version you have described:
robotframework 6.1.1
robotframework-tidy 4.9.0

After updating to this version, the error [TypeError: can only concatenate list (not "tuple") to list] was resolved, but the commit issue persists. To illustrate further:

Commit 1 involves changes in the src folder.
Commit 2 involves changes in the bdd.resource files.
Commit 3 involves changes in the .robot files.

When attempting to commit Commit 1, it indicates that it reformatted other files, such as test.resource, which is part of Commit 2. Subsequently, committing Commit 2 resolves the issue with robotidy, but it also includes the changes from Commit 1 because they were not yet committed but staged. Consequently, Commit 2 includes changes from both Commit 1 and Commit 2, which is incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants