Skip to content

Commit

Permalink
style: remove black
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W committed Aug 25, 2024
1 parent 95b0c17 commit 63327ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Github Actions](https://github.com/Lee-W/markdown-mermaid/actions/workflows/python-check.yaml/badge.svg)](https://github.com/Lee-W/markdown-mermaid/actions/workflows/python-check.yaml)
[![PyPI Package latest release](https://img.shields.io/pypi/v/markdown-mermaid.svg?style=flat-square)](https://pypi.org/project/markdown-mermaid/)
[![PyPI Package download count (per month)](https://img.shields.io/pypi/dm/markdown-mermaid?style=flat-square)](https://pypi.org/project/markdown-mermaid/)
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ inv test.cov

### Step 10. Reformat source code

Format your code through `black` and `ruff`.
Format your code through `ruff`.

```sh
inv style.format
Expand Down
20 changes: 4 additions & 16 deletions tasks/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,25 @@ def mypy(ctx: Context) -> None:
ctx.run(f"{VENV_PREFIX} mypy")


@task
def black_check(ctx: Context) -> None:
"""Check style through black"""
ctx.run(f"{VENV_PREFIX} black --check {COMMON_TARGETS_AS_STR}")


@task
def commit_check(ctx: Context, remote: str = "origin") -> None:
"""Check commit message through commitizen"""
ctx.run(f"{VENV_PREFIX} cz -nr 3 check --rev-range {remote}/main..", warn=True)


@task(pre=[ruff, mypy, black_check, commit_check], default=True)
@task(pre=[ruff, mypy, commit_check], default=True)
def run(ctx: Context) -> None:
"""Check style through linter (Note that pylint is not included)"""
"""Check style through linter"""
pass


@task
def black(ctx: Context) -> None:
"""Format Python code through Black"""
ctx.run(f"{VENV_PREFIX} black {COMMON_TARGETS_AS_STR}")


@task
def ruff_format(ctx: Context) -> None:
"""Format Python code through ruff"""
ctx.run(f"{VENV_PREFIX} ruff format {COMMON_TARGETS_AS_STR}")


@task(pre=[black, ruff_format])
@task(pre=[ruff_format])
def format(ctx: Context) -> None:
"""Reformat python files through black and ruff"""
"""Reformat python files through and ruff"""
pass

0 comments on commit 63327ba

Please sign in to comment.