-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix python linter inconsistent behaviour with quotes #1112
Merged
foragerr
merged 13 commits into
All-Hands-AI:main
from
li-boxuan:fix-python-linter-headache
Apr 17, 2024
Merged
Fix python linter inconsistent behaviour with quotes #1112
foragerr
merged 13 commits into
All-Hands-AI:main
from
li-boxuan:fix-python-linter-headache
Apr 17, 2024
Commits on Apr 15, 2024
-
This has been a headache for a long time, and we had All-Hands-AI#1071 …
…and All-Hands-AI#1100 with the hope to fix the inconsistent behaviour across linters and environments. However, we recently found out that double-quote-string-fixer plugin in pre-commit-hook has inconsistent behaviour on python 3.11 and 3.12. See discussion here. This is sad because while this plugin enforces single quote behaviour with 3.11, it doesn't always enforce so with 3.12. Specifically, with fstr syntax, this plugin allows both single quotes and double quotes with python 3.12. The problem is, some developers have black linter installed/integrated with their IDE, which is probably the most popular linter in python world (ranked by GitHub stars). This linter insists on always using double quotes. Now we have black and double-quote-string-fixer fight each other (iff the developer uses python 3.12) for some quotes (fstr syntax). After a lot of research, I couldn't find a way to enforce single quote behaviour without introducing a new dependency, flake8, together with a plugin for it to enforce quotes' behavior. I believe it's better off introducing the more popular black if we have to introduce a new linter. Since black and autopep8 sometimes fight each other, and they mostly overlap, I further remove autopep8. The unfortunate consequence of this PR is that I had to revert all single quotes back to double quotes. This might cause some inconvenience to existing PRs as they have to resolve conflicts, but I believe the headache will be gone soon. That being said, I am open to abandon this PR if anyone has a better idea to solve the headache.
Configuration menu - View commit details
-
Copy full SHA for cd5160e - Browse repository at this point
Copy the full SHA cd5160eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 59bb657 - Browse repository at this point
Copy the full SHA 59bb657View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4087576 - Browse repository at this point
Copy the full SHA 4087576View commit details -
Configuration menu - View commit details
-
Copy full SHA for be665d5 - Browse repository at this point
Copy the full SHA be665d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for b462854 - Browse repository at this point
Copy the full SHA b462854View commit details -
Configuration menu - View commit details
-
Copy full SHA for 419817b - Browse repository at this point
Copy the full SHA 419817bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2fd3371 - Browse repository at this point
Copy the full SHA 2fd3371View commit details -
Configuration menu - View commit details
-
Copy full SHA for e7fedcc - Browse repository at this point
Copy the full SHA e7fedccView commit details
Commits on Apr 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 18c0954 - Browse repository at this point
Copy the full SHA 18c0954View commit details -
Configuration menu - View commit details
-
Copy full SHA for e67efea - Browse repository at this point
Copy the full SHA e67efeaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 90db5d5 - Browse repository at this point
Copy the full SHA 90db5d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 626c8fd - Browse repository at this point
Copy the full SHA 626c8fdView commit details
Commits on Apr 17, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 555a1d5 - Browse repository at this point
Copy the full SHA 555a1d5View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.