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 more cases that emit bad-plugin-value #7284

Merged
merged 17 commits into from
Sep 7, 2022
Merged

Add more cases that emit bad-plugin-value #7284

merged 17 commits into from
Sep 7, 2022

Conversation

daogilvie
Copy link
Contributor

@daogilvie daogilvie commented Aug 10, 2022

Type of Changes

Type
🐛 Bug fix

Description

As per #7264, this PR will make the changes covered the lines marked with ❗ in the following table. The table is about the relationship between the load-plugins and init-hook arguments/configuration options.

# Passed on CLI Supplied in pylintrc Can be imported before init Can be imported after init Current Behaviour Desired Behaviour Done
1 🚫 🚫 🚫 Emit bad-plugin-value Emit bad-plugin-value N/A
2 🚫 🚫 🚫 Emit bad-plugin-value Emit bad-plugin-value N/A
3 🚫 🚫 Do not register, but do import config, no emit Emit bad-plugin-value
4 🚫 🚫 Load as normal, works fine, no warnings Emit bad-plugin-value
5 🚫 🚫 Emit bad-plugin-value Emit bad-plugin-value N/A
6 🚫 Do not register, but do import config, no emit Emit bad-plugin-value
7 🚫 🟡 (because of cli init hook) 🚫 Works perfectly Emit bad-plugin-value

Refs #7264

@Pierre-Sassoulas Pierre-Sassoulas added Maintenance Discussion or action around maintaining pylint or the dev workflow Skip news 🔇 This change does not require a changelog entry Work in progress labels Aug 25, 2022
@coveralls
Copy link

coveralls commented Aug 29, 2022

Pull Request Test Coverage Report for Build 3006894605

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • 8 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.001%) to 95.333%

Files with Coverage Reduction New Missed Lines %
pylint/config/find_default_config_files.py 8 89.16%
Totals Coverage Status
Change from base Build 2999709475: -0.001%
Covered Lines: 17017
Relevant Lines: 17850

💛 - Coveralls

@github-actions

This comment has been minimized.

@daogilvie
Copy link
Contributor Author

daogilvie commented Aug 29, 2022

This PR now catches case 3, and there is a test for it. Will mention progress update in #7264.

@github-actions

This comment has been minimized.

@DanielNoord DanielNoord self-requested a review August 30, 2022 08:01
@DanielNoord DanielNoord removed the Skip news 🔇 This change does not require a changelog entry label Aug 31, 2022
tests/lint/unittest_lint.py Show resolved Hide resolved
tests/lint/unittest_lint.py Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@Pierre-Sassoulas
Copy link
Member

Just chiming in with no time to review but it seems some cases are fixed, maybe we should merge the fixed cases right now and handle the following one later ? I'm loving the detailed specifications in markdown, that's very nice.

@daogilvie
Copy link
Contributor Author

Hi @Pierre-Sassoulas, it's been a busy week so I'm just coming back to this now. I don't mind doing more, smaller PRs, or anything really. Whatever approach suits your needs best. I'll probably do a bit more work on this today, if only just to confirm that case 6 is also covered by what I've done already (by adding a test).

@daogilvie
Copy link
Contributor Author

Case 6 covered!
However I now realise that only one of the two computers I'm using has pre-commit working in the repository, so I've fixed that too 😂. Should stop seeing the correction commits now, and hopefully save the project some cycles in the pre-commit budget, sorry about that.

@DanielNoord
Copy link
Collaborator

Should stop seeing the correction commits now, and hopefully save the project some cycles in the pre-commit budget, sorry about that.

pre-commit is free for open-source 🎉

But it does reduce my email spam 😄

@github-actions

This comment has been minimized.

@Pierre-Sassoulas
Copy link
Member

@DanielNoord could you resolve the conflict, please ? I'd be tempted to keep Iterator[str] myself but you just did #7403 which use None.

@DanielNoord
Copy link
Collaborator

I'm on mobile, but you can change to str. I added the typing only because strict mode doesn't allow bare Iterator, it needs to specify what is being yielded.
String is fine because if tests actually depended on it being None they would have failed in this PR.

@Pierre-Sassoulas
Copy link
Member

Thank you for the quick feedback :)

@github-actions

This comment has been minimized.

@daogilvie
Copy link
Contributor Author

Hello! I'll add a towncrier fragment for just these 2 fixed cases now then, if you'd like merge this code before too much else happens on main.

@github-actions

This comment has been minimized.

@DanielNoord
Copy link
Collaborator

@daogilvie I'd be fine with fixing these two cases and doing the others in another PR.

Could you take a look at the failing tests? Probably something to do with Windows file paths..

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@daogilvie
Copy link
Contributor Author

The remaining failure is an unrelated documentation issue.

/home/runner/work/pylint/pylint/doc/user_guide/checkers/features.rst:1184: WARNING: broken link: https://trojansource.codes/ (HTTPSConnectionPool(host='trojansource.codes', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f98b9f5fdc0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')))

I don't think that requires fixing on this branch? I'll mark the PR as non-draft.

@daogilvie daogilvie marked this pull request as ready for review September 6, 2022 13:36
@Pierre-Sassoulas
Copy link
Member

Yeap, don't mind the documentation check failing :)

@DanielNoord
Copy link
Collaborator

@daogilvie Would you mind rebasing on main and then force pushing? coveralls tends to have issues when we merge main into a branch and check the coverage.

You can ping me for a review afterwards 😄

@daogilvie
Copy link
Contributor Author

Another submission for you @DanielNoord. Thank you again for your patience!

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Again, some superficial changes to wording and docstrings.

@Pierre-Sassoulas I know we want to release, but should we merge this in 2.15.1 as well?

pylint/lint/pylinter.py Outdated Show resolved Hide resolved
pylint/lint/pylinter.py Outdated Show resolved Hide resolved
pylint/lint/pylinter.py Show resolved Hide resolved
pylint/lint/pylinter.py Outdated Show resolved Hide resolved
pylint/lint/pylinter.py Outdated Show resolved Hide resolved
tests/lint/unittest_lint.py Outdated Show resolved Hide resolved
tests/lint/unittest_lint.py Outdated Show resolved Hide resolved
tests/lint/unittest_lint.py Show resolved Hide resolved
tests/lint/unittest_lint.py Show resolved Hide resolved
Thanks again @DanielNoord, your patience is appreciated.

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
@DanielNoord DanielNoord added this to the 2.15.2 milestone Sep 7, 2022
DanielNoord
DanielNoord previously approved these changes Sep 7, 2022
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

I added one final commit with some last comments, just to make things more explicit.

Thanks a lot @daogilvie. This is wonderful! Would you be able to write an update in the linked issue so that we know were we are at now that this is getting merged? And are you also planning on tackling those last issue/cases that remain?

@Pierre-Sassoulas I put this on the milestone for tonight's release. It's a nice bug fix and I think it can be included as well 😄

@daogilvie
Copy link
Contributor Author

Thanks a lot @daogilvie. This is wonderful! Would you be able to write an update in the linked issue so that we know were we are at now that this is getting merged? And are you also planning on tackling those last issue/cases that remain?

Happy to help! Thank you for your calm and patient guidance 😄
Yes, I'd like to contribute more (increasing my OSS contributions is a personal goal) and can fix the rest of the cases; I was only reluctant now because it started to look like it would involve larger changes than I expected.

I'll add something to #7264 shortly

@github-actions

This comment has been minimized.

DanielNoord
DanielNoord previously approved these changes Sep 7, 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.

Thank you for all the work on this issue @daogilvie, we'll release it in 2.15.2 tonight :)

tests/lint/unittest_lint.py Outdated Show resolved Hide resolved
tests/lint/unittest_lint.py Outdated Show resolved Hide resolved
@Pierre-Sassoulas Pierre-Sassoulas dismissed stale reviews from DanielNoord and themself via 52f10ef September 7, 2022 10:28
@DanielNoord DanielNoord merged commit 1a7cdab into pylint-dev:main Sep 7, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Sep 7, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Sep 7, 2022
* Add x-failing test for issue 7264 case 3

This is the case where a plugin can be imported only after the init-hook
is run, and the init hook is specified in a pylintrc file
We would expect the module to not load in any case, and cause the
emission of a bad-plugin-value message.

* _dynamic_plugins is a dict not a set

This is in preparation for caching the loaded modules, and for storing
other information that will help in identifying times loading is
dependent on init-hook magic.

* Use cached module objects for load_configuration

This fixes case 3 in pylint-dev#7264, and is technically a breaking change, in
that it now emits a message for what would have previously been a silent
failure.

* Interim review comment fixes

1. Remove the xfail that snuck back in after the rebases.
2. Now that fake_home yields a str, update the type hint.

* Add test for bad plugin with duplicated load

This is case 6 in issue pylint-dev#7264, and represents the other silent failure
that is being made non-silent by this change.

* Apply review feedback

- Add an ordering test for CLI arguments
- Add clarifying comments on affected functions
- Tidy up test assertions to be more pythonic

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2022

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 52f10ef

Pierre-Sassoulas added a commit that referenced this pull request Sep 7, 2022
* Add x-failing test for issue 7264 case 3

This is the case where a plugin can be imported only after the init-hook
is run, and the init hook is specified in a pylintrc file
We would expect the module to not load in any case, and cause the
emission of a bad-plugin-value message.

* _dynamic_plugins is a dict not a set

This is in preparation for caching the loaded modules, and for storing
other information that will help in identifying times loading is
dependent on init-hook magic.

* Use cached module objects for load_configuration

This fixes case 3 in #7264, and is technically a breaking change, in
that it now emits a message for what would have previously been a silent
failure.

* Interim review comment fixes

1. Remove the xfail that snuck back in after the rebases.
2. Now that fake_home yields a str, update the type hint.

* Add test for bad plugin with duplicated load

This is case 6 in issue #7264, and represents the other silent failure
that is being made non-silent by this change.

* Apply review feedback

- Add an ordering test for CLI arguments
- Add clarifying comments on affected functions
- Tidy up test assertions to be more pythonic

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
@daogilvie daogilvie deleted the issue-7264-message-for-modules-loadable-from-syspath branch September 7, 2022 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants