-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incompatible config file options for naming hints in pylint 2.14.0 #6931
Comments
Without looking at it in too much detail, I think the solution here is to disable In particular if you have |
Sorry this was a pain point. Like Pierre said, if you don't find these new checks of your config file in 2.14 useful, it (should be) trivial to disable them. Functionally, though, the incompatibility predated 2.14. See:
The old option names were rejected since 1.8, I believe. They have been silently doing nothing (an incompatilbility) for a long time; we just added an enhancement to tell you about it when parsing your config.
It's in the 1.8 release notes. These are changes from well over a major version ago, so there is no compatibility contract between 1.X and 2.X, i.e. no expectation that the same config file could be run on both major versions.
Changelog entries about warnings for dead/moot options in 2.X:
I do think that is the right course if you need to be running different major versions of pylint. |
The naming styles are here: https://pylint.pycqa.org/en/latest/user_guide/configuration/all-options.html#basic-checker |
@Pierre-Sassoulas yes, since |
@andy-maier I support this in principle, and this is what should have happened in 1.8, which went out in 2017. I think it's unlikely to happen going forward without a deprecation procedure. |
@jacobtylerwalls First, thanks much for the quick response. I misunderstood the |
Great. Feel free to reopen if you have a concrete suggestion to improve the docs 👍🏻 |
I'm fine with closing this issue. For users looking at this lateron: The basic migration of our old pylint config files that were created by pylint 1.5 to pylint 2.14 worked as follows:
This config file was successfully used with pylint>=2.10.0,<2.14.0 (on Python 3.5) and pylint>=2.14.0 (on Python >=3.6) |
Where can I check the changed documents? |
Despite evidence to the contrary, these options do not seem to be supported (any more). pylint-dev/pylint#6931 (comment)
* Address lint findings for osv/request_helper_test.py osv/request_helper_test.py:31:2: C0116: Missing function or method docstring (missing-function-docstring) osv/request_helper_test.py:33:4: C0103: Variable name "TEST_RESPONSE" doesn't conform to '^[a-z][a-z0-9_]*$' pattern (invalid-name) osv/request_helper_test.py:36:4: C0103: Variable name "TEST_URL" doesn't conform to '^[a-z][a-z0-9_]*$' pattern (invalid-name) osv/request_helper_test.py:16:0: W0611: Unused import os (unused-import) osv/request_helper_test.py:21:0: W0611: Unused import requests (unused-import) * Address lint findings for request_helper.py osv/request_helper.py:52:2: C0116: Missing function or method docstring (missing-function-docstring) * Address lint findings for osv/ecosystems_test.py osv/ecosystems_test.py:47:50: W0108: Lambda may not be necessary (unnecessary-lambda) osv/ecosystems_test.py:142:23: W0621: Redefining name 'cache' from outer scope (line 22) (redefined-outer-name) * Fix lint findings for osv/ecosystems.py osv/ecosystems.py:120:0: C0301: Line too long (89/80) (line-too-long) osv/ecosystems.py:354:0: C0301: Line too long (81/80) (line-too-long) osv/ecosystems.py:362:6: R1705: Unnecessary "else" after "return" (no-else-return) osv/ecosystems.py:405:2: R1705: Unnecessary "else" after "return" (no-else-return) * Address spurious warnings about unclosed sockets This makes the tests much quieter. * Address lint findings in osv/debian_version_cache.py osv/debian_version_cache.py:20:0: C0301: Line too long (110/80) (line-too-long) osv/debian_version_cache.py:27:0: C0301: Line too long (90/80) (line-too-long) osv/debian_version_cache.py:30:2: W0231: __init__ method from base class 'Exception' is not called (super-init-not-called) * Partially address lint findings for osv/cache.py osv/cache.py:53:23: R1735: Consider using {} instead of dict() (use-dict-literal) osv/cache.py:60:4: R1705: Unnecessary "else" after "return" (no-else-return) These ones remain at this time due to cognitive burden to address: osv/cache.py:86:14: W1505: Using deprecated method getcallargs() (deprecated-method) osv/cache.py:70:0: C0103: Function name "Cached" doesn't conform to the `snake_case` group in the '^(?:(?P<exempt>setUp|tearDown|setUpModule|tearDownModule)|(?P<camel_case>_?[A-Z][a-zA-Z0-9]*)|(?P<snake_case>_?[a-z][a-z0-9_]*))$' pattern (invalid-name) * Address lint findings for gcp/appengine/frontend_handlers_test.py gcp/appengine/frontend_handlers_test.py:19:0: W0611: Unused mock imported from unittest (unused-import) * Address lint findings for gcp/api/test_server.py gcp/api/test_server.py:100:2: W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check) In this instance, the stopping of the container is best-effort and failing is fine. * Address lint findings in gcp/api/server.py gcp/api/server.py:92:4: W0621: Redefining name 'futures' from outer scope (line 17) (redefined-outer-name) * Address lint findings in gcp/api/integration_tests.py gcp/api/integration_tests.py:100:2: C0116: Missing function or method docstring (missing-function-docstring) * Address lint findings for docker/worker/worker.py docker/worker/worker.py:260:0: C0301: Line too long (89/80) (line-too-long) * Partially address lint findings for docker/importer/importer.py docker/importer/importer.py:262:8: W0612: Unused variable 'vulnerability' (unused-variable) This remains due to cognitive load to refactor: docker/importer/importer.py:213:4: R1702: Too many nested blocks (6/5) (too-many-nested-blocks) * Address additional lint line-length findings overlooked * Make decorator name style-guide compliant * Adjust import for rename made in f80bf4e * Refactor to not use deprecated inspect.getcallargs() Credit to Rex Pan for helping with the refactoring. #599 (comment) * Refactor _process_updates_git() to eliminate lint finding docker/importer/importer.py:213:4: R1702: Too many nested blocks (6/5) (too-many-nested-blocks) * Promote _sync_from_previous_commit() to a top-level method Per reviewer feedback: 8f7caf5#r946322047 * Remove invalid options Despite evidence to the contrary, these options do not seem to be supported (any more). pylint-dev/pylint#6931 (comment) * Use a generator instead Eliminate lint finding: gcp/appengine/frontend_handlers.py:381:25: R1728: Consider using a generator instead 'sum(len(entry.get('package', {}).get('name', '')) for entry in affected)' (consider-using-generator) * Suppress arguments-differ lint finding for _pre_put_hook osv/models.py:335:2: W0221: Number of parameters was 1 in 'Model._pre_put_hook' and is now 1 in overridden 'Bug._pre_put_hook' method (arguments-differ) osv/models.py:699:2: W0221: Number of parameters was 1 in 'Model._pre_put_hook' and is now 1 in overridden 'SourceRepository._pre_put_hook' method (arguments-differ) My running theory is that because these are decorated as @classmethod in the abstract class (but don't specify cls as the first parameter), this lint finding is getting triggered. I do not see a good way forward other than suppression. * Disable unnecessary-lambda-assignment lint finding Hopefully only temporarily. * Refactor away unnecessary lambda With thanks to @another-rex
It looks like there is no explicit mention of it, but it might be implicitly meant with "Configuration options of invalid name checker are significantly redesigned.". Above, @jacobtylerwalls is referring to this part with "It's in the 1.8 release notes.". |
Bug description
Pylint 2.14.0 rejects config files that worked before.
The problem with that is that we test our projects with many different Python versions, usually 2.7 and 3.5 and higher. Some minimum version requirements for pylint we define plus the supported Python versions of pylint itself usually result in the following Pylint versions that are used:
Now pylint 2.14.0 requires to change the config file in a way that is no longer supported by earlier pylint versions.
Besides pinning pylint to <2.14.0, the other solution would be to start maintaining different versions of pylint config files, one for pylint <2.14, and one for pylint >=2.14 (plus to increase the minimum version of pylint to >=2.14.0 for Python >=3.7).
We are not really happy about the second option.
More specifically about the errors we get with pylint 2.14.1 and the older config files:
E0015: Unrecognized option found
on the config file:W0012: Unknown option value for '--disable'
on the config file:W0012: Unknown option value for 'disable'
on source code:An additional issue is that I could not find these incompatibilities in the change log of 2.14.0. Specifically, I did not find anything in the change log about how to transform the old naming hint options to the new ones, or even what the names of the new ones are.
Configuration
Command used
# In https://github.com/zhmcclient/zhmc-prometheus-exporter project: pylint --rcfile=.pylintrc --disable=fixme zhmc_prometheus_exporter/_version.py zhmc_prometheus_exporter/__init__.py zhmc_prometheus_exporter/zhmc_prometheus_exporter.py tests/test_all.py setup.py docs/conf.py
Pylint output
Expected behavior
A new pylint version may remove old options, but not incompatibly change old options (like the ones for naming hints). In case of the naming hint options, the new version of pylint could have introduced the new options and still supported the old options for compatibility.
Pylint version
OS / Environment
macOS 11.6.4
Additional dependencies
N/A
The text was updated successfully, but these errors were encountered: