diff options
author | James Ennis <james.ennis@codethink.com> | 2018-02-28 17:22:41 +0000 |
---|---|---|
committer | James Ennis <james.ennis@codethink.com> | 2018-03-14 14:10:26 +0000 |
commit | 0394d67d26035234553c506539b1bd790cddec1d (patch) | |
tree | 4959576b79938d26add9319773312e50b6dce67c | |
parent | 4741d1379a6e17048423f0e08588b607668ab98a (diff) | |
download | buildstream-0394d67d26035234553c506539b1bd790cddec1d.tar.gz |
pylint - disabled no-member, bad-exception-context and catching-non-exception warnings
-rw-r--r-- | .pylintrc | 13 | ||||
-rw-r--r-- | buildstream/_ostree.py | 4 | ||||
-rw-r--r-- | buildstream/plugins/elements/filter.py | 6 | ||||
-rw-r--r-- | buildstream/plugins/sources/_downloadablefilesource.py | 8 | ||||
-rwxr-xr-x | setup.py | 4 |
5 files changed, 20 insertions, 15 deletions
@@ -114,8 +114,6 @@ disable=##################################### logging-format-interpolation, - no-member, - # We use assert(<>), which should perhaps be assert <> superfluous-parens, @@ -136,11 +134,6 @@ disable=##################################### simplifiable-if-statement, - # These messages occur when excepting a GError - these should - # be individually marked - bad-exception-context, - catching-non-exception, - bad-whitespace # Enable the message, report, category or checker with the given id(s). You can @@ -197,7 +190,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=__enter__ # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). @@ -214,13 +207,13 @@ 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,contextlib.closing,gi.repository.GLib.GError # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. -ignored-modules= +ignored-modules=pkg_resources # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py index 9a9e44998..7d0d687a3 100644 --- a/buildstream/_ostree.py +++ b/buildstream/_ostree.py @@ -22,6 +22,10 @@ # # Code based on Jürg's artifact cache and Andrew's ostree plugin # + +# Disable pylint warnings that are not appicable to this module +# pylint: disable=bad-exception-context,catching-non-exception + import os from ._exceptions import BstError, ErrorDomain diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py index b6d82e1f3..672b801ce 100644 --- a/buildstream/plugins/elements/filter.py +++ b/buildstream/plugins/elements/filter.py @@ -64,7 +64,8 @@ class FilterElement(Element): build_deps = list(self.dependencies(Scope.BUILD, recurse=False)) if len(build_deps) != 1: detail = "Full list of build-depends:\n" - detail += " \n".join([x.name for x in build_deps]) + deps_list = " \n".join([x.name for x in build_deps]) + detail += deps_list raise ElementError("{}: {} element must have exactly 1 build-dependency, actually have {}" .format(self, type(self).__name__, len(build_deps)), detail=detail, reason="filter-bdepend-wrong-count") @@ -73,7 +74,8 @@ class FilterElement(Element): runtime_deps = list(self.dependencies(Scope.RUN, recurse=False)) if build_deps[0] in runtime_deps: detail = "Full list of runtime depends:\n" - detail += " \n".join([x.name for x in runtime_deps]) + deps_list = " \n".join([x.name for x in runtime_deps]) + detail += deps_list raise ElementError("{}: {} element's build dependency must not also be a runtime dependency" .format(self, type(self).__name__), detail=detail, reason="filter-bdepend-also-rdepend") diff --git a/buildstream/plugins/sources/_downloadablefilesource.py b/buildstream/plugins/sources/_downloadablefilesource.py index dba2a7356..39bd48d25 100644 --- a/buildstream/plugins/sources/_downloadablefilesource.py +++ b/buildstream/plugins/sources/_downloadablefilesource.py @@ -115,11 +115,13 @@ class DownloadableFileSource(Source): return (sha256, etag) - except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError) as e: - if isinstance(e, urllib.error.HTTPError) and e.code == 304: - # Already cached and not modified + except urllib.error.HTTPError as e: + if e.code == 304: return (self.ref, self.etag) + raise SourceError("{}: Error mirroring {}: {}" + .format(self, self.url, e)) from e + except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError) as e: raise SourceError("{}: Error mirroring {}: {}" .format(self, self.url, e)) from e @@ -161,6 +161,10 @@ if __name__ == '__main__': sys.exit({2}())''' +# Modify the get_args() function of the ScriptWriter class +# Note: the pylint no-member warning has been disabled as the functions: get_header(), +# ensure_safe_name() and _get_script_args() are all members of this class. +# pylint: disable=no-member @classmethod def get_args(cls, dist, header=None): if header is None: |