From patchwork Fri May 2 04:28:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 4] test-pyflakes: do not parse file that is unlikely a Python script From: Yuya Nishihara X-Patchwork-Id: 4483 Message-Id: <9428e9853f59843545ea.1399004938@gimlet> To: mercurial-devel@selenic.com Date: Fri, 02 May 2014 13:28:58 +0900 # HG changeset patch # User Yuya Nishihara # Date 1398743365 -32400 # Tue Apr 29 12:49:25 2014 +0900 # Branch stable # Node ID 9428e9853f59843545eac04caf8463ebf1d5efa2 # Parent ab91be7bb1a363e7ff320bece1e238dcf8d634e1 test-pyflakes: do not parse file that is unlikely a Python script This eliminates false alarm triggered by parsing shell scripts or template map files. For example, "pyflakes mercurial/templates/atom/map" reports many "undefined name"s. diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t --- a/tests/test-check-pyflakes.t +++ b/tests/test-check-pyflakes.t @@ -2,10 +2,9 @@ $ cd "`dirname "$TESTDIR"`" -run pyflakes on all tracked files ending in .py or without a file ending -(skipping binary file random-seed) +run pyflakes on all tracked python scripts - $ hg locate -r. -I '**.py' -I 'relre:^[^.]*$' -X 'relre:/random_seed$' \ + $ hg locate -r. -I '**.py' -I 'set: "relre:^[^.]*$" and grep("^#!.*python")' \ > 2>/dev/null | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py" contrib/win32/hgwebdir_wsgi.py:*: 'win32traceutil' imported but unused (glob) setup.py:*: 'sha' imported but unused (glob)