-
Notifications
You must be signed in to change notification settings - Fork 1.2k
pylint: enable additional checks #4122
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,11 @@ ignore-patterns= | |
|
||
# Python code to execute, usually for sys.path manipulation such as | ||
# pygtk.require(). | ||
#init-hook= | ||
init-hook="import sys; \ | ||
from pathlib import Path; \ | ||
from pylint.config import find_pylintrc; \ | ||
sys.path.append(Path(find_pylintrc()).parent / 'tests');" | ||
|
||
|
||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the | ||
# number of processors available to use. | ||
|
@@ -28,7 +32,7 @@ limit-inference-results=100 | |
|
||
# List of plugins (as comma separated values of python modules names) to load, | ||
# usually to register additional checkers. | ||
load-plugins=pylint_pytest | ||
load-plugins=pylint_pytest,pylint_plugin_disable | ||
|
||
# Pickle collected data for later comparisons. | ||
persistent=yes | ||
|
@@ -149,10 +153,8 @@ disable=format, | |
exception-escape, | ||
comprehension-escape, | ||
# custom disables start here | ||
protected-access, # needs-refactor | ||
no-self-use, | ||
invalid-name, | ||
blacklisted-name, | ||
# already a check enabled for `wildcard-import` | ||
unused-wildcard-import, | ||
misplaced-comparison-constant, | ||
|
@@ -176,10 +178,6 @@ disable=format, | |
# we use it to speedup/optimize | ||
import-outside-toplevel, | ||
fixme, | ||
# Enabling soon: | ||
no-member, | ||
unused-argument, | ||
arguments-differ, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only checks that are important is for |
||
|
||
|
||
# Enable the message, report, category or checker with the given id(s). You can | ||
|
@@ -267,7 +265,7 @@ contextmanager-decorators=contextlib.contextmanager | |
# List of members which are set dynamically and missed by pylint inference | ||
# system, and so shouldn't trigger E1101 when accessed. Python regular | ||
# expressions are accepted. | ||
generated-members= | ||
generated-members=pytest.lazy_fixture,logging.TRACE,logger.trace,sys.getwindowsversion | ||
|
||
# Tells whether missing members accessed in mixin class should be ignored. A | ||
# mixin class is detected if its name ends with "mixin" (case insensitive). | ||
|
@@ -288,7 +286,7 @@ ignore-on-opaque-inference=yes | |
# List of class names for which member attributes should not be checked (useful | ||
# for classes with dynamically set attributes). This supports the use of | ||
# qualified names. | ||
ignored-classes=optparse.Values,thread._local,_thread._local | ||
ignored-classes=optparse.Values,thread._local,_thread._local,Dvcfile | ||
|
||
# List of module names for which member attributes should not be checked | ||
# (useful for modules/projects where namespaces are manipulated during runtime | ||
|
@@ -329,7 +327,7 @@ dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ | |
|
||
# Argument names that match this expression will be ignored. Default to name | ||
# with leading underscore. | ||
ignored-argument-names=_.*|^ignored_|^unused_ | ||
ignored-argument-names=_.*|^ignored_|^unused_|args|kwargs | ||
|
||
# Tells whether we should check for unused import in __init__ files. | ||
init-import=no | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ def clean_repos(): | |
|
||
|
||
class BaseExternalRepo: | ||
# pylint: disable=no-member | ||
|
||
_local_cache = None | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,8 @@ def main(argv=None): | |
except DvcException: | ||
ret = 255 | ||
logger.exception("") | ||
except Exception as exc: # pylint: disable=broad-except | ||
if isinstance(exc, OSError) and exc.errno == errno.EMFILE: | ||
except OSError as exc: | ||
if exc.errno == errno.EMFILE: | ||
Comment on lines
-68
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed code to make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is questionable, just duplicating the code :( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
logger.exception( | ||
"too many open files, please visit " | ||
"{} to see how to handle this " | ||
|
@@ -78,10 +78,13 @@ def main(argv=None): | |
else: | ||
logger.exception("unexpected error") | ||
ret = 255 | ||
except Exception: # noqa, pylint: disable=broad-except | ||
logger.exception("unexpected error") | ||
ret = 255 | ||
finally: | ||
logger.setLevel(outerLogLevel) | ||
|
||
# Closing pools by-hand to prevent wierd messages when closing SSH | ||
# Closing pools by-hand to prevent weird messages when closing SSH | ||
# connections. See https://github.com/iterative/dvc/issues/3248 for | ||
# more info. | ||
close_pools() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ class BaseRemoteTree: | |
|
||
CACHE_MODE = None | ||
SHARED_MODE_MAP = {None: (None, None), "group": (None, None)} | ||
CHECKSUM_DIR_SUFFIX = ".dir" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated above |
||
PARAM_CHECKSUM = None | ||
|
||
state = StateNoop() | ||
|
||
|
@@ -119,6 +119,7 @@ def __init__(self, repo, config): | |
or self.HASH_JOBS | ||
) | ||
self.verify = config.get("verify", self.DEFAULT_VERIFY) | ||
self.path_info = None | ||
|
||
@classmethod | ||
def get_missing_deps(cls): | ||
|
@@ -184,14 +185,17 @@ def cache(self): | |
|
||
def open(self, path_info, mode="r", encoding=None): | ||
if hasattr(self, "_generate_download_url"): | ||
get_url = partial(self._generate_download_url, path_info) | ||
func = self._generate_download_url # noqa,pylint:disable=no-member | ||
get_url = partial(func, path_info) | ||
return open_url(get_url, mode=mode, encoding=encoding) | ||
|
||
raise RemoteActionNotImplemented("open", self.scheme) | ||
|
||
def exists(self, path_info): | ||
raise NotImplementedError | ||
|
||
# pylint: disable=unused-argument | ||
|
||
def isdir(self, path_info): | ||
"""Optional: Overwrite only if the remote has a way to distinguish | ||
between a directory and a file. | ||
|
@@ -250,6 +254,8 @@ def protect(path_info): | |
def is_protected(self, path_info): | ||
return False | ||
|
||
# pylint: enable=unused-argument | ||
|
||
@staticmethod | ||
def unprotect(path_info): | ||
pass | ||
|
@@ -413,7 +419,7 @@ def upload(self, from_info, to_info, name=None, no_progress_bar=False): | |
|
||
name = name or from_info.name | ||
|
||
self._upload( | ||
self._upload( # noqa, pylint: disable=no-member | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, we should create an |
||
from_info.fspath, | ||
to_info, | ||
name=name, | ||
|
@@ -504,7 +510,7 @@ def _download_file( | |
|
||
tmp_file = tmp_fname(to_info) | ||
|
||
self._download( | ||
self._download( # noqa, pylint: disable=no-member | ||
from_info, tmp_file, name=name, no_progress_bar=no_progress_bar | ||
) | ||
|
||
|
@@ -866,6 +872,7 @@ def gc(cls, named_cache, remote, jobs=None): | |
path_info = tree.hash_to_path_info(hash_) | ||
if tree.is_dir_hash(hash_): | ||
# backward compatibility | ||
# pylint: disable=protected-access | ||
tree._remove_unpacked_dir(hash_) | ||
tree.remove(path_info) | ||
removed = True | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ def getsize(self, path): | |
|
||
return 0 | ||
|
||
def exists(self, path, sftp=None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused arg. |
||
def exists(self, path): | ||
return bool(self.st_mode(path)) | ||
|
||
def isdir(self, path): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required for loading the plugin.