From 0b0fc31727156a64616fa0563b63b9f626b79f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Thu, 2 Nov 2023 13:01:23 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9E=95=20Add=20`black`,=20`mypy`,=20and?= =?UTF-8?q?=20`ruff`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1ae2635..56aec54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,11 @@ dependencies = [] dev = [ "pre-commit", ] +lint = [ + "black", + "mypy", + "ruff", +] [tool.setuptools.packages.find] include = ["gitmojis*"] From 6f52b59a2b70d8b5c7c510c649c13dde62b6c9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Thu, 2 Nov 2023 13:02:47 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=94=A7=20Configure=20code=20quality?= =?UTF-8?q?=20tools=20in=20`pyproject.toml`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 56aec54..b11f8c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,3 +24,60 @@ lint = [ [tool.setuptools.packages.find] include = ["gitmojis*"] where = ["src"] + +# Black +# https://black.readthedocs.io/en/stable/usage_and_configuration/ + +[tool.black] +line-length = 88 +target-version = ["py312", "py311", "py310"] + +# Mypy +# https://mypy.readthedocs.io/en/stable/config_file.html + +[tool.mypy] +exclude = [ + '^(?:(?!src).)*$', +] +show_error_codes = true +disallow_any_generics = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +check_untyped_defs = true +no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_no_return = true +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Ruff +# https://docs.astral.sh/ruff/configuration/ +# https://docs.astral.sh/ruff/rules/ +# https://docs.astral.sh/ruff/settings/ + +[tool.ruff] +select = [ + "F", # pyflakes + "E", # pycodestyle (errors) + "W", # pycodestyle (warnings) + "I", # isort + "N", # pep8-naming + "D", # pydocstyle + "B", # flake8-bugbear + "A", # flake8-builtins + "C4", # flake8-comprehensions + "T20", # flake8-print + "Q", # flake8-quotes + "PTH", # flake8-use-pathlib +] +ignore = ["E501", "N818", "D1", "D205"] + +[tool.ruff.pydocstyle] +convention = "google" + +[tool.ruff.isort] +known-first-party = ["gitmojis"] From f2e9914745f4aeff5a23fea4af3f1fd0748eee6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Thu, 2 Nov 2023 13:03:34 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=99=88=20Exclude=20code=20quality=20t?= =?UTF-8?q?ool=20caches=20from=20version=20control?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 51151e5..3193773 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,9 @@ __pycache__/ build/ dist/ *.egg-info/ + +# Mypy +.mypy_cache/ + +# Ruff +.ruff_cache/ From b9b775e3f4403c734036da22a29cc780d6d69437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Thu, 2 Nov 2023 13:04:30 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=A7=20Set=20up=20code=20quality=20?= =?UTF-8?q?tools=20as=20Pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee61962..f2d3e9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,22 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: '23.10.1' + hooks: + - id: black + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v1.6.1' + hooks: + - id: mypy + exclude: '^(?:(?!src).)*$' + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: 'v0.1.3' + hooks: + - id: ruff + args: + - --fix + - --exit-non-zero-on-fix ci: autofix_commit_msg: From 2ec6e587b1d6a8b6c1a9f2b6493e2345a5213fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Paduszyn=CC=81ski?= Date: Thu, 2 Nov 2023 13:05:36 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=93=9D=20Add=20code=20quality=20tools?= =?UTF-8?q?=20badges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index dc5da8c..4409ff3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit)][pre-commit.ci] +[![ruff](https://img.shields.io/endpoint?style=flat-square&url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)][ruff] +[![mypy](https://img.shields.io/badge/type--checked-mypy-blue?style=flat-square)][mypy] +[![black](https://img.shields.io/badge/code%20style-black-black?style=flat-square)][black] + ## Summary This package provides a few simple utilities to apply the official @@ -25,9 +29,12 @@ Created by Kamil PaduszyƄski ([@paduszyk][github-paduszyk]). Released under the [MIT License][license]. +[black]: https://github.com/psf/black [github-carlosquesta]: https://github.com/carloscuesta [github-paduszyk]: https://github.com/paduszyk [gitmoji-repository]: https://github.com/carloscuesta/gitmoji [gitmoji-website]: https://gitmoji.dev [license]: https://github.com/paduszyk/python-gitmojis/blob/main/LICENSE +[mypy]: https://github.com/python/mypy [pre-commit.ci]: https://results.pre-commit.ci/latest/github/paduszyk/python-gitmojis/main +[ruff]: https://github.com/astral-sh/ruff