-
Notifications
You must be signed in to change notification settings - Fork 16
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
Comments
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. 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. |
@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? |
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. |
At the moment, I am using the following versions:
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. |
Hi @bhirsz, 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. 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. |
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:
The text was updated successfully, but these errors were encountered: