diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index bb151c0d74..f78a90d874 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,4 +1,4 @@ -name: Run Python and Bazel google-benchmark pre-commit checks +name: python + Bazel pre-commit checks on: push: @@ -37,7 +37,3 @@ jobs: - name: Run pre-commit checks run: | pre-commit run --all-files --verbose --show-diff-on-failure - - - name: Run pylint - run: | - pylint `find . -name '*.py'|xargs` || pylint-exit $? diff --git a/pyproject.toml b/pyproject.toml index d8dad76516..0bac140bb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,3 +54,37 @@ where = ["bindings/python"] [tool.setuptools.dynamic] version = { attr = "google_benchmark.__version__" } readme = { file = "README.md", content-type = "text/markdown" } + +[tool.black] +# Source https://github.com/psf/black#configuration-format +include = "\\.pyi?$" +line-length = 80 +target-version = ["py311"] + +# Black-compatible settings for isort +# See https://black.readthedocs.io/en/stable/ +[tool.isort] +line_length = "80" +profile = "black" + +[tool.mypy] +check_untyped_defs = true +disallow_incomplete_defs = true +pretty = true +python_version = "3.11" +strict_optional = false +warn_unreachable = true + +[[tool.mypy.overrides]] +module = ["yaml"] +ignore_missing_imports = true + +[tool.ruff] +# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. +select = ["E", "F", "W"] +ignore = [ + # whitespace before colon (:), rely on black for formatting (in particular, allow spaces before ":" in list/array slices) + "E203", + # line too long, rely on black for reformatting of these, since sometimes URLs or comments can be longer + "E501", +]