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

Add --ignore-overloaded-functions flag to ignore overload decorators #98

Merged
merged 3 commits into from
Apr 6, 2024

Conversation

ErwinJunge
Copy link
Contributor

Hey, I just made a Pull Request!

Description

Add --ignore-overloaded-functions flag to ignore overload decorators

Motivation and Context

Fixes #97

Have you tested this? If so, how?

I have included unittests and ran interrogate against a codebase with overloads.

Checklist for PR author(s)

  • Changes are covered by unit tests (no major decrease in code coverage %).
  • All tests pass.
  • Docstring coverage is 100% via tox -e docs or interrogate -c pyproject.toml (I mean, we should set a good example 😄).
  • Updates to documentation:
    • Document any relevant additions/changes in README.rst.
    • Manually update both the README.rst and docs/index.rst for any new/changed CLI flags.
    • Any changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives. Find the appropriate next version in the project's __init__.py file.

Release note

Add ``--ignore-overloaded-functions`` flag to ignore overload decorators (`#97 <https://github.com/econchick/interrogate/issues/97>`_).

@econchick
Copy link
Owner

dang! thanks for the contribution @ErwinJunge ! I'm wrapping up a bunch of work stuff, but I'll review this over the next few days. Thanks!

@ErwinJunge
Copy link
Contributor Author

Apparently I failed at running black 🤦

I've fixed the codestyle and forcepushed a new commit.

@ErwinJunge
Copy link
Contributor Author

dang! thanks for the contribution @ErwinJunge ! I'm wrapping up a bunch of work stuff, but I'll review this over the next few days. Thanks!

For me this is work stuff :) I'm finishing up my week now and will pick this back up monday if there's any feedback.

@ErwinJunge
Copy link
Contributor Author

@econchick friendly ping on the review :)

Copy link
Owner

@econchick econchick left a comment

Choose a reason for hiding this comment

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

Hey @ErwinJunge ! So sorry for the delay - I actually caught covid last week 🤦🏻‍♀️

This looks great to me! I appreciate the thoroughness of this PR too - I'm sure you're annoyed at my testing suite 😅

I just have one request: Would you mind being more descriptive with the user-facing help text for the option? As in, something more specific like "Ignore @typing.overload-decorated functions." (in cli.py, README.rst, docs/index.rst, and the docstring in config.py). I'm sure someone who's familiar with typing understands what overloaded functions means, but for those that are not (yet) familiar, it may seem confusing that Python supports overloaded functions.

@ErwinJunge
Copy link
Contributor Author

Hi @econchick , I'm sorry to hear about the covid and I hope you had a full recovery!

You're welcome for the PR. The test suite could indeed use some work, there were a lot of unrelated testing changes required to add my new thing. However, on the whole I'm mostly just happy there is a test suite! 😄

Thank you for the review and the improvement suggestion. I've implemented it in the update I've just pushed.

Copy link
Owner

@econchick econchick left a comment

Choose a reason for hiding this comment

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

Thanks again @ErwinJunge ! I'm not sure when 1.6.0 will be released (but not longer than a week or two - want to see if I can get in another feature). But I'll ping this thread when I have.

If you happen to be at PyCon US in 2022, find me - I'll have stickers!

@econchick
Copy link
Owner

uff - @ErwinJunge , looks like that small change broke some tests 😬 If you don't have time to fix them in the next couple of days, I can try to dig in. (This indeed makes me want to rewrite the test suite 🤦🏻)

@ErwinJunge
Copy link
Contributor Author

Tests updated in latest push.

Re: pycon US, thanks for the offer but I don't think that'll be likely :) I live in the Netherlands, and it's currently a bit hard to travel out of Europe 😅

@ErwinJunge
Copy link
Contributor Author

@econchick those test failures look like the docstring coverage results are different on windows than they are on linux 😕 I don't have a windows box available to run those tests locally and can't imagine what would make the results different on windows so I don't think I'll be able to fix these.

@ErwinJunge
Copy link
Contributor Author

@econchick do you have some input on the windows tests? Is there perhaps something I can do without having access to a windows box?

@ErwinJunge
Copy link
Contributor Author

@econchick I took a closer look today and what's failing are the test expectation files in tests/functional/fixtures/windows/ I didn't update those (because I got all green on my machine 😅 ). However, I don't think I can update these, since I don't have access to a windows box to recreate them on. I tried copy-pasting the non-windows files and checking what changed using git diff, but that indicates the entire file is different (including stuff like the first line that definitely didn't change). There's some windows-specific magic going on that I can't replicate without access to a windows box. Can you regenerate those files and update the PR for me?

What I did for the linux files is this:

  1. Add the below into a relevant test
    with open(expected_fixture, "w") as f:
        f.write(expected_out)
  1. Sanity check the git diff. There might be added lines that shouldn't be there, remove those. Make sure there are only changed lines that make sense according to the python changes in the PR.
  2. Once the diff is clean: commit :)

@ErwinJunge
Copy link
Contributor Author

@econchick friendly ping on the above :) Please let me know if there's anything I can do to move this along.

@ErwinJunge
Copy link
Contributor Author

👋 @econchick please don't forget about this one 🥺

@conrad-stork
Copy link

conrad-stork commented Dec 1, 2023

Hi All,

I found this pull request as I the same problem with interrogate. My question would be if there is any chance that this pull request is merged at some point? I think this could be very useful feature.

Tagging here: @ErwinJunge @econchick

Thanks and Best

