pylint: enable additional checks#4122
Conversation
85622a4 to
3001392
Compare
Codecov Report
@@ Coverage Diff @@
## master #4122 +/- ##
==========================================
- Coverage 92.76% 92.70% -0.07%
==========================================
Files 162 162
Lines 11278 11288 +10
==========================================
+ Hits 10462 10464 +2
- Misses 816 824 +8
Continue to review full report at Codecov.
|
Created a separate pylint plugin to disable some checks for tests.
3001392 to
3259a43
Compare
There was a problem hiding this comment.
Only checks that are important is for missing docstring and logging format (with lazy logging).
There was a problem hiding this comment.
Changed code to make pylint understand Exception better.
There was a problem hiding this comment.
This one is questionable, just duplicating the code :(
There was a problem hiding this comment.
I think it's worth it to separate exception here. The duplication is 2 lines and most of it is incidental, the return code and message can change independently like in the above try-except ladder.
I could do:
if ret == 255:
logger.info("unexpected error")But, I don't think it's worth the hassle.
There was a problem hiding this comment.
pylint understands use of Mixin, so, it does not throw any error if any member is not found. eg: self.bucket.
There was a problem hiding this comment.
Pylint does not allow different configs per directory. It requires a "run-twice" or a "disable-on-each-file" solution.
Therefore, I wrote this hack/plugin for now. If it becomes hard to maintain, I'll just remove this and substitute with "run-twice" solution with two .pylintrc, one for dvc and one for tests.
| init-hook="import sys; \ | ||
| from pathlib import Path; \ | ||
| from pylint.config import find_pylintrc; \ | ||
| sys.path.append(Path(find_pylintrc()).parent / 'tests');" | ||
|
|
There was a problem hiding this comment.
Required for loading the plugin.
| name = name or from_info.name | ||
|
|
||
| self._upload( | ||
| self._upload( # noqa, pylint: disable=no-member |
There was a problem hiding this comment.
I think, we should create an _upload/_download function in the base class that just throws RemoteActionNotImplemented error. It would make this cleaner (without ignore, that is), and provide stronger checks-and-balances.
|
|
||
| def is_node_in_tests(node: "node_classes.NodeNG"): | ||
| module: "scoped_nodes.Module" = node.root() | ||
| return module.file.startswith(TESTS_FOLDER) |
| def open(self, path, mode="r", encoding="utf-8", remote=None): | ||
| def open( | ||
| self, path, mode="r", encoding="utf-8", remote=None | ||
| ): # pylint: disable=arguments-differ |
There was a problem hiding this comment.
Should we start preferring the use of **kwargs in these kinds of cases instead of suppressing this pylint test each time?
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. 🙏