macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
112 stars 56 forks source link

pretty-format-toml removes trailing comments in list #202

Open l0b0 opened 7 months ago

l0b0 commented 7 months ago

When reformatting a list setting like

load-plugins = [
  "pylint.extensions.bad_builtin",
  # "pylint.extensions.docparams",
  "pylint.extensions.set_membership"
  # "pylint.extensions.typing"
]

, the first comment is retained, but the second one is removed. Both comments should be retained. Not sure whether this is an issue with TomlSort or this repo.

maresb commented 5 months ago

This looks like a duplicate of https://github.com/macisamuele/language-formatters-pre-commit-hooks/issues/161

maresb commented 5 months ago

I feel like this TOML pre-commit hook needs a big red warning that it's unsafe since it will unceremoniously delete comments.