From a4aeef7c9eaac86d6a33ddbd3b5735de11c065b0 Mon Sep 17 00:00:00 2001 From: "W. Augusto Andreoli" Date: Sat, 4 Nov 2023 21:16:34 +0100 Subject: [PATCH] feat(style): add toml-sort (#626) * docs: use bullet in PR template, so GitHub will expand in the preview --- .github/pull_request_template.md | 3 +- README.rst | 11 +++ docs/library.rst | 11 +++ docs/requirements.txt | 84 ++++++++++--------- docs/source/nitpick.resources.rst | 1 + docs/source/nitpick.resources.toml.rst | 7 ++ poetry.lock | 16 +++- src/nitpick/resources/toml/__init__.py | 1 + src/nitpick/resources/toml/toml-sort.toml | 15 ++++ .../toml/toml-sort/.pre-commit-config.yaml | 4 + .../toml/toml-sort/pyproject.toml | 5 ++ 11 files changed, 116 insertions(+), 42 deletions(-) create mode 100644 docs/source/nitpick.resources.toml.rst create mode 100644 src/nitpick/resources/toml/__init__.py create mode 100644 src/nitpick/resources/toml/toml-sort.toml create mode 100644 tests/test_builtin/toml/toml-sort/.pre-commit-config.yaml create mode 100644 tests/test_builtin/toml/toml-sort/pyproject.toml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a16582ea..de88a71d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,6 @@ Issues fixed by this pull request: -Fix # + +- Fix # ## Proposed changes diff --git a/README.rst b/README.rst index 78641386..a0bed7ed 100644 --- a/README.rst +++ b/README.rst @@ -310,6 +310,17 @@ shell - `ShellCheck (static analysis for shell scripts) `_ * - `py://nitpick/resources/shell/shfmt `_ - `shfmt (shell script formatter) `_ + +toml +~~~~ + +.. list-table:: + :header-rows: 1 + + * - Style URL + - Description + * - `py://nitpick/resources/toml/toml-sort `_ + - `TOML sort `_ .. auto-generated-end-style-library Quickstart diff --git a/docs/library.rst b/docs/library.rst index ed4074b8..e38a487c 100644 --- a/docs/library.rst +++ b/docs/library.rst @@ -151,3 +151,14 @@ shell - `ShellCheck (static analysis for shell scripts) `_ * - :gitref:`py://nitpick/resources/shell/shfmt ` - `shfmt (shell script formatter) `_ + +toml +~~~~ + +.. list-table:: + :header-rows: 1 + + * - Style URL + - Description + * - :gitref:`py://nitpick/resources/toml/toml-sort ` + - `TOML sort `_ diff --git a/docs/requirements.txt b/docs/requirements.txt index 49041f11..b4264de5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,71 +1,75 @@ alabaster==0.7.13 ; python_version >= "3.8" and python_version < "4.0" attrs==23.1.0 ; python_version >= "3.8" and python_version < "4.0" autorepr==0.3.0 ; python_version >= "3.8" and python_version < "4.0" -babel==2.9.1 ; python_version >= "3.8" and python_version < "4.0" -cattrs==22.2.0 ; python_version >= "3.8" and python_version < "4.0" +babel==2.13.0 ; python_version >= "3.8" and python_version < "4.0" +cattrs==23.1.2 ; python_version >= "3.8" and python_version < "4.0" certifi==2023.7.22 ; python_version >= "3.8" and python_version < "4.0" -charset-normalizer==2.0.11 ; python_version >= "3.8" and python_version < "4.0" +charset-normalizer==3.3.0 ; python_version >= "3.8" and python_version < "4.0" click==8.1.7 ; python_version >= "3.8" and python_version < "4.0" colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32") configupdater==3.1.1 ; python_version >= "3.8" and python_version < "4.0" dictdiffer==0.9.0 ; python_version >= "3.8" and python_version < "4.0" -docutils==0.19 ; python_version >= "3.8" and python_version < "4.0" +docutils==0.18.1 ; python_version >= "3.8" and python_version < "4.0" dpath==2.1.6 ; python_version >= "3.8" and python_version < "4.0" -exceptiongroup==1.1.1 ; python_version >= "3.8" and python_version < "3.11" -flake8==3.9.2 ; python_version >= "3.8" and python_version < "4.0" +exceptiongroup==1.1.3 ; python_version >= "3.8" and python_version < "3.11" +flake8==5.0.4 ; python_version >= "3.8" and python_version < "4.0" flatten-dict==0.4.2 ; python_version >= "3.8" and python_version < "4.0" furl==2.1.3 ; python_version >= "3.8" and python_version < "4.0" -identify==2.5.31 ; python_version >= "3.8" and python_version < "4.0" -idna==3.3 ; python_version >= "3.8" and python_version < "4.0" -imagesize==1.3.0 ; python_version >= "3.8" and python_version < "4.0" -importlib-metadata==4.13.0 ; python_version >= "3.8" and python_version < "3.10" -importlib-resources==5.12.0 ; python_version >= "3.8" and python_version < "3.9" -iniconfig==1.1.1 ; python_version >= "3.8" and python_version < "4.0" -jinja2==3.0.3 ; python_version >= "3.8" and python_version < "4.0" +identify==2.5.30 ; python_version >= "3.8" and python_version < "4.0" +idna==3.4 ; python_version >= "3.8" and python_version < "4.0" +imagesize==1.4.1 ; python_version >= "3.8" and python_version < "4.0" +importlib-metadata==6.8.0 ; python_version >= "3.8" and python_version < "3.10" +importlib-resources==6.1.0 ; python_version >= "3.8" and python_version < "3.9" +iniconfig==2.0.0 ; python_version >= "3.8" and python_version < "4.0" +jinja2==3.1.2 ; python_version >= "3.8" and python_version < "4.0" jmespath==1.0.1 ; python_version >= "3.8" and python_version < "4.0" -jsonschema==4.4.0 ; python_version >= "3.8" and python_version < "4.0" -loguru==0.7.0 ; python_version >= "3.8" and python_version < "4.0" -markupsafe==2.0.1 ; python_version >= "3.8" and python_version < "4.0" +jsonschema-specifications==2023.7.1 ; python_version >= "3.8" and python_version < "4.0" +jsonschema==4.19.1 ; python_version >= "3.8" and python_version < "4.0" +loguru==0.7.2 ; python_version >= "3.8" and python_version < "4.0" +markupsafe==2.1.3 ; python_version >= "3.8" and python_version < "4.0" marshmallow-polyfield==5.11 ; python_version >= "3.8" and python_version < "4.0" -marshmallow==3.19.0 ; python_version >= "3.8" and python_version < "4.0" -mccabe==0.6.1 ; python_version >= "3.8" and python_version < "4.0" -more-itertools==9.1.0 ; python_version >= "3.8" and python_version < "4.0" +marshmallow==3.20.1 ; python_version >= "3.8" and python_version < "4.0" +mccabe==0.7.0 ; python_version >= "3.8" and python_version < "4.0" +more-itertools==10.1.0 ; python_version >= "3.8" and python_version < "4.0" orderedmultidict==1.0.1 ; python_version >= "3.8" and python_version < "4.0" -packaging==21.3 ; python_version >= "3.8" and python_version < "4.0" -platformdirs==3.1.1 ; python_version >= "3.8" and python_version < "4.0" -pluggy==1.0.0 ; python_version >= "3.8" and python_version < "4.0" -pycodestyle==2.7.0 ; python_version >= "3.8" and python_version < "4.0" -pyflakes==2.3.1 ; python_version >= "3.8" and python_version < "4.0" -pygments==2.15.0 ; python_version >= "3.8" and python_version < "4.0" -pyparsing==3.0.7 ; python_version >= "3.8" and python_version < "4.0" -pyrsistent==0.18.1 ; python_version >= "3.8" and python_version < "4.0" +packaging==23.2 ; python_version >= "3.8" and python_version < "4.0" +pkgutil-resolve-name==1.3.10 ; python_version >= "3.8" and python_version < "3.9" +platformdirs==3.11.0 ; python_version >= "3.8" and python_version < "4.0" +pluggy==1.3.0 ; python_version >= "3.8" and python_version < "4.0" +pycodestyle==2.9.1 ; python_version >= "3.8" and python_version < "4.0" +pyflakes==2.5.0 ; python_version >= "3.8" and python_version < "4.0" +pygments==2.16.1 ; python_version >= "3.8" and python_version < "4.0" pytest-socket==0.6.0 ; python_version >= "3.8" and python_version < "4.0" -pytest==7.3.1 ; python_version >= "3.8" and python_version < "4.0" +pytest==7.4.2 ; python_version >= "3.8" and python_version < "4.0" python-slugify==8.0.1 ; python_version >= "3.8" and python_version < "4.0" -pytz==2021.3 ; python_version >= "3.8" and python_version < "4.0" -requests-cache==1.0.1 ; python_version >= "3.8" and python_version < "4.0" +pytz==2023.3.post1 ; python_version >= "3.8" and python_version < "3.9" +referencing==0.30.2 ; python_version >= "3.8" and python_version < "4.0" +requests-cache==1.1.0 ; python_version >= "3.8" and python_version < "4.0" requests==2.31.0 ; python_version >= "3.8" and python_version < "4.0" -ruamel-yaml-clib==0.2.7 ; platform_python_implementation == "CPython" and python_version < "3.12" and python_version >= "3.8" -ruamel-yaml==0.17.28 ; python_version >= "3.8" and python_version < "4.0" +rpds-py==0.10.6 ; python_version >= "3.8" and python_version < "4.0" +ruamel-yaml-clib==0.2.8 ; platform_python_implementation == "CPython" and python_version < "3.13" and python_version >= "3.8" +ruamel-yaml==0.17.40 ; python_version >= "3.8" and python_version < "4.0" six==1.16.0 ; python_version >= "3.8" and python_version < "4.0" snowballstemmer==2.2.0 ; python_version >= "3.8" and python_version < "4.0" sortedcontainers==2.4.0 ; python_version >= "3.8" and python_version < "4.0" sphinx-gitref==0.2.1 ; python_version >= "3.8" and python_version < "4.0" -sphinx-rtd-theme==0.5.1 ; python_version >= "3.8" and python_version < "4.0" +sphinx-rtd-theme==1.3.0 ; python_version >= "3.8" and python_version < "4.0" sphinx==6.2.1 ; python_version >= "3.8" and python_version < "4.0" -sphinxcontrib-applehelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0" +sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.8" and python_version < "4.0" -sphinxcontrib-htmlhelp==2.0.0 ; python_version >= "3.8" and python_version < "4.0" +sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.8" and python_version < "4.0" +sphinxcontrib-jquery==4.1 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.8" and python_version < "4.0" sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.8" and python_version < "4.0" sphobjinv==2.3.1 ; python_version >= "3.8" and python_version < "4.0" -strenum==0.4.10 ; python_version >= "3.8" and python_version < "4.0" +strenum==0.4.15 ; python_version >= "3.8" and python_version < "4.0" text-unidecode==1.3 ; python_version >= "3.8" and python_version < "4.0" toml==0.10.2 ; python_version >= "3.8" and python_version < "4.0" -tomli==2.0.0 ; python_version >= "3.8" and python_version < "3.11" -tomlkit==0.11.8 ; python_version >= "3.8" and python_version < "4.0" +tomli==2.0.1 ; python_version >= "3.8" and python_version < "3.11" +tomlkit==0.12.1 ; python_version >= "3.8" and python_version < "4.0" +typing-extensions==4.8.0 ; python_version >= "3.8" and python_version < "3.11" url-normalize==1.4.3 ; python_version >= "3.8" and python_version < "4.0" -urllib3==1.26.18 ; python_version >= "3.8" and python_version < "4.0" +urllib3==2.0.7 ; python_version >= "3.8" and python_version < "4.0" win32-setctime==1.1.0 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "win32" -zipp==3.7.0 ; python_version >= "3.8" and python_version < "3.10" +zipp==3.17.0 ; python_version >= "3.8" and python_version < "3.10" diff --git a/docs/source/nitpick.resources.rst b/docs/source/nitpick.resources.rst index 3f690fc7..4ece3257 100644 --- a/docs/source/nitpick.resources.rst +++ b/docs/source/nitpick.resources.rst @@ -19,3 +19,4 @@ Subpackages nitpick.resources.proto nitpick.resources.python nitpick.resources.shell + nitpick.resources.toml diff --git a/docs/source/nitpick.resources.toml.rst b/docs/source/nitpick.resources.toml.rst new file mode 100644 index 00000000..2936cd00 --- /dev/null +++ b/docs/source/nitpick.resources.toml.rst @@ -0,0 +1,7 @@ +nitpick.resources.toml package +============================== + +.. automodule:: nitpick.resources.toml + :members: + :undoc-members: + :show-inheritance: diff --git a/poetry.lock b/poetry.lock index 6cf011f5..31d183a9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1607,35 +1607,49 @@ files = [ {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:07238db9cbdf8fc1e9de2489a4f68474e70dffcb32232db7c08fa61ca0c7c462"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:d92f81886165cb14d7b067ef37e142256f1c6a90a65cd156b063a43da1708cfd"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:fff3573c2db359f091e1589c3d7c5fc2f86f5bdb6f24252c2d8e539d4e45f412"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:840f0c7f194986a63d2c2465ca63af8ccbbc90ab1c6001b1978f05119b5e7334"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:024cfe1fc7c7f4e1aff4a81e718109e13409767e4f871443cbff3dba3578203d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win32.whl", hash = "sha256:c69212f63169ec1cfc9bb44723bf2917cbbd8f6191a00ef3410f5a7fe300722d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win_amd64.whl", hash = "sha256:cabddb8d8ead485e255fe80429f833172b4cadf99274db39abc080e068cbcc31"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b5edda50e5e9e15e54a6a8a0070302b00c518a9d32accc2346ad6c984aacd279"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:7048c338b6c86627afb27faecf418768acb6331fc24cfa56c93e8c9780f815fa"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b"}, {file = "ruamel.yaml.clib-0.2.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a5aa27bad2bb83670b71683aae140a1f52b0857a2deff56ad3f6c13a017a26ed"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c58ecd827313af6864893e7af0a3bb85fd529f862b6adbefe14643947cfe2942"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_12_0_arm64.whl", hash = "sha256:f481f16baec5290e45aebdc2a5168ebc6d35189ae6fea7a58787613a25f6e875"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:3fcc54cb0c8b811ff66082de1680b4b14cf8a81dce0d4fbf665c2265a81e07a1"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7f67a1ee819dc4562d444bbafb135832b0b909f81cc90f7aa00260968c9ca1b3"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:4ecbf9c3e19f9562c7fdd462e8d18dd902a47ca046a2e64dba80699f0b6c09b7"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:87ea5ff66d8064301a154b3933ae406b0863402a799b16e4a1d24d9fbbcbe0d3"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win32.whl", hash = "sha256:75e1ed13e1f9de23c5607fe6bd1aeaae21e523b32d83bb33918245361e9cc51b"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win_amd64.whl", hash = "sha256:3f215c5daf6a9d7bbed4a0a4f760f3113b10e82ff4c5c44bec20a68c8014f675"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1b617618914cb00bf5c34d4357c37aa15183fa229b24767259657746c9077615"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:a6a9ffd280b71ad062eae53ac1659ad86a17f59a0fdc7699fd9be40525153337"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:665f58bfd29b167039f714c6998178d27ccd83984084c286110ef26b230f259f"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:700e4ebb569e59e16a976857c8798aee258dceac7c7d6b50cab63e080058df91"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:e2b4c44b60eadec492926a7270abb100ef9f72798e18743939bdbf037aab8c28"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e79e5db08739731b0ce4850bed599235d601701d5694c36570a99a0c5ca41a9d"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win32.whl", hash = "sha256:955eae71ac26c1ab35924203fda6220f84dce57d6d7884f189743e2abe3a9fbe"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win_amd64.whl", hash = "sha256:56f4252222c067b4ce51ae12cbac231bce32aee1d33fbfc9d17e5b8d6966c312"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03d1162b6d1df1caa3a4bd27aa51ce17c9afc2046c31b0ad60a0a96ec22f8001"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:bba64af9fa9cebe325a62fa398760f5c7206b215201b0ec825005f1b18b9bccf"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:9eb5dee2772b0f704ca2e45b1713e4e5198c18f515b52743576d196348f374d3"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:da09ad1c359a728e112d60116f626cc9f29730ff3e0e7db72b9a2dbc2e4beed5"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:184565012b60405d93838167f425713180b949e9d8dd0bbc7b49f074407c5a8b"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a75879bacf2c987c003368cf14bed0ffe99e8e85acfa6c0bfffc21a090f16880"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win32.whl", hash = "sha256:84b554931e932c46f94ab306913ad7e11bba988104c5cff26d90d03f68258cd5"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win_amd64.whl", hash = "sha256:25ac8c08322002b06fa1d49d1646181f0b2c72f5cbc15a85e80b4c30a544bb15"}, {file = "ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512"}, @@ -2281,4 +2295,4 @@ test = ["freezegun", "pytest", "pytest-cov", "pytest-datadir", "pytest-socket", [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "f2b3078d377e1d8726bb45c51db6920ac30cbf83990aff2469cc92992774c128" +content-hash = "e3ce2db059d43cfc6b442f9091b278c406c0a90eed0140bd4d6e6c0327f9edf4" diff --git a/src/nitpick/resources/toml/__init__.py b/src/nitpick/resources/toml/__init__.py new file mode 100644 index 00000000..69f6e2a1 --- /dev/null +++ b/src/nitpick/resources/toml/__init__.py @@ -0,0 +1 @@ +"""Styles for TOML files.""" diff --git a/src/nitpick/resources/toml/toml-sort.toml b/src/nitpick/resources/toml/toml-sort.toml new file mode 100644 index 00000000..b4cbc8b5 --- /dev/null +++ b/src/nitpick/resources/toml/toml-sort.toml @@ -0,0 +1,15 @@ +[nitpick.meta] +name = "TOML sort" +url = "https://github.com/pappasam/toml-sort" + +[[".pre-commit-config.yaml".repos]] +repo = "https://github.com/pappasam/toml-sort" + +[[".pre-commit-config.yaml".repos.hooks]] +id = "toml-sort-fix" + +["pyproject.toml".tool.tomlsort] +all = true +ignore_case = true +in_place = true +trailing_comma_inline_array = true diff --git a/tests/test_builtin/toml/toml-sort/.pre-commit-config.yaml b/tests/test_builtin/toml/toml-sort/.pre-commit-config.yaml new file mode 100644 index 00000000..b2f08ff4 --- /dev/null +++ b/tests/test_builtin/toml/toml-sort/.pre-commit-config.yaml @@ -0,0 +1,4 @@ +repos: + - repo: https://github.com/pappasam/toml-sort + hooks: + - id: toml-sort-fix diff --git a/tests/test_builtin/toml/toml-sort/pyproject.toml b/tests/test_builtin/toml/toml-sort/pyproject.toml new file mode 100644 index 00000000..01cdfc56 --- /dev/null +++ b/tests/test_builtin/toml/toml-sort/pyproject.toml @@ -0,0 +1,5 @@ +[tool.tomlsort] +all = true +ignore_case = true +in_place = true +trailing_comma_inline_array = true