Commit Graph

20 Commits

Author SHA1 Message Date
Augie Fackler
22265cfcba filterpyflakes: move self-test into test file
This will avoid a false positive on an upcoming check-code rule.

Differential Revision: https://phab.mercurial-scm.org/D18
2017-07-07 15:07:36 -04:00
Yuya Nishihara
cde823009a filterpyflakes: allow reexporting pure symbols from cffi modules
cffi modules will do 'from ..pure.<module> import *'.
2017-05-28 17:36:01 +09:00
Gregory Szorc
5d323ec3c4 tests: remove special handling for undefined memoryview
'memoryview' was introduced in Python 2.7. 73ce96f78032 added code
to filterpyflakes.py to ignore "undefined name 'memoryview'" pyflakes
warnings. Since we no longer support <Python 2.7, we can remove this
workaround.
2017-05-13 11:31:36 -07:00
Augie Fackler
0058294764 filterpyflakes: dramatically simplify the entire thing by blacklisting
We've only got one kind of pyflakes failure left in our codebase, so
it's time to switch over to a blacklist-based checking scheme. I've
left in the filtering of two undefined names for now out of paranoia,
but those can probably go too.
2016-11-10 16:49:42 -05:00
Augie Fackler
2382566005 filterpyflakes: whitelist listcomp aliasing checking
The test change is because of how filterpyflakes is organized - a line
number changed.
2016-11-10 16:37:18 -05:00
Robert Stanca
a51cbf4e77 py3: use print_function in filterpyflakes.py 2016-04-02 17:35:02 +03:00
Gregory Szorc
eeefc7c496 tests/filterpyflakes: use absolute_import 2015-12-06 22:22:09 -08:00
FUJIWARA Katsunori
6e07d94050 tests: make filterpyflakes.py read target files relatively to cwd
Before this patch, 'filterpyflakes.py' reads target files relatively
to own location.

But this prevents third party tools from using it in own source tree,
because their files are placed separately from 'filterpyflakes.py'.

In fact, 'test-check-pyflakes.t', which is the only user of
'filterpyflakes.py', changes current working directory (cwd) to the
root of "test target" source tree before using it. Therefore,
composing the root of source tree in 'filterpyflakes.py' is redundant.

This patch makes 'filterpyflakes.py' read target files relatively to
cwd by invoking 'open()' without any path composition. This also
removes importing 'os' module, because there is no user of it after
this patch.

This is a one of preparation of issue4677.
2015-08-13 22:10:52 +09:00
Matt Mackall
89a3b43f20 filterpyflakes: filter WindowsError unconditionally 2014-05-13 19:29:45 -05:00
Matt Mackall
88809bfcbd filterpyflakes: make memoryview filtering unconditional 2014-05-13 19:22:40 -05:00
FUJIWARA Katsunori
6750e4199f tests: ignore "undefined name 'memoryview'" pyflakes error on earlier Python
Before this patch, "test-check-pyflakes.t" shows unexpected "undefined
name 'memoryview'" error for "mercurial/util.py" on Python 2.6.x or
earlier, because they don't define symbol 'memoryview'.

This patch introduces excluding patterns into "filterpyflakes.py" to
ignore "undefined name 'memoryview'" pyflakes error on Python 2.6.x or
earlier
2014-05-09 08:44:53 +09:00
Yuya Nishihara
2e43b76140 test-pyflakes: detect undefined name error
It should be able to catch the following mistakes at 764c0874d3c8:

    mercurial/exchange.py:590: undefined name 'UnknownPartError'
    mercurial/match.py:346: undefined name 'pat'
    mercurial/win32.py:365: undefined name '_ERROR_NO_MORE_FILES'
    tests/killdaemons.py:46: undefined name 'check'
2014-04-29 12:54:01 +09:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
Simon Heimberg
180e520fa6 tests: do not skip code-checking on some whole files
In filterpyflakes the term no-check-code was probably by accident.
In the test the intention was not to skip the entire file but only one
line. But any skipping seems to be unnecessary since a longer time.
2013-07-01 06:50:58 +02:00
Simon Heimberg
3110add076 tests: simplify and document the sorting of pyflake messages
The pyflake messages are simply ordered by message type, path, line no (and
message text).
The message type is taken from the order of the filters.

The previous ordering looks complicated and illogically.
It was the following order (r'\3:\5:\4:\1:\2:' + line):
  message (\3 and \5)
  var name (\4)
  path (\1)
  line no (\2)
  line reference
Ordering by var name before path looks illogically for me.
2013-06-26 23:12:55 +02:00
Augie Fackler
3b46ff5101 pyflakes: ignore files marked no-check-code 2011-05-06 10:17:07 -05:00
timeless
1760e54c82 test: add pyflakes checking for unable to detect undefined names 2011-05-01 17:36:16 +02:00
timeless
8351ef925f tests: add pyflakes checking for assigned to but never used 2011-05-01 17:27:41 +02:00
timeless
1e24d74cfd test-pyflake: improve sorting algorithm 2011-05-01 18:56:27 +02:00
timeless
75e43f8a4b tests: add pyflakes checking for unused imports 2011-05-01 15:22:30 +02:00