[VDSM] Using pylint to improve your code

Hi all, Dan merge today a patch adding pylint-diff make target. With this target, you can check new code quickly: $ time make pylint ... real 1m31.133s user 1m29.934s sys 0m0.849s $ time make pylint-diff ... real 0m12.364s user 0m11.879s sys 0m0.262s Here is example patch adding stupid code to vdsm: diff --git a/lib/vdsm/common/osutils.py b/lib/vdsm/common/osutils.py index 0b3576a..6d37b7a 100644 --- a/lib/vdsm/common/osutils.py +++ b/lib/vdsm/common/osutils.py @@ -55,5 +55,5 @@ def uninterruptible(func, *args, **kwargs): try: return func(*args, **kwargs) except EnvironmentError as e: - if e.errno != errno.EINTR: + if e.errrno != errno.EINTR: We had real errors like this in vdsm, some of them were made by the author of this message :-) Once committed, running pylint-diff will show: $ make pylint-diff [stripped uninteresting output] ************* Module vdsm.common.osutils E: 58,15: Instance of 'EnvironmentError' has no 'errrno' member (no-member) ERROR: InvocationError: '/home/nsoffer/.local/bin/pylint --errors-only lib/vdsm/common/osutils.py' __________________________________________________________________________________________ summary ___________________________________________________________________________________________ ERROR: pylint: commands failed Makefile:978: recipe for target 'pylint-diff' failed make: *** [pylint-diff] Error 1 This is not part of the build yet, since we still have lot of pylint errors in vdsm. Hopefully we will be pylint clean this week, and we can enable pylint during the build next week: https://gerrit.ovirt.org/75895 Please run pylint-diff before you submit patches. Nir
participants (1)
-
Nir Soffer