diff --git a/template/.pre-commit-config.yaml b/template/.pre-commit-config.yaml index 4bcc4aa..b2e627b 100644 --- a/template/.pre-commit-config.yaml +++ b/template/.pre-commit-config.yaml @@ -1,13 +1,5 @@ # See https://pre-commit.com for more information repos: -- repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 -- repo: https://github.com/PyCQA/autoflake - rev: v2.2.1 - hooks: - - id: autoflake - repo: https://github.com/pycqa/bandit rev: 1.7.5 hooks: @@ -16,8 +8,14 @@ repos: rev: v0.1.6 hooks: - id: ruff - args: [ --fix ] + args: [ + --fix, + --config, "pyproject.toml", + ] - id: ruff-format + args: [ + --config, "pyproject.toml", + ] - repo: https://github.com/pycqa/docformatter rev: v1.7.5 hooks: diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 2081508..71639d9 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -46,3 +46,12 @@ requires = [ "wheel", ] build-backend = "setuptools.build_meta" + +[tool.ruff.lint] +select = [ + "E4", "E7", "E9", "F", # Default + "D", # Enable all `pydocstyle` rules +] + +[tool.ruff.lint.pydocstyle] +convention = "pep257" diff --git a/template/tests/test_cli.py.jinja b/template/tests/test_cli.py.jinja index 0c700d6..6b58f1d 100644 --- a/template/tests/test_cli.py.jinja +++ b/template/tests/test_cli.py.jinja @@ -1,9 +1,13 @@ +"""Test CLI.""" import unittest from {{package_name}}.cli import main class TestCLI(unittest.TestCase): + """Test CLI.""" + def test_cli(self): + """Test CLI.""" args = str(5) self.assertEqual(main(args=args), 6) diff --git a/template/tests/test_main.py.jinja b/template/tests/test_main.py.jinja index bb5cf2f..19305b2 100644 --- a/template/tests/test_main.py.jinja +++ b/template/tests/test_main.py.jinja @@ -1,8 +1,12 @@ +"""Test Main.""" import unittest from {{package_name}}.main import add_one class TestMain(unittest.TestCase): + """Test Main.""" + def test_add_one(self): + """Test Main.""" self.assertEqual(add_one(5), 6)