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

Allow lists of default values in parameter documentation for Numpy #7149

Merged
merged 2 commits into from Jul 8, 2022

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature, or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Closes #4035.

I really don't want to talk about the number of hours it took me to get this regex right. The fact that I assigned this to myself in October is a small indication...

@DanielNoord DanielNoord added Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer False Positive 🦟 A message is emitted but nothing is wrong with the code labels Jul 8, 2022
@DanielNoord DanielNoord added this to the 2.14.5 milestone Jul 8, 2022
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're hitting the limit of what regex are good for, but as you spent 9 months to birth it let's put a diaper on the little re_param_line and try to keep it alive and clean now πŸ˜„

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2638482339

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0003%) to 95.385%

Totals Coverage Status
Change from base Build 2635805584: 0.0003%
Covered Lines: 16700
Relevant Lines: 17508

πŸ’› - Coveralls

@DanielNoord
Copy link
Collaborator Author

I think we're hitting the limit of what regex are good for, but as you spent 9 months to birth it let's put a diaper on the little re_param_line and try to keep it alive and clean now πŸ˜„

It's also that some of these regexes are really quite bad. Using both f-strings and regular expressions from different classes and in different recursive patterns is awful to work with. You can't easily copy them to regex101 and try to fix something.
That made this really difficult.

@DanielNoord DanielNoord merged commit 254b260 into pylint-dev:main Jul 8, 2022
@DanielNoord DanielNoord deleted the numpy branch July 8, 2022 20:57
@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2022

πŸ€– Effect of this PR on checked open source code: πŸ€–

Effect on pandas:
The following messages are now emitted:

  1. missing-param-doc:
    "dest" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/_testing/_io.py#L371
  2. missing-param-doc:
    "ax, figsize, frame, range_padding" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/plotting/_misc.py#L83
  3. missing-param-doc:
    "axes" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/tests/plotting/common.py#L296
  4. missing-param-doc:
    "fill_value, limit" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/resample.py#L1418
  5. missing-param-doc:
    "q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L2577
  6. missing-param-doc:
    "left, right" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L5535
  7. missing-param-doc:
    "copy, freq" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L5848
  8. missing-param-doc:
    *"**kwargs, args, skipna" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/base.py#L658
  9. missing-param-doc:
    "mapper" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/base.py#L796
  10. missing-param-doc:
    "values" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/missing.py#L172
  11. missing-param-doc:
    "axis, numeric_only, q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/frame.py#L11123
  12. missing-param-doc:
    "axis, copy, freq" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/frame.py#L11295
  13. missing-param-doc:
    "mapper" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/base.py#L6340
  14. missing-param-doc:
    "label, side" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/multi.py#L2652
  15. missing-param-doc:
    "limit" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/groupby/groupby.py#L2817
  16. missing-param-doc:
    "numeric_only, q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/groupby/groupby.py#L3171
  17. missing-param-doc:
    "axis, color, left, props, right, subset" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L3475
  18. missing-param-doc:
    "axis, color, interpolation, props, q_left, q_right, subset" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L3579
  19. missing-param-doc:
    "color" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L4101

The following messages are no longer emitted:

  1. missing-param-doc:
    "compression" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/_testing/contexts.py#L23
  2. missing-param-doc:
    "compression, dest" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/_testing/_io.py#L371
  3. missing-param-doc:
    "ax, diagonal, figsize, frame, range_padding" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/plotting/_misc.py#L83
  4. missing-param-doc:
    "axes, xaxis, yaxis" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/tests/plotting/common.py#L296
  5. missing-param-doc:
    "method" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/resample.py#L730
  6. missing-param-doc:
    "fill_value, limit, method" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/resample.py#L1418
  7. missing-param-doc:
    "interpolation, q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L2577
  8. missing-param-doc:
    "inclusive, left, right" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L5535
  9. missing-param-doc:
    "copy, freq, how" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/series.py#L5848
  10. missing-param-doc:
    *"**kwargs, args, axis, skipna" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/base.py#L658
  11. missing-param-doc:
    "mapper, na_action" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/base.py#L796
  12. missing-param-doc:
    "how, values" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/missing.py#L172
  13. missing-param-doc:
    "how" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/generic.py#L11870
  14. missing-param-doc:
    "axis, interpolation, numeric_only, q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/frame.py#L11123
  15. missing-param-doc:
    "axis, copy, freq, how" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/frame.py#L11295
  16. missing-param-doc:
    "mapper, na_action" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/base.py#L6340
  17. missing-param-doc:
    "kind, label, side" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/multi.py#L2652
  18. missing-param-doc:
    "direction, limit" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/groupby/groupby.py#L2817
  19. missing-param-doc:
    "interpolation, numeric_only, q" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/groupby/groupby.py#L3171
  20. missing-param-doc:
    "form" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/strings/accessor.py#L2751
  21. missing-param-doc:
    "how" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/arrays/period.py#L480
  22. missing-param-doc:
    "side" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/core/arrays/_ranges.py#L78
  23. missing-param-doc:
    "axis, color, inclusive, left, props, right, subset" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L3475
  24. missing-param-doc:
    "axis, color, inclusive, interpolation, props, q_left, q_right, subset" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L3579
  25. missing-param-doc:
    "align, color" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/style.py#L4101
  26. missing-param-doc:
    "over" missing in parameter documentation
    https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/latex.py#L456

This comment was generated for commit 73c5197

@Pierre-Sassoulas
Copy link
Member

Outch should have waited for the primer, before approving.

@DanielNoord
Copy link
Collaborator Author

They are actually good!

Just turns out we're not fully supporting Numpy just yet. But the number of messages or missing parameters is going down! See the difference between the first two.

I'll make an issue about remaining issues.

@Pierre-Sassoulas
Copy link
Member

Hmm right, we have most message with actually a more accurate message with one param that do not warn anymore. This is why we need the better primer diff, I need to do it from scratch again though πŸ˜„

@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Jul 17, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Jul 17, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing-param-doc for numpy doc style: variable with list of legal values
3 participants