Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pydocstyle for openSUSE:Factory checked in at 2023-01-20 17:38:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pydocstyle (Old) and /work/SRC/openSUSE:Factory/.python-pydocstyle.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pydocstyle" Fri Jan 20 17:38:33 2023 rev:14 rq:1059820 version:6.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pydocstyle/python-pydocstyle.changes 2022-08-08 08:44:47.074380354 +0200 +++ /work/SRC/openSUSE:Factory/.python-pydocstyle.new.32243/python-pydocstyle.changes 2023-01-20 17:38:48.580564193 +0100 @@ -1,0 +2,26 @@ +Thu Jan 19 10:24:42 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 6.3.0 + * Add ignore-self-only-init option by @thejcannon in #560 +- Release 6.2.3 + * Fix decorator parsing for async functions by @cdce8p in #577 + * fix: do not pass file names with pre-commit by @yajo in #610 +- Release 6.2.2 + * Fix false positive of google convention missing args + descriptions by @stinovlas in #619 +- Release 6.2.1 + * Add https protocol on websites at the README.rst by @realFranco + in #611 + * Use tomllib/tomli for reading .toml configs by @mgorny in #608 +- Release 6.2.0 + * Exempt properties from D401 by @TomFryers in #546 + * Add support for Python 3.10 by @hugovk in #554 + * Add D419: Add and switch to "Docstring is empty" error code by + @thejcannon in #559 + * Allow for hanging indent when documenting args in Google style + by @rmorshea in #564 + * Fix match option to only consider basename when given a path + argument by @oczkoisse in #550 +- Drop integration-tests-invocation.patch + +------------------------------------------------------------------- Old: ---- integration-tests-invocation.patch pydocstyle-6.1.1.tar.gz New: ---- pydocstyle-6.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pydocstyle.spec ++++++ --- /var/tmp/diff_new_pack.2HDUxf/_old 2023-01-20 17:38:49.344568419 +0100 +++ /var/tmp/diff_new_pack.2HDUxf/_new 2023-01-20 17:38:49.348568440 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pydocstyle # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,34 +16,32 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pydocstyle -Version: 6.1.1 +Version: 6.3.0 Release: 0 Summary: Python docstring style checker License: MIT Group: Development/Languages/Python URL: https://github.com/PyCQA/pydocstyle/ +# Only the Repository Archive has the tests Source: https://github.com/PyCQA/pydocstyle/archive/%{version}.tar.gz#/pydocstyle-%{version}.tar.gz -# Tests invoke pip and pycodestyle directly, when they should use sys.executable. -# https://github.com/PyCQA/pydocstyle/pull/403 -Patch0: integration-tests-invocation.patch -# Tests invoke pip +BuildRequires: %{python_module base >= 3.6} +BuildRequires: %{python_module importlib-metadata >= 2 if %python-base < 3.8} BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six > 1.10.0} -BuildRequires: %{python_module snowballstemmer} -BuildRequires: %{python_module toml} +BuildRequires: %{python_module snowballstemmer >= 2.2.0} +BuildRequires: %{python_module tomli >= 1.2.3 if %python-base < 3.11} BuildRequires: dos2unix BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-six > 1.10.0 -Requires: python-snowballstemmer +Requires: python-snowballstemmer >= 2.2.0 +Requires: (python-importlib-metadata >= 2 if python-base < 3.8) +Requires: (python-tomli >= 1.2.3 if python-base < 3.11) Requires(post): update-alternatives Requires(postun):update-alternatives -Provides: python-pep257 = %{version} +Provides: python-pep257 = %{version}-%{release} Obsoletes: python-pep257 < %{version} BuildArch: noarch %python_subpackages @@ -61,23 +59,21 @@ %prep %setup -q -n pydocstyle-%{version} -%patch0 -p1 -dos2unix README.rst - -# Disable pip fixture -sed -i /^pytestmark/d src/tests/test_integration.py +# Stupid poetry! +sed -i '/version/ s/0.0.0-dev/%{version}/' pyproject.toml +# remove shebang +sed -i -e '/^#! \//, 1d' src/pydocstyle/__main__.py +# Disable pip fixture: We have the package already installed with a proper cmd +# Can't get the builddeps from network +sed -i /^pytestmark.*install_package/d src/tests/test_integration.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/pydocstyle -%{python_expand # -sed -i -e '/^#! \//, 1d' %{buildroot}%{$python_sitelib}/pydocstyle/__main__.py -dos2unix %{buildroot}%{$python_sitelib}/pydocstyle/__main__.py -%fdupes %{buildroot}%{$python_sitelib} -} +%python_expand %fdupes %{buildroot}%{$python_sitelib} %check export PYTHONPATH=$(pwd)/src @@ -94,6 +90,6 @@ %license LICENSE-MIT %python_alternative %{_bindir}/pydocstyle %{python_sitelib}/pydocstyle -%{python_sitelib}/pydocstyle-%{version}-py*.egg-info +%{python_sitelib}/pydocstyle-%{version}.dist-info %changelog ++++++ pydocstyle-6.1.1.tar.gz -> pydocstyle-6.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/.bumpversion.cfg new/pydocstyle-6.3.0/.bumpversion.cfg --- old/pydocstyle-6.1.1/.bumpversion.cfg 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/.bumpversion.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -[bumpversion] -current_version = 6.1.1 -commit = True -parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>.*))? -serialize = - {major}.{minor}.{patch}{release} - {major}.{minor}.{patch} -tag_name = {new_version} - -[bumpversion:part:release] -optional_value = production -values = - rc - production - -[bumpversion:file:setup.py] - -[bumpversion:file:src/pydocstyle/utils.py] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/.github/workflows/pre-release.yml new/pydocstyle-6.3.0/.github/workflows/pre-release.yml --- old/pydocstyle-6.1.1/.github/workflows/pre-release.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/.github/workflows/pre-release.yml 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,38 @@ +--- +name: Test PyPI publish + +on: + release: + types: [prereleased] + +jobs: + build: + runs-on: ubuntu-latest + environment: pypi-dev + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install poetry + run: pipx install poetry + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.7" + cache: "poetry" + + - name: Install dependencies + run: | + poetry env use "3.7" + poetry install + poetry config repositories.testpypi https://test.pypi.org/legacy/ + + - name: Bump version number + run: poetry version ${{ github.event.release.tag_name }} + + - name: Build package + run: poetry build + + - name: Publish package + run: poetry publish -r testpypi -u __token__ -p ${{ secrets.TEST_PYPI_PASSWORD }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/.github/workflows/release.yml new/pydocstyle-6.3.0/.github/workflows/release.yml --- old/pydocstyle-6.1.1/.github/workflows/release.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/.github/workflows/release.yml 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,37 @@ +--- +name: PyPI publish + +on: + release: + types: [released] + +jobs: + build: + runs-on: ubuntu-latest + environment: pypi-prod + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install poetry + run: pipx install poetry + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.7" + cache: "poetry" + + - name: Install dependencies + run: | + poetry env use "3.7" + poetry install + + - name: Bump version number + run: poetry version ${{ github.event.release.tag_name }} + + - name: Build package + run: poetry build + + - name: Publish package + run: poetry publish -u __token__ -p ${{ secrets.PYPI_PASSWORD }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/.github/workflows/test.yml new/pydocstyle-6.3.0/.github/workflows/test.yml --- old/pydocstyle-6.1.1/.github/workflows/test.yml 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/.github/workflows/test.yml 2023-01-17 21:27:44.000000000 +0100 @@ -1,22 +1,28 @@ name: Run tests -on: [push, pull_request] - +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: test-latest: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install tox run: python -m pip install --upgrade pip tox - name: Run Tests - run: tox -e py,install,docs + run: make tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/.gitpod.yml new/pydocstyle-6.3.0/.gitpod.yml --- old/pydocstyle-6.1.1/.gitpod.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/.gitpod.yml 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,15 @@ + +tasks: + - init: pip install -r requirements.txt && pip install -e . + +github: + prebuilds: + master: true + branches: true + pullRequests: true + pullRequestsFromForks: true + addCheck: true + +vscode: + extensions: + - ms-python.python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/Makefile new/pydocstyle-6.3.0/Makefile --- old/pydocstyle-6.1.1/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/Makefile 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,8 @@ +all: format tests + +format: + isort src/pydocstyle + black src/pydocstyle + +tests: + tox -e py,install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/README.rst new/pydocstyle-6.3.0/README.rst --- old/pydocstyle-6.1.1/README.rst 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/README.rst 2023-01-17 21:27:44.000000000 +0100 @@ -21,6 +21,10 @@ .. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 :target: https://pycqa.github.io/isort/ +.. image:: https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod + :target: https://gitpod.io/#https://github.com/PyCQA/pydocstyle + :alt: Gitpod ready-to-code + **pydocstyle** is a static analysis tool for checking compliance with Python docstring conventions. @@ -28,7 +32,7 @@ `PEP 257 <http://www.python.org/dev/peps/pep-0257/>`_ out of the box, but it should not be considered a reference implementation. -**pydocstyle** supports Python 3.6, 3.7 and 3.8. +**pydocstyle** supports Python 3.6+. Quick Start @@ -43,7 +47,7 @@ Run -^^^^ +^^^ .. code:: @@ -56,12 +60,22 @@ D201: No blank lines allowed before function docstring (found 1) ... +Develop +^^^^^^^ + +You can use Gitpod to run pre-configured dev environment in the cloud right from your browser - + +.. image:: https://gitpod.io/button/open-in-gitpod.svg + :target: https://gitpod.io/#https://github.com/PyCQA/pydocstyle + :alt: Open in Gitpod + +Before submitting a PR make sure that you run `make all`. Links ----- -* `Read the full documentation here <http://pydocstyle.org/en/stable/>`_. +* `Read the full documentation here <https://pydocstyle.org/en/stable/>`_. -* `Fork pydocstyle on GitHub <http://github.com/PyCQA/pydocstyle>`_. +* `Fork pydocstyle on GitHub <https://github.com/PyCQA/pydocstyle>`_. * `PyPI project page <https://pypi.python.org/pypi/pydocstyle>`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/docs/conf.py new/pydocstyle-6.3.0/docs/conf.py --- old/pydocstyle-6.1.1/docs/conf.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/docs/conf.py 2023-01-17 21:27:44.000000000 +0100 @@ -134,7 +134,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/docs/error_codes.rst new/pydocstyle-6.3.0/docs/error_codes.rst --- old/pydocstyle-6.1.1/docs/error_codes.rst 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/docs/error_codes.rst 2023-01-17 21:27:44.000000000 +0100 @@ -19,7 +19,7 @@ and D417. The ``numpy`` convention added in v2.0.0 supports the `numpydoc docstring -<https://github.com/numpy/numpydoc>`_ standard. This checks all of of the +<https://github.com/numpy/numpydoc>`_ standard. This checks all of the errors except for D107, D203, D212, D213, D402, D413, D415, D416, and D417. The ``google`` convention added in v4.0.0 supports the `Google Python Style @@ -27,7 +27,7 @@ all the errors except D203, D204, D213, D215, D400, D401, D404, D406, D407, D408, D409 and D413. -These conventions may be specified using `--convention=<name>` when +These conventions may be specified using ``--convention=<name>`` when running pydocstyle from the command line or by specifying the convention in a configuration file. See the :ref:`cli_usage` section for more details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/docs/index.rst new/pydocstyle-6.3.0/docs/index.rst --- old/pydocstyle-6.1.1/docs/index.rst 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/docs/index.rst 2023-01-17 21:27:44.000000000 +0100 @@ -8,7 +8,9 @@ `PEP 257 <http://www.python.org/dev/peps/pep-0257/>`_ out of the box, but it should not be considered a reference implementation. -**pydocstyle** supports Python 3.6, 3.7 and 3.8. +**pydocstyle** supports Python 3.7 through 3.11. + +Although pydocstyle is tries to be compatible with Python 3.6, it is not tested. .. include:: quickstart.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/docs/release_notes.rst new/pydocstyle-6.3.0/docs/release_notes.rst --- old/pydocstyle-6.1.1/docs/release_notes.rst 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/docs/release_notes.rst 2023-01-17 21:27:44.000000000 +0100 @@ -4,6 +4,54 @@ **pydocstyle** version numbers follow the `Semantic Versioning <http://semver.org/>`_ specification. +6.3.0 - January 17th, 2023 +-------------------------- + +New Features + +* Add `ignore-self-only-init` config (#560). + +Bug Fixes + +* Revert - Obey match rules in pre-commit usage (#610). + + +6.2.3 - January 8th, 2023 +--------------------------- + +Bug Fixes + +* Fix decorator parsing for async function. Resolves some false positives + with async functions and ``overload``. (#577) +* Obey match rules in pre-commit usage (#610). + +6.2.2 - January 3rd, 2023 +--------------------------- + +Bug Fixes + +* Fix false positives of D417 in google convention docstrings (#619). + +6.2.1 - January 3rd, 2023 +--------------------------- + +Bug Fixes + +* Use tomllib/tomli to correctly read .toml files (#599, #600). + +6.2.0 - January 2nd, 2023 +--------------------------- + +New Features + +* Allow for hanging indent when documenting args in Google style. (#449) +* Add support for `property_decorators` config to ignore D401. +* Add support for Python 3.10 (#554). +* Replace D10X errors with D419 if docstring exists but is empty (#559). + +Bug Fixes + +* Fix ``--match`` option to only consider filename when matching full paths (#550). 6.1.1 - May 17th, 2021 --------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/docs/snippets/config.rst new/pydocstyle-6.3.0/docs/snippets/config.rst --- old/pydocstyle-6.1.1/docs/snippets/config.rst 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/docs/snippets/config.rst 2023-01-17 21:27:44.000000000 +0100 @@ -44,6 +44,8 @@ * ``match`` * ``match_dir`` * ``ignore_decorators`` +* ``property_decorators`` +* ``ignore_self_only_init`` See the :ref:`cli_usage` section for more information. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/poetry.lock new/pydocstyle-6.3.0/poetry.lock --- old/pydocstyle-6.1.1/poetry.lock 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/poetry.lock 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,82 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "importlib-metadata" +version = "4.8.3" +description = "Read metadata from Python packages" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "importlib_metadata-4.8.3-py3-none-any.whl", hash = "sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e"}, + {file = "importlib_metadata-4.8.3.tar.gz", hash = "sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668"}, +] + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy", "pytest-perf (>=0.9.2)"] + +[[package]] +name = "snowballstemmer" +version = "2.2.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, + {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, +] + +[[package]] +name = "tomli" +version = "1.2.3" +description = "A lil' TOML parser" +category = "main" +optional = true +python-versions = ">=3.6" +files = [ + {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, + {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, +] + +[[package]] +name = "typing-extensions" +version = "4.1.1" +description = "Backported and Experimental Type Hints for Python 3.6+" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"}, + {file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"}, +] + +[[package]] +name = "zipp" +version = "3.6.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, + {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, +] + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["func-timeout", "jaraco.itertools", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] + +[extras] +toml = ["tomli"] + +[metadata] +lock-version = "2.0" +python-versions = ">=3.6" +content-hash = "1abb1b7c1fa0c27846501ad1b5d7916eb5ec6e7961eab46ced6887d16428977a" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/pyproject.toml new/pydocstyle-6.3.0/pyproject.toml --- old/pydocstyle-6.1.1/pyproject.toml 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/pyproject.toml 2023-01-17 21:27:44.000000000 +0100 @@ -1,3 +1,39 @@ +[tool.poetry] +name = "pydocstyle" +version = "0.0.0-dev" +description = "Python docstring style checker" +authors = ["Amir Rachum <a...@rachum.com>", "Sambhav Kothari <sambhavs.em...@gmail.com"] +license = "MIT" +readme = "README.rst" +documentation = "https://www.pydocstyle.org/en/stable/" +homepage = "https://www.pydocstyle.org/en/stable/" +repository = "https://github.com/PyCQA/pydocstyle" +classifiers = [ + "Intended Audience :: Developers", + "Environment :: Console", + "Development Status :: 5 - Production/Stable", + "Operating System :: OS Independent" +] + +[tool.poetry.urls] +"Release Notes" = "https://www.pydocstyle.org/en/stable/release_notes.html" + +[tool.poetry.dependencies] +python = ">=3.6" +snowballstemmer = ">=2.2.0" +tomli = {version = ">=1.2.3", optional = true, python = "<3.11"} +importlib-metadata = {version = ">=2.0.0,<5.0.0", python = "<3.8"} + +[tool.poetry.extras] +toml = ["tomli"] + +[tool.poetry.scripts] +pydocstyle = "pydocstyle.cli:main" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + [tool.black] line-length = 79 target-version = ['py36'] @@ -7,3 +43,16 @@ profile = "black" src_paths = ["src/pydocstyle"] line_length = 79 + +[tool.mypy] +ignore_missing_imports = true +strict_optional = true +disallow_incomplete_defs = true + +[tool.pytest.ini_options] +norecursedirs = ["docs", ".tox"] +addopts = """ + -vv + -rw + --cache-clear + """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/requirements/docs.txt new/pydocstyle-6.3.0/requirements/docs.txt --- old/pydocstyle-6.1.1/requirements/docs.txt 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/requirements/docs.txt 2023-01-17 21:27:44.000000000 +0100 @@ -1,4 +1,5 @@ +Jinja2 +sphinx sphinx_rtd_theme -# Pinned to 1.6.2 due to a bug in 1.6.3. See GitHub PR #270 for details. -# TODO: remove this restriction once 1.6.4 or later is released. -sphinx==1.6.2 +# adding . so that pydocstyle gets installed +. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/requirements/runtime.txt new/pydocstyle-6.3.0/requirements/runtime.txt --- old/pydocstyle-6.1.1/requirements/runtime.txt 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/requirements/runtime.txt 2023-01-17 21:27:44.000000000 +0100 @@ -1,2 +1,3 @@ -snowballstemmer==1.2.1 -toml==0.10.2 +snowballstemmer>=1.2.1 +tomli>=1.2.3; python_version < "3.11" +importlib-metadata<5.0.0,>=2.0.0; python_version < "3.8" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/requirements/tests.txt new/pydocstyle-6.3.0/requirements/tests.txt --- old/pydocstyle-6.1.1/requirements/tests.txt 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/requirements/tests.txt 2023-01-17 21:27:44.000000000 +0100 @@ -1,5 +1,5 @@ -pytest==3.0.2 -pytest-pep8==1.0.6 -mypy==0.782 -black==20.8b1 +pytest==6.2.5 +mypy==0.930 +black==22.3 isort==5.4.2 +types-setuptools diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/setup.py new/pydocstyle-6.3.0/setup.py --- old/pydocstyle-6.1.1/setup.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/setup.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -from setuptools import setup - -# Do not update the version manually - it is managed by `bumpversion`. -version = '6.1.1' - - -requirements = [ - 'snowballstemmer', -] -extra_requirements = { - 'toml': ['toml'], -} - - -setup( - name='pydocstyle', - version=version, - description="Python docstring style checker", - long_description=open('README.rst').read(), - license='MIT', - author='Amir Rachum', - author_email='a...@rachum.com', - url='https://github.com/PyCQA/pydocstyle/', - classifiers=[ - 'Intended Audience :: Developers', - 'Environment :: Console', - 'Development Status :: 5 - Production/Stable', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3 :: Only', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: MIT License', - ], - python_requires='>=3.6', - keywords='pydocstyle, PEP 257, pep257, PEP 8, pep8, docstrings', - packages=('pydocstyle',), - package_dir={'': 'src'}, - package_data={'pydocstyle': ['data/*.txt']}, - install_requires=requirements, - extras_require=extra_requirements, - entry_points={ - 'console_scripts': [ - 'pydocstyle = pydocstyle.cli:main', - ], - }, - project_urls={ - 'Release Notes': 'https://www.pydocstyle.org/en/latest/release_notes.html', - }, -) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/__init__.py new/pydocstyle-6.3.0/src/pydocstyle/__init__.py --- old/pydocstyle-6.1.1/src/pydocstyle/__init__.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/__init__.py 2023-01-17 21:27:44.000000000 +0100 @@ -1,5 +1,6 @@ +from ._version import __version__ + # Temporary hotfix for flake8-docstrings from .checker import ConventionChecker, check from .parser import AllError -from .utils import __version__ from .violations import Error, conventions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/_version.py new/pydocstyle-6.3.0/src/pydocstyle/_version.py --- old/pydocstyle-6.1.1/src/pydocstyle/_version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pydocstyle-6.3.0/src/pydocstyle/_version.py 2023-01-17 21:27:44.000000000 +0100 @@ -0,0 +1,13 @@ +import sys + +if sys.version_info[:2] >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata # pragma: no cover + +# Used to automatically set version number from github actions +# as well as not break when being tested locally +try: + __version__ = metadata.version(__package__) +except metadata.PackageNotFoundError: # pragma: no cover + __version__ = "0.0.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/checker.py new/pydocstyle-6.3.0/src/pydocstyle/checker.py --- old/pydocstyle-6.1.1/src/pydocstyle/checker.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/checker.py 2023-01-17 21:27:44.000000000 +0100 @@ -6,6 +6,7 @@ from collections import namedtuple from itertools import chain, takewhile from re import compile as re +from textwrap import dedent from . import violations from .config import IllegalConfiguration @@ -122,6 +123,8 @@ r"\s*" # Followed by a colon r":" + # Might have a new line and leading whitespace + r"\n?\s*" # Followed by 1 or more characters - which is the docstring for the parameter ".+" ) @@ -131,8 +134,14 @@ source, filename, ignore_decorators=None, + property_decorators=None, ignore_inline_noqa=False, + ignore_self_only_init=False, ): + self.property_decorators = ( + {} if property_decorators is None else property_decorators + ) + self.ignore_self_only_init = ignore_self_only_init module = parse(StringIO(source), filename) for definition in module: for this_check in self.checks: @@ -192,27 +201,27 @@ with a single underscore. """ - if ( - not docstring - and definition.is_public - or docstring - and is_blank(ast.literal_eval(docstring)) - ): + + def method_violation(): + if definition.is_magic: + return violations.D105() + if definition.is_init: + if ( + self.ignore_self_only_init + and len(definition.param_names) == 1 + ): + return None + return violations.D107() + if not definition.is_overload: + return violations.D102() + return None + + if not docstring and definition.is_public: codes = { Module: violations.D100, Class: violations.D101, NestedClass: violations.D106, - Method: lambda: violations.D105() - if definition.is_magic - else ( - violations.D107() - if definition.is_init - else ( - violations.D102() - if not definition.is_overload - else None - ) - ), + Method: method_violation, NestedFunction: violations.D103, Function: ( lambda: violations.D103() @@ -223,6 +232,18 @@ } return codes[type(definition)]() + @check_for(Definition, terminal=True) + def check_docstring_empty(self, definition, docstring): + """D419: Docstring is empty. + + If the user provided a docstring but it was empty, it is like they never provided one. + + NOTE: This used to report as D10X errors. + + """ + if docstring and is_blank(ast.literal_eval(docstring)): + return violations.D419() + @check_for(Definition) def check_one_liners(self, definition, docstring): """D200: One-liner docstrings should fit on one line with quotes. @@ -500,7 +521,11 @@ "Returns the pathname ...". """ - if docstring and not function.is_test: + if ( + docstring + and not function.is_test + and not function.is_property(self.property_decorators) + ): stripped = ast.literal_eval(docstring).strip() if stripped: first_word = strip_non_alphanumeric(stripped.split()[0]) @@ -828,10 +853,52 @@ * The section documents all function arguments (D417) except `self` or `cls` if it is a method. + Documentation for each arg should start at the same indentation + level. For example, in this case x and y are distinguishable:: + + Args: + x: Lorem ipsum dolor sit amet + y: Ut enim ad minim veniam + + In the case below, we only recognize x as a documented parameter + because the rest of the content is indented as if it belongs + to the description for x:: + + Args: + x: Lorem ipsum dolor sit amet + y: Ut enim ad minim veniam """ docstring_args = set() - for line in context.following_lines: - match = ConventionChecker.GOOGLE_ARGS_REGEX.match(line) + + # normalize leading whitespace + if context.following_lines: + # any lines with shorter indent than the first one should be disregarded + first_line = context.following_lines[0] + leading_whitespaces = first_line[: -len(first_line.lstrip())] + + args_content = dedent( + "\n".join( + [ + line + for line in context.following_lines + if line.startswith(leading_whitespaces) or line == "" + ] + ) + ).strip() + + args_sections = [] + for line in args_content.splitlines(keepends=True): + if not line[:1].isspace(): + # This line is the start of documentation for the next + # parameter because it doesn't start with any whitespace. + args_sections.append(line) + else: + # This is a continuation of documentation for the last + # parameter because it does start with whitespace. + args_sections[-1] += line + + for section in args_sections: + match = ConventionChecker.GOOGLE_ARGS_REGEX.match(section) if match: docstring_args.add(match.group(1)) yield from ConventionChecker._check_missing_args( @@ -1040,7 +1107,9 @@ select=None, ignore=None, ignore_decorators=None, + property_decorators=None, ignore_inline_noqa=False, + ignore_self_only_init=False, ): """Generate docstring errors that exist in `filenames` iterable. @@ -1060,6 +1129,8 @@ `ignore_inline_noqa` controls if `# noqa` comments are respected or not. + `ignore_self_only_init` controls if D107 is reported on __init__ only containing `self`. + Examples --------- >>> check(['pydocstyle.py']) @@ -1092,7 +1163,12 @@ with tk.open(filename) as file: source = file.read() for error in ConventionChecker().check_source( - source, filename, ignore_decorators, ignore_inline_noqa + source, + filename, + ignore_decorators, + property_decorators, + ignore_inline_noqa, + ignore_self_only_init, ): code = getattr(error, 'code', None) if code in checked_codes: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/cli.py new/pydocstyle-6.3.0/src/pydocstyle/cli.py --- old/pydocstyle-6.1.1/src/pydocstyle/cli.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/cli.py 2023-01-17 21:27:44.000000000 +0100 @@ -42,12 +42,16 @@ filename, checked_codes, ignore_decorators, + property_decorators, + ignore_self_only_init, ) in conf.get_files_to_check(): errors.extend( check( (filename,), select=checked_codes, ignore_decorators=ignore_decorators, + property_decorators=property_decorators, + ignore_self_only_init=ignore_self_only_init, ) ) except IllegalConfiguration as error: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/config.py new/pydocstyle-6.3.0/src/pydocstyle/config.py --- old/pydocstyle-6.1.1/src/pydocstyle/config.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/config.py 2023-01-17 21:27:44.000000000 +0100 @@ -4,19 +4,24 @@ import itertools import operator import os +import sys from collections import namedtuple from collections.abc import Set from configparser import NoOptionError, NoSectionError, RawConfigParser from functools import reduce from re import compile as re -from .utils import __version__, log +from ._version import __version__ +from .utils import log from .violations import ErrorRegistry, conventions -try: - import toml -except ImportError: # pragma: no cover - toml = None # type: ignore +if sys.version_info >= (3, 11): + import tomllib +else: + try: + import tomli as tomllib + except ImportError: # pragma: no cover + tomllib = None # type: ignore def check_initialized(method): @@ -59,15 +64,15 @@ read_ok = [] for filename in filenames: try: - with open(filename, encoding=encoding) as fp: - if not toml: + with open(filename, "rb") as fp: + if not tomllib: log.warning( "The %s configuration file was ignored, " - "because the `toml` package is not installed.", + "because the `tomli` package is not installed.", filename, ) continue - self._config.update(toml.load(fp)) + self._config.update(tomllib.load(fp)) except OSError: continue if isinstance(filename, os.PathLike): @@ -180,13 +185,18 @@ 'match', 'match-dir', 'ignore-decorators', + 'ignore-self-only-init', ) BASE_ERROR_SELECTION_OPTIONS = ('ignore', 'select', 'convention') DEFAULT_MATCH_RE = r'(?!test_).*\.py' DEFAULT_MATCH_DIR_RE = r'[^\.].*' DEFAULT_IGNORE_DECORATORS_RE = '' + DEFAULT_PROPERTY_DECORATORS = ( + "property,cached_property,functools.cached_property" + ) DEFAULT_CONVENTION = conventions.pep257 + DEFAULT_IGNORE_SELF_ONLY_INIT = False PROJECT_CONFIG_FILES = ( 'setup.cfg', @@ -266,30 +276,48 @@ re(conf.ignore_decorators) if conf.ignore_decorators else None ) + def _get_property_decorators(conf): + """Return the `property_decorators` as None or set.""" + return ( + set(conf.property_decorators.split(",")) + if conf.property_decorators + else None + ) + for name in self._arguments: if os.path.isdir(name): for root, dirs, filenames in os.walk(name): config = self._get_config(os.path.abspath(root)) match, match_dir = _get_matches(config) ignore_decorators = _get_ignore_decorators(config) + property_decorators = _get_property_decorators(config) # Skip any dirs that do not match match_dir dirs[:] = [d for d in dirs if match_dir(d)] - for filename in filenames: + for filename in map(os.path.basename, filenames): if match(filename): full_path = os.path.join(root, filename) yield ( full_path, list(config.checked_codes), ignore_decorators, + property_decorators, + config.ignore_self_only_init, ) else: config = self._get_config(os.path.abspath(name)) match, _ = _get_matches(config) ignore_decorators = _get_ignore_decorators(config) - if match(name): - yield (name, list(config.checked_codes), ignore_decorators) + property_decorators = _get_property_decorators(config) + if match(os.path.basename(name)): + yield ( + name, + list(config.checked_codes), + ignore_decorators, + property_decorators, + config.ignore_self_only_init, + ) # --------------------------- Private Methods ----------------------------- @@ -485,9 +513,18 @@ self._set_add_options(error_codes, child_options) kwargs = dict(checked_codes=error_codes) - for key in ('match', 'match_dir', 'ignore_decorators'): - kwargs[key] = getattr(child_options, key) or getattr( - parent_config, key + for key in ( + 'match', + 'match_dir', + 'ignore_decorators', + 'property_decorators', + 'ignore_self_only_init', + ): + child_value = getattr(child_options, key) + kwargs[key] = ( + child_value + if child_value is not None + else getattr(parent_config, key) ) return CheckConfiguration(**kwargs) @@ -519,9 +556,16 @@ checked_codes = cls._get_checked_errors(options) kwargs = dict(checked_codes=checked_codes) - for key in ('match', 'match_dir', 'ignore_decorators'): + defaults = { + 'match': "MATCH_RE", + 'match_dir': "MATCH_DIR_RE", + 'ignore_decorators': "IGNORE_DECORATORS_RE", + 'property_decorators': "PROPERTY_DECORATORS", + 'ignore_self_only_init': "IGNORE_SELF_ONLY_INIT", + } + for key, default in defaults.items(): kwargs[key] = ( - getattr(cls, f'DEFAULT_{key.upper()}_RE') + getattr(cls, f"DEFAULT_{default}") if getattr(options, key) is None and use_defaults else getattr(options, key) ) @@ -814,6 +858,12 @@ 'basic list previously set by --select, --ignore ' 'or --convention.', ) + add_check( + '--ignore-self-only-init', + default=None, + action='store_true', + help='ignore __init__ methods which only have a self param.', + ) parser.add_option_group(check_group) @@ -855,6 +905,19 @@ ) ), ) + option( + '--property-decorators', + metavar='<property-decorators>', + default=None, + help=( + "consider any method decorated with one of these " + "decorators as a property, and consequently allow " + "a docstring which is not in imperative mood; default " + "is --property-decorators='{}'".format( + cls.DEFAULT_PROPERTY_DECORATORS + ) + ), + ) return parser @@ -862,7 +925,14 @@ # Check configuration - used by the ConfigurationParser class. CheckConfiguration = namedtuple( 'CheckConfiguration', - ('checked_codes', 'match', 'match_dir', 'ignore_decorators'), + ( + 'checked_codes', + 'match', + 'match_dir', + 'ignore_decorators', + 'property_decorators', + 'ignore_self_only_init', + ), ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/parser.py new/pydocstyle-6.3.0/src/pydocstyle/parser.py --- old/pydocstyle-6.1.1/src/pydocstyle/parser.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/parser.py 2023-01-17 21:27:44.000000000 +0100 @@ -89,6 +89,7 @@ 'decorators', 'docstring', 'children', + 'callable_args', 'parent', 'skipped_error_codes', ) # type: Tuple[str, ...] @@ -213,10 +214,16 @@ @property def is_overload(self): """Return True iff the method decorated with overload.""" - for decorator in self.decorators: - if decorator.name == "overload": - return True - return False + return any( + decorator.name == "overload" for decorator in self.decorators + ) + + def is_property(self, property_decorator_names): + """Return True if the method is decorated with any property decorator.""" + return any( + decorator.name in property_decorator_names + for decorator in self.decorators + ) @property def is_test(self): @@ -229,6 +236,11 @@ """ return self.name.startswith('test') or self.name == 'runTest' + @property + def param_names(self): + """Return the parameter names.""" + return self.callable_args + class NestedFunction(Function): """A Python source code nested function.""" @@ -486,6 +498,7 @@ self.current.value, ) if self.current.kind == tk.NAME and self.current.value in [ + 'async', 'def', 'class', ]: @@ -659,8 +672,10 @@ name = self.current.value self.log.debug("parsing %s '%s'", class_.__name__, name) self.stream.move() + callable_args = [] if self.current.kind == tk.OP and self.current.value == '(': parenthesis_level = 0 + in_default_arg = False while True: if self.current.kind == tk.OP: if self.current.value == '(': @@ -669,6 +684,15 @@ parenthesis_level -= 1 if parenthesis_level == 0: break + elif self.current.value == ',': + in_default_arg = False + elif ( + parenthesis_level == 1 + and self.current.kind == tk.NAME + and not in_default_arg + ): + callable_args.append(self.current.value) + in_default_arg = True self.stream.move() if self.current.kind != tk.OP or self.current.value != ':': self.leapfrog(tk.OP, value=":") @@ -705,7 +729,8 @@ decorators, docstring, children, - None, + callable_args, + None, # parent skipped_error_codes, ) for child in definition.children: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/utils.py new/pydocstyle-6.3.0/src/pydocstyle/utils.py --- old/pydocstyle-6.1.1/src/pydocstyle/utils.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/utils.py 2023-01-17 21:27:44.000000000 +0100 @@ -1,12 +1,10 @@ """General shared utilities.""" -import ast import logging import re from itertools import tee, zip_longest from typing import Any, Iterable, Tuple # Do not update the version manually - it is managed by `bumpversion`. -__version__ = '6.1.1' log = logging.getLogger(__name__) #: Regular expression for stripping non-alphanumeric characters diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/pydocstyle/violations.py new/pydocstyle-6.3.0/src/pydocstyle/violations.py --- old/pydocstyle-6.1.1/src/pydocstyle/violations.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/pydocstyle/violations.py 2023-01-17 21:27:44.000000000 +0100 @@ -415,6 +415,10 @@ 'D418', 'Function/ Method decorated with @overload shouldn\'t contain a docstring', ) +D419 = D4xx.create_error( + 'D419', + 'Docstring is empty', +) class AttrDict(dict): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_cases/capitalization.py new/pydocstyle-6.3.0/src/tests/test_cases/capitalization.py --- old/pydocstyle-6.1.1/src/tests/test_cases/capitalization.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_cases/capitalization.py 2023-01-17 21:27:44.000000000 +0100 @@ -13,7 +13,7 @@ # Make sure empty docstrings don't generate capitalization errors. -@expect("D103: Missing docstring in public function") +@expect("D419: Docstring is empty") def empty_docstring(): """""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_cases/sections.py new/pydocstyle-6.3.0/src/tests/test_cases/sections.py --- old/pydocstyle-6.1.1/src/tests/test_cases/sections.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_cases/sections.py 2023-01-17 21:27:44.000000000 +0100 @@ -318,6 +318,17 @@ """ + def test_detailed_description(self, test, another_test, _): # noqa: D213, D407 + """Test a valid args section. + + Args: + test: A parameter. + another_test: Another parameter. + + Detailed description. + + """ + @expect("D417: Missing argument descriptions in the docstring " "(argument(s) test, y, z are missing descriptions in " "'test_missing_args' docstring)", arg_count=5) @@ -367,10 +378,7 @@ """ @staticmethod - @expect("D417: Missing argument descriptions in the docstring " - "(argument(s) skip, verbose are missing descriptions in " - "'test_missing_docstring_another' docstring)", arg_count=2) - def test_missing_docstring_another(skip, verbose): # noqa: D213, D407 + def test_hanging_indent(skip, verbose): # noqa: D213, D407 """Do stuff. Args: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_cases/test.py new/pydocstyle-6.3.0/src/tests/test_cases/test.py --- old/pydocstyle-6.1.1/src/tests/test_cases/test.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_cases/test.py 2023-01-17 21:27:44.000000000 +0100 @@ -13,7 +13,7 @@ class class_: - expect('meta', 'D106: Missing docstring in public nested class') + expect('meta', 'D419: Docstring is empty') class meta: """""" @@ -42,6 +42,11 @@ "D418: Function/ Method decorated with @overload" " shouldn't contain a docstring") + @property + def foo(self): + """The foo of the thing, which isn't in imperitive mood.""" + return "hello" + @expect('D102: Missing docstring in public method') def __new__(self=None): pass @@ -59,13 +64,13 @@ pass -@expect('D103: Missing docstring in public function') +@expect('D419: Docstring is empty') def function(): """ """ def ok_since_nested(): pass - @expect('D103: Missing docstring in public function') + @expect('D419: Docstring is empty') def nested(): '' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_decorators.py new/pydocstyle-6.3.0/src/tests/test_decorators.py --- old/pydocstyle-6.1.1/src/tests/test_decorators.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_decorators.py 2023-01-17 21:27:44.000000000 +0100 @@ -1,6 +1,6 @@ """Unit test for pydocstyle module decorator handling. -Use tox or py.test to run the test suite. +Use tox or pytest to run the test suite. """ import io @@ -130,6 +130,21 @@ assert 'first_decorator' == decorators[0].name assert '' == decorators[0].arguments + def test_parse_async_function_decorator(self): + """Decorators for async functions are also accumulated.""" + code = textwrap.dedent("""\ + @first_decorator + async def some_method(self): + pass + """) + + module = checker.parse(io.StringIO(code), 'dummy.py') + decorators = module.children[0].decorators + + assert 1 == len(decorators) + assert 'first_decorator' == decorators[0].name + assert '' == decorators[0].arguments + def test_parse_method_nested_decorator(self): """Method decorators are accumulated for nested methods.""" code = textwrap.dedent("""\ @@ -167,10 +182,10 @@ dunder_all, None, None, '') cls = parser.Class('ClassName', source, 0, 1, [], - 'Docstring for class', children, module, '') + 'Docstring for class', children, [], module, '') return parser.Method(name, source, 0, 1, [], - 'Docstring for method', children, cls, '') + 'Docstring for method', children, [], cls, '') def test_is_public_normal(self): """Test that methods are normally public, even if decorated.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_definitions.py new/pydocstyle-6.3.0/src/tests/test_definitions.py --- old/pydocstyle-6.1.1/src/tests/test_definitions.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_definitions.py 2023-01-17 21:27:44.000000000 +0100 @@ -5,6 +5,9 @@ import pytest from pydocstyle.violations import Error, ErrorRegistry from pydocstyle.checker import check +from pydocstyle.config import ConfigurationParser + +DEFAULT_PROPERTY_DECORATORS = ConfigurationParser.DEFAULT_PROPERTY_DECORATORS @pytest.mark.parametrize('test_case', [ @@ -35,10 +38,14 @@ test_case_file = os.path.join(test_case_dir, 'test_cases', test_case + '.py') - results = list(check([test_case_file], - select=set(ErrorRegistry.get_error_codes()), - ignore_decorators=re.compile( - 'wraps|ignored_decorator'))) + results = list( + check( + [test_case_file], + select=set(ErrorRegistry.get_error_codes()), + ignore_decorators=re.compile('wraps|ignored_decorator'), + property_decorators=DEFAULT_PROPERTY_DECORATORS, + ) + ) for error in results: assert isinstance(error, Error) results = {(e.definition.name, e.message) for e in results} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_integration.py new/pydocstyle-6.3.0/src/tests/test_integration.py --- old/pydocstyle-6.1.1/src/tests/test_integration.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_integration.py 2023-01-17 21:27:44.000000000 +0100 @@ -1,4 +1,4 @@ -"""Use tox or py.test to run the test-suite.""" +"""Use tox or pytest to run the test-suite.""" from collections import namedtuple @@ -121,7 +121,7 @@ pass -@pytest.yield_fixture(scope="module") +@pytest.fixture(scope="module") def install_package(request): """Install the package in development mode for the tests. @@ -138,7 +138,7 @@ ) -@pytest.yield_fixture(scope="function", params=['ini', 'toml']) +@pytest.fixture(scope="function", params=['ini', 'toml']) def env(request): """Add a testing environment to a test method.""" sandbox_settings = { @@ -621,6 +621,36 @@ assert 'D103' not in out +def test_overload_async_function(env): + """Async functions decorated with @overload trigger D418 error.""" + with env.open('example.py', 'wt') as example: + example.write(textwrap.dedent('''\ + from typing import overload + + + @overload + async def overloaded_func(a: int) -> str: + ... + + + @overload + async def overloaded_func(a: str) -> str: + """Foo bar documentation.""" + ... + + + async def overloaded_func(a): + """Foo bar documentation.""" + return str(a) + + ''')) + env.write_config(ignore="D100") + out, err, code = env.invoke() + assert code == 1 + assert 'D418' in out + assert 'D103' not in out + + def test_overload_method(env): """Methods decorated with @overload trigger D418 error.""" with env.open('example.py', 'wt') as example: @@ -714,6 +744,36 @@ assert code == 0 +def test_overload_async_function_valid(env): + """Valid case for overload decorated async functions. + + This shouldn't throw any errors. + """ + with env.open('example.py', 'wt') as example: + example.write(textwrap.dedent('''\ + from typing import overload + + + @overload + async def overloaded_func(a: int) -> str: + ... + + + @overload + async def overloaded_func(a: str) -> str: + ... + + + async def overloaded_func(a): + """Foo bar documentation.""" + return str(a) + + ''')) + env.write_config(ignore="D100") + out, err, code = env.invoke() + assert code == 0 + + def test_overload_nested_function(env): """Nested functions decorated with @overload trigger D418 error.""" with env.open('example.py', 'wt') as example: @@ -1489,3 +1549,39 @@ out, _, code = env.invoke() assert '' == out assert code == 0 + + +def test_ignore_self_only_init(env): + """Test that ignore_self_only_init works ignores __init__ with only self.""" + with env.open('example.py', 'wt') as example: + example.write(textwrap.dedent("""\ + class Foo: + def __init__(self): + pass + """)) + + env.write_config(ignore_self_only_init=True, select="D107") + out, err, code = env.invoke() + assert '' == out + assert code == 0 + +def test_match_considers_basenames_for_path_args(env): + """Test that `match` option only considers basenames for path arguments. + + The test environment consists of a single empty module `test_a.py`. The + match option is set to a pattern that ignores test_ prefixed .py filenames. + When pydocstyle is invoked with full path to `test_a.py`, we expect it to + succeed since match option will match against just the file name and not + full path. + """ + # Ignore .py files prefixed with 'test_' + env.write_config(select='D100', match='(?!test_).+.py') + + # Create an empty module (violates D100) + with env.open('test_a.py', 'wt') as test: + test.write('') + + # env.invoke calls pydocstyle with full path to test_a.py + out, _, code = env.invoke(target='test_a.py') + assert '' == out + assert code == 0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/src/tests/test_utils.py new/pydocstyle-6.3.0/src/tests/test_utils.py --- old/pydocstyle-6.1.1/src/tests/test_utils.py 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/src/tests/test_utils.py 2023-01-17 21:27:44.000000000 +0100 @@ -1,6 +1,6 @@ """Unit test for pydocstyle utils. -Use tox or py.test to run the test suite. +Use tox or pytest to run the test suite. """ from pydocstyle import utils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pydocstyle-6.1.1/tox.ini new/pydocstyle-6.3.0/tox.ini --- old/pydocstyle-6.1.1/tox.ini 2021-05-17 22:35:35.000000000 +0200 +++ new/pydocstyle-6.3.0/tox.ini 2023-01-17 21:27:44.000000000 +0100 @@ -4,7 +4,7 @@ # install tox" and then run "tox" from this directory. [tox] -envlist = {py36,py37,py38,py39}-{tests,install},docs,install,py36-docs +envlist = py{36,37,38,39,310,311}-{tests,install},docs,install,py36-docs [testenv] download = true @@ -13,10 +13,10 @@ setenv = LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 -# To pass arguments to py.test, use `tox [options] -- [pytest posargs]`. +# To pass arguments to pytest, use `tox [options] -- [pytest posargs]`. commands = - py.test --pep8 --cache-clear -vv src/tests {posargs} - mypy --config-file=tox.ini src/ + pytest src/tests {posargs} + mypy src/ black --check src/pydocstyle isort --check src/pydocstyle deps = @@ -26,7 +26,7 @@ [testenv:install] skip_install = True commands = - python setup.py bdist_wheel + pip wheel . -w dist --no-deps pip install --no-index --find-links=dist pydocstyle pydocstyle --help @@ -61,18 +61,13 @@ skip_install = {[testenv:install]skip_install} commands = {[testenv:install]commands} -[pytest] -pep8ignore = - test.py E701 E704 -norecursedirs = docs .tox -addopts = -rw - -[pep257] -inherit = false -convention = pep257 -add-select = D404 - -[mypy] -ignore_missing_imports = true -strict_optional = true -disallow_incomplete_defs = true +[testenv:py310-install] +skip_install = {[testenv:install]skip_install} +commands = {[testenv:install]commands} + + +[testenv:py311-install] +skip_install = {[testenv:install]skip_install} +commands = {[testenv:install]commands} + +