How prevent Ruff to format dictionary into single line ? #14792
-
Hello, for name, df in dfs.items():
summary_data.append(
{"Fichier": name, "Dimensions": df.shape, "Noms colonnes": df.columns.tolist(), "Types de données": df.dtypes}
) I would prefer a multiline instead summary_data = []
for name, df in dfs.items():
summary_data.append(
{
"Fichier": name,
"Dimensions": df.shape,
"Noms colonnes": df.columns.tolist(),
"Types de données": df.dtypes
}
) Here is my pyproject.toml [tool.ruff]
line-length = 120
extend-include = [
"*.ipynb",
"*.qmd"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN", # Mypy is better at this
"COM", # Formatter takes care of our commas
"E501", # leave line-length enforcement to formatter
"T201", # I am using print
"D100",
"D101",
"D102",
"D103",
"D104", # D100-104 missing docstring
"INP001", # missing __init__ in external library
"RUF005"
]
[tool.ruff.lint.isort]
lines-between-types = 1
lines-after-imports = 2
[tool.ruff.format]
preview = true Thanks for your help |
Beta Was this translation helpful? Give feedback.
Answered by
MichaReiser
Dec 5, 2024
Replies: 1 comment 1 reply
-
You can add a trailing comma to the last dictionary entry to keep it on separate lines
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
laguill
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add a trailing comma to the last dictionary entry to keep it on separate lines