@econchick econchick merged commit 61c34c7 into econchick:master Apr 6, 2024
8 of 20 checks passed
frunika referenced this pull request in frunika/Photobooth Apr 10, 2024
Bumps [interrogate](https://github.com/econchick/interrogate) from 1.5.0
to 1.7.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/econchick/interrogate/releases">interrogate's
releases</a>.</em></p>
<blockquote>
<h2>1.7.0</h2>
<h1>Full Changelog</h1>
<h2>Added</h2>
<ul>
<li><code>tomli</code> dependency for Python versions &lt; 3.11, making
use of <code>tomllib</code> in the standard library with 3.11+ (<a
href="https://redirect.github.com/econchick/interrogate/issues/150">#150</a>).</li>
<li>Support for <code>pyi</code> file extensions (and leave room for
other file extensions to be added, like maybe <code>ipynb</code>).</li>
<li>Support for Google-style docstrings for class <code>__init__</code>
methods with new <code>--style [sphinx|google]</code> flag (<a
href="https://redirect.github.com/econchick/interrogate/issues/128">#128</a>).</li>
</ul>
<h2>Fixed</h2>
<ul>
<li>Include support for deleters when ignoring property decorators (<a
href="https://redirect.github.com/econchick/interrogate/issues/126">#126</a>).</li>
<li>Support floats for <code>--fail-under</code> values (<a
href="https://redirect.github.com/econchick/interrogate/issues/114">#114</a>).</li>
</ul>
<h2>Removed</h2>
<ul>
<li><code>toml</code> dependency for all Python versions (<a
href="https://redirect.github.com/econchick/interrogate/issues/150">#150</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/econchick/interrogate/blob/master/docs/changelog.rst">interrogate's
changelog</a>.</em></p>
<blockquote>
<h2>1.7.0 (2024-04-07)</h2>
<p>Added
^^^^^</p>
<ul>
<li><code>tomli</code> dependency for Python versions <!-- raw HTML
omitted -->`_).</li>
<li>Support for <code>pyi</code> file extensions (and leave room for
other file extensions to be added, like maybe <code>ipynb</code>).</li>
<li>Support for Google-style docstrings for class <code>__init__</code>
methods with new <code>--style [sphinx|google]</code> flag
(<code>[#128](econchick/interrogate#128)
&lt;https://github.com/econchick/interrogate/issues/128&gt;</code>_).</li>
</ul>
<p>Fixed
^^^^^</p>
<ul>
<li>Include support for deleters when ignoring property decorators
(<code>[#126](econchick/interrogate#126)
&lt;https://github.com/econchick/interrogate/issues/126&gt;</code>_).</li>
<li>Support floats for <code>--fail-under</code> values
(<code>[#114](econchick/interrogate#114)
&lt;https://github.com/econchick/interrogate/issues/114&gt;</code>_).</li>
</ul>
<p>Removed
^^^^^^^</p>
<ul>
<li><code>toml</code> dependency for all Python versions
(<code>[#150](econchick/interrogate#150)
&lt;https://github.com/econchick/interrogate/issues/150&gt;</code>_).</li>
</ul>
<p>.. short-log</p>
<h2>1.6.0 (2024-04-06)</h2>
<p>Added
^^^^^</p>
<ul>
<li>Add <code>--ignore-overloaded-functions</code> flag to ignore
overload decorators
(<code>[#97](econchick/interrogate#97)
&lt;https://github.com/econchick/interrogate/issues/97&gt;</code><em>) –
thank you <code>ErwinJunge
&lt;https://github.com/econchick/interrogate/pull/98&gt;</code></em>
(via <code>[#167](econchick/interrogate#167)
&lt;https://github.com/econchick/interrogate/pull/167&gt;</code><em>)
and <code>zackyancey
&lt;https://github.com/econchick/interrogate/pull/160&gt;</code></em>.</li>
<li>Support for Python 3.11 &amp; 3.12.</li>
</ul>
<p>Removed
^^^^^^^</p>
<ul>
<li>Support for Python 3.6 &amp; 3.7.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/econchick/interrogate/commit/4894019dc8876092bc9b6d56878798c550fad998"><code>4894019</code></a>
Release 1.7.0</li>
<li><a
href="https://github.com/econchick/interrogate/commit/6c8db6ffc256a25b68806038f2ab5d9897c9468f"><code>6c8db6f</code></a>
Testing out a PyPI GitHub workflow</li>
<li><a
href="https://github.com/econchick/interrogate/commit/06ecac0e4361df16a70b1e34e92cd4c1b259b85e"><code>06ecac0</code></a>
Merge pull request <a
href="https://redirect.github.com/econchick/interrogate/issues/173">#173</a>
from econchick/google-style</li>
<li><a
href="https://github.com/econchick/interrogate/commit/f77ef6f0b9bc946159c53ac0bd66f1f30631083d"><code>f77ef6f</code></a>
Add flag to support google code style</li>
<li><a
href="https://github.com/econchick/interrogate/commit/5461ebcf860fa360c00c77f5741c26b04cb87e8d"><code>5461ebc</code></a>
Merge pull request <a
href="https://redirect.github.com/econchick/interrogate/issues/172">#172</a>
from econchick/ext-flag</li>
<li><a
href="https://github.com/econchick/interrogate/commit/722d5239256a28eb16a54abcd7d11a6e5f21c62a"><code>722d523</code></a>
Add support for other file extensions (pyi to start)</li>
<li><a
href="https://github.com/econchick/interrogate/commit/1a28d80e5c05626892f50cd0644ab38615484da7"><code>1a28d80</code></a>
Merge pull request <a
href="https://redirect.github.com/econchick/interrogate/issues/171">#171</a>
from econchick/round-perc-covered</li>
<li><a
href="https://github.com/econchick/interrogate/commit/d3cddca06b01461edc4d0f46a84f09d6f2d2f173"><code>d3cddca</code></a>
Merge pull request <a
href="https://redirect.github.com/econchick/interrogate/issues/170">#170</a>
from econchick/include-deleters</li>
<li><a
href="https://github.com/econchick/interrogate/commit/4e7e96721f458988b504a61b5c746dfa9dd8e1ed"><code>4e7e967</code></a>
Merge pull request <a
href="https://redirect.github.com/econchick/interrogate/issues/170">#170</a>
from econchick/include-deleters</li>
<li><a
href="https://github.com/econchick/interrogate/commit/5dcb4dea10d1ebe53268588cddde1867989747a6"><code>5dcb4de</code></a>
Include deleters when ignoring property decorators</li>
<li>Additional commits viewable in <a
href="https://github.com/econchick/interrogate/compare/1.5.0...1.7.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=interrogate&package-manager=pip&previous-version=1.5.0&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to ignore overloaded functions
3 participants