andreoliwa / nitpick

Enforce the same settings on multiple projects
https://nitpick.readthedocs.io/
MIT License
393 stars 24 forks source link

Request: sample config for `toml-sort` #618

Closed jamesbraza closed 10 months ago

jamesbraza commented 10 months ago

Problem

I like the tool toml-sort, I find it useful. I use its pre-commit hook toml-sort-fix.

Can we add a sample TOML config for this to resources/?

Possible solution

Here is a pyproject.toml config to use for it:

[tool.tomlsort]
all = true
in_place = true
trailing_comma_inline_array = true

With a .pre-commit-config.yaml integration:

  - repo: https://github.com/pappasam/toml-sort
    rev: v0.23.1
    hooks:
      - id: toml-sort-fix
andreoliwa commented 10 months ago

Oh, great find, thanks!

Can we add a sample TOML config for this to resources/?

Definitely!

I will try it on Nitpick itself. I remember seeing some TOML sorting tool some time ago, and I didn't use it because it didn't preserve comments.

jamesbraza commented 10 months ago

Yeah thanks for being open to it! This is one of the best TOML sorters, from my finding.

I have since learned adding no_sort_tables = true is an important parameter for nitpick configs, since sorted order would move down the nitpick.meta section. I now use:

[tool.tomlsort]
all = true
in_place = true
no_sort_tables = true
trailing_comma_inline_array = true
jamesbraza commented 10 months ago

Glad you applied toml-sort on this repo too @andreoliwa ! Nice work and thanks

github-actions[bot] commented 8 months ago

:tada: This issue has been resolved in version 0.35.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: