diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 3270d96259..0000000000 --- a/.flake8 +++ /dev/null @@ -1,7 +0,0 @@ -[flake8] -exclude = __init__.py, doc/_build, .venv -select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403 -count = True -max-complexity = 10 -max-line-length = 80 -statistics = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec407a8978..f14c6bb3a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,30 +1,14 @@ repos: -- repo: https://github.com/psf/black - rev: 22.8.0 +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.1.2 hooks: - - id: black - -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - -- repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 - hooks: - - id: flake8 + - id: ruff + args: [--fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.1 + rev: v2.2.6 hooks: - id: codespell additional_dependencies: - tomli - -- repo: https://github.com/pycqa/pydocstyle - rev: 6.1.1 - hooks: - - id: pydocstyle - additional_dependencies: [toml] - exclude: "tests/" diff --git a/pyproject.toml b/pyproject.toml index 27bc04c67f..03aad6c4c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,19 +54,41 @@ Documentation = "https://stk.docs.pyansys.com/" Source = "https://github.com/pyansys/pystk" Tracker = "https://github.com/pyansys/pystk/issues" -[tool.black] -line-length = 80 +[tool.ruff] +line-length = 120 +select = [ + "E", # pycodestyle, see https://beta.ruff.rs/docs/rules/#pycodestyle-e-w + "D", # pydocstyle, see https://beta.ruff.rs/docs/rules/#pydocstyle-d + "F", # pyflakes, see https://beta.ruff.rs/docs/rules/#pyflakes-f + "I", # isort, see https://beta.ruff.rs/docs/rules/#isort-i + "N", # pep8-naming, see https://beta.ruff.rs/docs/rules/#pep8-naming-n + "PTH", # flake8-use-pathlib, https://beta.ruff.rs/docs/rules/#flake8-use-pathlib-pth +] +ignore = [ + "E501", # Line too long. Ignoring this so "ruff.formatter" manages line length. + "D203", # One blank line required before class docstring. + "D204" # One blank line required after class docstring. +] +extend-exclude = [ + "src/ansys/stk/core/internal/*.py", + "tests/**/*.py", +] -[tool.isort] -profile = "black" -force_sort_within_sections = true -line_length = 80 -default_section = "THIRDPARTY" -src_paths = ["examples", "doc", "src", "tests"] +[tool.ruff.format] +quote-style = "single" +indent-style = "tab" + +[tool.ruff.isort] +combine-as-imports = true +force-sort-within-sections = true +known-first-party = ["ansys"] [tool.codespell] ignore-words = "doc/styles/Vocab/ANSYS/accept.txt" +[tool.ruff.mccabe] +max-complexity = 10 + [tool.coverage.run] relative_files = true