We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have the following function block:
def compute_profiles( x: np.ndarray, y: np.ndarray, window_size: int, type: str = "median", return_xbins: bool = False ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
However ruff ignores the trailing commas, and formats it to even though skip-magic-trailing-comma = false
skip-magic-trailing-comma = false
The problem only appears for functions, for regular arrays the problem does not appear.
My configuration is:
[tool.ruff] extend-include = ["*.ipynb"] preview = true line-length = 120 indent-width = 4 [tool.ruff.format] preview = true quote-style = "double" indent-style = "space" line-ending = "auto" skip-magic-trailing-comma = false docstring-code-format = true docstring-code-line-length = "dynamic" [tool.ruff.lint] select = [ "E", # pycodestyle (error) "F", # pyflakes "B", # bugbear "B9", "C4", # flake8-comprehensions "SIM", # flake8-simplify "I", # isort "UP", # pyupgrade "PIE", # flake8-pie "PGH", # pygrep-hooks "PYI", # flake8-pyi "RUF", ] ignore = [ # only relevant if you run a script with `python -0`, # which seems unlikely for any of the scripts in this repo "B011", # Leave it to the formatter to split long lines and # the judgement of all of us. "E501", "RUF052", "E201", "E241" ] fixable = ["A", "B", "C", "D", "E", "F"] unfixable = [] [tool.ruff.lint.pydocstyle] convention = "google"
I am using the latest version of Ruff extension on VSCode.
v2025.14.0 (VScode)
The text was updated successfully, but these errors were encountered:
Hi @sparxastronomy
I don't see a trailing comma in your example code. The trailing comma must come after the last argument's default value:
def compute_profiles( x: np.ndarray, y: np.ndarray, window_size: int, type: str = "median", return_xbins: bool = False, ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ...
Ruff should then split the arguments across multiple lines when using skip-magic-trailing-comma=false (default)
skip-magic-trailing-comma=false
https://play.ruff.rs/10014487-0683-40d5-9eed-968075bce9b5
Sorry, something went wrong.
Thanks @MichaReiser for point out the missing commas. I thought the last comma was not needed.
No branches or pull requests
Summary
I have the following function block:
However ruff ignores the trailing commas, and formats it to even though
skip-magic-trailing-comma = false
The problem only appears for functions, for regular arrays the problem does not appear.
My configuration is:
I am using the latest version of Ruff extension on VSCode.
Version
v2025.14.0 (VScode)
The text was updated successfully, but these errors were encountered: