diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e108eb9b..31db48975 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: debug-statements - id: no-commit-to-branch - id: check-merge-conflict - - id: check-toml + - id: check-toml # TOML linter (syntax checker) - id: check-yaml args: [ '--unsafe' ] # for mkdocs.yml - id: detect-private-key @@ -55,17 +55,22 @@ repos: stages: - post-commit + - repo: https://github.com/ComPWA/taplo-pre-commit + rev: v0.9.3 + hooks: + - id: taplo-format + - repo: local hooks: - id: format - name: Format + name: Format Python code via Poetry language: system pass_filenames: false entry: poetry format types: [ python ] - id: linter and test - name: Linters + name: Linters via Poetry language: system pass_filenames: false entry: poetry lint diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 000000000..36a3453ac --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,4 @@ +include = ["pyproject.toml", ".taplo.toml"] + +[formatting] +indent_string = " " diff --git a/docs/contributing.md b/docs/contributing.md index 0da1707da..90a905aad 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -104,5 +104,10 @@ flowchart TD review ``` +## Install [taplo](https://taplo.tamasfe.dev/cli/installation/cargo.html) (toml formatter) + +TODO: adjust this when the major documentation changes are merged + + [conventional-commits]: https://www.conventionalcommits.org/ diff --git a/pyproject.toml b/pyproject.toml index b306e5e78..b0d645ef5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -250,12 +250,7 @@ cover.help = "Run the test suite with coverage" cover.ref = "test --cov-report term-missing --cov-report=xml:coverage.xml --cov=commitizen" all.help = "Run all tasks" -all.sequence = [ - "format", - "lint", - "cover", - "check-commit", -] +all.sequence = ["format", "lint", "cover", "check-commit"] "doc:screenshots".help = "Render documentation screeenshots" "doc:screenshots".script = "scripts.gen_cli_help_screenshots:gen_cli_help_screenshots" @@ -267,10 +262,7 @@ doc.help = "Live documentation server" doc.cmd = "mkdocs serve" ci.help = "Run all tasks in CI" -ci.sequence = [ - { cmd = "pre-commit run --all-files" }, - "cover", -] +ci.sequence = [{ cmd = "pre-commit run --all-files" }, "cover"] ci.env = { SKIP = "no-commit-to-branch" } setup-pre-commit.help = "Install pre-commit hooks"