From 1ee37237a346da1bf676a574c43e5a352986a95f Mon Sep 17 00:00:00 2001 From: Ajinkya Udgirkar Date: Thu, 4 Jan 2024 18:33:55 +0530 Subject: [PATCH] Enable toml sort (#346) --- .pre-commit-config.yaml | 4 ++++ pyproject.toml | 50 ++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 14f411dd..a0749a02 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,10 @@ repos: hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort-fix - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint rev: "v3.0.3" diff --git a/pyproject.toml b/pyproject.toml index bceed42c..d7602b7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "setuptools >= 65.3.0", # required by pyproject+setuptools_scm integration and editable installs - "setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme + "setuptools_scm[toml] >= 7.0.5" # required for "no-local-version" scheme ] build-backend = "setuptools.build_meta" @@ -12,9 +12,9 @@ dynamic = ["version"] name = "ansible-compat" description = "Ansible compatibility goodies" readme = "README.md" -authors = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }] -maintainers = [{ "name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com" }] -license = { text = "MIT" } +authors = [{"name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com"}] +maintainers = [{"name" = "Sorin Sbarnea", "email" = "ssbarnea@redhat.com"}] +license = {text = "MIT"} classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -33,7 +33,7 @@ classifiers = [ "Topic :: Software Development :: Bug Tracking", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", - "Topic :: Utilities", + "Topic :: Utilities" ] keywords = ["ansible"] dependencies = [ @@ -43,18 +43,24 @@ dependencies = [ "PyYAML", "subprocess-tee>=0.4.1", "jsonschema>=4.6.0", - "typing-extensions>=4.5.0;python_version<'3.10'", + "typing-extensions>=4.5.0;python_version<'3.10'" ] +[project.optional-dependencies] +docs = ["argparse-manpage", "black", "mkdocs-ansible[lock]>=0.1.2"] +test = ["coverage", "pip-tools", "pytest>=7.2.0", "pytest-mock", "pytest-plus"] + [project.urls] homepage = "https://github.com/ansible/ansible-compat" documentation = "https://ansible-compat.readthedocs.io/" repository = "https://github.com/ansible/ansible-compat" changelog = "https://github.com/ansible/ansible-compat/releases" -[project.optional-dependencies] -docs = ["argparse-manpage", "black", "mkdocs-ansible[lock]>=0.1.2"] -test = ["coverage", "pip-tools", "pytest>=7.2.0", "pytest-mock", "pytest-plus"] +[tool.coverage.report] +exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"] +fail_under = 92 +skip_covered = true +show_missing = true [tool.coverage.run] source = ["src"] @@ -64,11 +70,8 @@ branch = false parallel = true concurrency = ["multiprocessing", "thread"] -[tool.coverage.report] -exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"] -fail_under = 92 -skip_covered = true -show_missing = true +[tool.isort] +profile = "black" [tool.mypy] python_version = 3.9 @@ -78,7 +81,7 @@ disallow_untyped_calls = true disallow_untyped_defs = true disallow_any_generics = true # disallow_any_unimported = True -#; warn_redundant_casts = True +# ; warn_redundant_casts = True # warn_return_any = True # warn_unused_configs = True exclude = "test/local-content" @@ -87,9 +90,6 @@ exclude = "test/local-content" module = "ansible.*" ignore_missing_imports = true -[tool.isort] -profile = "black" - [tool.pylint.BASIC] good-names = [ "f", # filename @@ -99,7 +99,7 @@ good-names = [ "ns", # namespace "ex", "Run", - "_", + "_" ] [tool.pylint.IMPORTS] @@ -115,7 +115,7 @@ disable = [ "too-many-arguments", # PLR0913 "raise-missing-from", # Temporary disable duplicate detection we remove old code from prerun - "duplicate-code", + "duplicate-code" ] [tool.pytest.ini_options] @@ -124,7 +124,7 @@ filterwarnings = [ "error", # py312 ansible-core # https://github.com/ansible/ansible/issues/81906 - "ignore:'importlib.abc.TraversableResources' is deprecated and slated for removal in Python 3.14:DeprecationWarning", + "ignore:'importlib.abc.TraversableResources' is deprecated and slated for removal in Python 3.14:DeprecationWarning" ] testpaths = ["test"] @@ -143,13 +143,10 @@ ignore = [ "PLR0912", # Bug https://github.com/charliermarsh/ruff/issues/4244 "PLR0913", # Bug https://github.com/charliermarsh/ruff/issues/4244 "RUF012", - "PERF203", + "PERF203" ] target-version = "py39" -[tool.ruff.pydocstyle] -convention = "pep257" - [tool.ruff.flake8-pytest-style] parametrize-values-type = "tuple" @@ -160,6 +157,9 @@ known-third-party = ["packaging"] [tool.ruff.per-file-ignores] "test/**/*.py" = ["SLF001", "S101", "FBT001"] +[tool.ruff.pydocstyle] +convention = "pep257" + [tool.setuptools_scm] local_scheme = "no-local-version" write_to = "src/ansible_compat/_version.py"