Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify positional and keyword arguments when checking for missing arguments in docstring #4067

Merged
merged 8 commits into from
Apr 25, 2023

Conversation

evanrittenhouse
Copy link
Contributor

@evanrittenhouse evanrittenhouse commented Apr 22, 2023

Fixes #4047.

We were previously at risk of false positives when an argument was specified in the Arguments section and not in Keyword Arguments, or vice versa. Rather than checking arguments on a section-by-section basis, this PR combines positional and keyword arguments into one set then checks that superset against the function signature.

It also adds Other Params/Other Args/Other Arguments identifiers to the SectionKind enum.

@evanrittenhouse evanrittenhouse changed the title 4047 docs kwargs Unify positional and keyword arguments when checking for missing arguments in docstring Apr 22, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 22, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+4, -3, 0 error(s))

bokeh (+3, -3)

- src/bokeh/application/application.py:90:9: D417 Missing argument description in the docstring: `metadata`
+ src/bokeh/application/handlers/server_lifecycle.py:57:9: D417 Missing argument description in the docstring: `package`
+ src/bokeh/application/handlers/server_request_handler.py:59:9: D417 Missing argument description in the docstring: `package`
- src/bokeh/core/enums.py:198:5: D417 Missing argument descriptions in the docstring: `case_sensitive`, `quote`
+ src/bokeh/models/plots.py:124:9: D417 Missing argument description in the docstring: `*args`
- src/bokeh/models/plots.py:124:9: D417 Missing argument descriptions in the docstring: `**kwargs`, `*args`

zulip (+1, -0)

+ zerver/lib/tex.py:11:5: D417 Missing argument descriptions in the docstring: `is_inline`, `tex`

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.01     15.6±0.06ms     2.6 MB/sec    1.00     15.4±0.04ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.9±0.00ms     4.3 MB/sec    1.00      3.9±0.00ms     4.3 MB/sec
linter/all-rules/numpy/globals.py          1.00    428.6±2.04µs     6.9 MB/sec    1.00    429.2±1.23µs     6.9 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.6±0.01ms     3.9 MB/sec    1.00      6.6±0.01ms     3.9 MB/sec
linter/default-rules/large/dataset.py      1.00      8.1±0.01ms     5.0 MB/sec    1.00      8.1±0.01ms     5.0 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1771.4±2.08µs     9.4 MB/sec    1.00   1775.5±2.74µs     9.4 MB/sec
linter/default-rules/numpy/globals.py      1.00    185.4±0.78µs    15.9 MB/sec    1.00    184.8±0.54µs    16.0 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.7±0.01ms     6.9 MB/sec    1.00      3.7±0.01ms     6.9 MB/sec
parser/large/dataset.py                    1.00      6.5±0.02ms     6.3 MB/sec    1.03      6.7±0.01ms     6.1 MB/sec
parser/numpy/ctypeslib.py                  1.00   1263.7±1.23µs    13.2 MB/sec    1.01   1270.2±1.85µs    13.1 MB/sec
parser/numpy/globals.py                    1.01    127.0±0.42µs    23.2 MB/sec    1.00    126.1±0.85µs    23.4 MB/sec
parser/pydantic/types.py                   1.00      2.8±0.01ms     9.2 MB/sec    1.00      2.8±0.00ms     9.2 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     16.9±0.17ms     2.4 MB/sec    1.01     17.2±0.19ms     2.4 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.4±0.05ms     3.8 MB/sec    1.01      4.4±0.04ms     3.8 MB/sec
linter/all-rules/numpy/globals.py          1.00    536.0±6.06µs     5.5 MB/sec    1.01    542.9±7.17µs     5.4 MB/sec
linter/all-rules/pydantic/types.py         1.00      7.2±0.08ms     3.5 MB/sec    1.00      7.3±0.06ms     3.5 MB/sec
linter/default-rules/large/dataset.py      1.01      8.9±0.06ms     4.6 MB/sec    1.00      8.8±0.07ms     4.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1935.2±29.80µs     8.6 MB/sec    1.00  1933.8±17.50µs     8.6 MB/sec
linter/default-rules/numpy/globals.py      1.00    215.0±3.76µs    13.7 MB/sec    1.04   224.1±16.98µs    13.2 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.0±0.04ms     6.3 MB/sec    1.00      4.0±0.06ms     6.3 MB/sec
parser/large/dataset.py                    1.01      6.8±0.05ms     5.9 MB/sec    1.00      6.8±0.05ms     6.0 MB/sec
parser/numpy/ctypeslib.py                  1.00  1298.7±13.78µs    12.8 MB/sec    1.00  1302.5±15.60µs    12.8 MB/sec
parser/numpy/globals.py                    1.00    130.7±1.90µs    22.6 MB/sec    1.00    131.1±1.85µs    22.5 MB/sec
parser/pydantic/types.py                   1.00      2.9±0.03ms     8.7 MB/sec    1.00      2.9±0.03ms     8.7 MB/sec

@evanrittenhouse evanrittenhouse marked this pull request as ready for review April 23, 2023 00:17
@evanrittenhouse evanrittenhouse changed the title Unify positional and keyword arguments when checking for missing arguments in docstring Unify positional and keyword arguments when checking for missing arguments in Google-style docstring Apr 23, 2023
@evanrittenhouse evanrittenhouse changed the title Unify positional and keyword arguments when checking for missing arguments in Google-style docstring Unify positional and keyword arguments when checking for missing arguments in docstring Apr 23, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) April 25, 2023 05:14
@charliermarsh charliermarsh added bug Something isn't working docstring Related to docstring linting or formatting labels Apr 25, 2023
@charliermarsh charliermarsh merged commit ae6f383 into astral-sh:main Apr 25, 2023
renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Apr 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://github.com/charliermarsh/ruff) | `^0.0.262` ->
`^0.0.263` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/compatibility-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/confidence-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.263`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.263)

[Compare
Source](https://github.com/charliermarsh/ruff/compare/v0.0.262...v0.0.263)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

#### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

**Full Changelog**:
astral-sh/ruff@v0.0.262...v0.0.263

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41OC4yIiwidXBkYXRlZEluVmVyIjoiMzUuNTguMiJ9-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/flux-local that referenced this pull request Apr 27, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://github.com/charliermarsh/ruff) | `==0.0.262` ->
`==0.0.263` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/compatibility-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/confidence-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.263`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.263)

[Compare
Source](https://github.com/charliermarsh/ruff/compare/v0.0.262...v0.0.263)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

#### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

**Full Changelog**:
astral-sh/ruff@v0.0.262...v0.0.263

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41OC4yIiwidXBkYXRlZEluVmVyIjoiMzUuNTguMiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/pyrainbird that referenced this pull request Apr 27, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://github.com/charliermarsh/ruff) | `==0.0.262` ->
`==0.0.263` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/compatibility-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/confidence-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.263`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.263)

[Compare
Source](https://github.com/charliermarsh/ruff/compare/v0.0.262...v0.0.263)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

##### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

##### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

**Full Changelog**:
astral-sh/ruff@v0.0.262...v0.0.263

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41OC4yIiwidXBkYXRlZEluVmVyIjoiMzUuNTguMiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@evanrittenhouse evanrittenhouse deleted the 4047_docs_kwargs branch June 15, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docstring Related to docstring linting or formatting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False D417 when arguments some are keyword only.
2 participants