-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Could ruff also check files according to file's shebang? #13122
Comments
Related #2192 tl;dr It's recommended to use the |
Does using |
The differential analysis tool we develop uses Ruff as one of the backends, and while we appreciate Ruff's overall performance - analyzing the shebang is worth it in our case. The goal is to make future project enablements (= "start using vcs-diff-lint + ruff" in more projects) as trivial as possible. Explicitly asking for That said, having something like |
Per suggestion in astral-sh/ruff#13122
fedora-copr/vcs-diff-lint#25 seems to help a bit here; vcs-diff-lint knows the set of changed Python, including those that do not end with |
Per suggestion in astral-sh/ruff#13122
Detecting all Python files based on shebang has the downside that Ruff needs to read at least the first 80 or so bytes to determine whether the file should be included in the analysis. This is significantly more costly than just looking at a file extension, so I would not want this behavior to be the default. I'm open to adding such a feature if we can come up with an interface that doesn't penalty the default use case where this isn't needed. |
Could we, e.g., only include files with no "suffixes"? That would be the most common case, I assume. Otherwise, opt-in is completely fine! |
Also some html files - though valid python - have a non standard shebang (like it used to be on MS-DOS) that Ruff cannot yet support/handle ( unlike black -x / python -x , fails with eg source : https://github.com/pygame-web/showroom/blob/main/pygame-scripts/org.pygame.touchpong.html for run with python-wasm or ref: psf/black#3214 |
Indeed, this should be only an additional/optional analysis, and I don't think we need to have 100% success rate (nb. the basic |
Even though the file is not
*.py
, it still is a Python file and it is worth checking.The text was updated successfully, but these errors were encountered: