Nir Soffer has posted comments on this change. Change subject: build: Forbid bare except: ......................................................................
Patch Set 3: (1 comment) .................................................... File Makefile.am Line 78: SKIP_PYFLAKES_ERR = "\./vdsm/storage/lvm\.py.*: list comprehension redefines \ Line 79: 'lv' from line .*" Line 80: Line 81: check-local: Line 82: if git show | egrep '^\+\s+except:\s*(#.+)?$$'; then \ Considering the amount of pain we already cause by enforcing pep8 whitespace rules, which many time make the code less readable, I don't think we add much pain with fixing a bare except once in a while. A bare "except:" is worse then "except Exception:", because it catches SystemExit and KeyboardInterrupt, which is almost never your intent. For example: while 1: try: time.sleep(10) sys.exit() # panic except: print 'nee!' A warning is not very effective because it will be lost in the sea of messages during a build. And it requires much more work because you would like a warning for each location, and not one error on the first error. I agree that this must use git only if git is installed, and when running inside a git repository. I think that the current implementation do work as expected - if git is not installed, or git show fails, we will not get into the if. It seems that the right place for this is in tool like pyflakes. Line 83: echo "error: empty "except:" is forbidden!"; \ Line 84: exit 1; \ Line 85: fi Line 86: find . -path './.git' -prune -type f -o \ -- To view, visit http://gerrit.ovirt.org/22456 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5b7f33b6eb1c90610b3a5d053ba65ce3fc6b74fa Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Saggi Mizrahi <smizr...@redhat.com> Gerrit-Reviewer: Vinzenz Feenstra <vfeen...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches