##// END OF EJS Templates
py3: add warnings in check-code related to py3...
Pulkit Goyal -
r30665:01721d38 default
parent child Browse files
Show More
@@ -456,8 +456,26 b' allfilespats = ['
456 [],
456 [],
457 ]
457 ]
458
458
459 py3pats = [
460 [
461 (r'os\.environ', "use encoding.environ instead (py3)"),
462 (r'os\.name', "use pycompat.osname instead (py3)"),
463 (r'os\.getcwd', "use pycompat.getcwd instead (py3)"),
464 (r'os\.sep', "use pycompat.ossep instead (py3)"),
465 (r'os\.pathsep', "use pycompat.ospathsep instead (py3)"),
466 (r'os\.altsep', "use pycompat.osaltsep instead (py3)"),
467 (r'os\.getenv', "use pycompat.osgetenv instead (py3)"),
468 (r'sys\.platform', "use pycompat.sysplatform instead (py3)"),
469 (r'getopt\.getopt', "use pycompat.getoptb instead (py3)"),
470 ],
471 # warnings
472 [],
473 ]
474
459 checks = [
475 checks = [
460 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
476 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
477 ('python 3', r'.*(hgext|mercurial).*(?<!pycompat)\.py', '',
478 pyfilters, py3pats),
461 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
479 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
462 ('c', r'.*\.[ch]$', '', cfilters, cpats),
480 ('c', r'.*\.[ch]$', '', cfilters, cpats),
463 ('unified test', r'.*\.t$', '', utestfilters, utestpats),
481 ('unified test', r'.*\.t$', '', utestfilters, utestpats),
@@ -9,10 +9,47 b' New errors are not allowed. Warnings are'
9
9
10 $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
10 $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
11 > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false
11 > sed 's-\\-/-g' | xargs "$check_code" --warnings --per-file=0 || false
12 hgext/fsmonitor/__init__.py:295:
13 > switch_slashes = os.sep == '\\'
14 use pycompat.ossep instead (py3)
15 hgext/fsmonitor/__init__.py:395:
16 > if 'FSMONITOR_LOG_FILE' in os.environ:
17 use encoding.environ instead (py3)
18 hgext/fsmonitor/__init__.py:396:
19 > fn = os.environ['FSMONITOR_LOG_FILE']
20 use encoding.environ instead (py3)
21 hgext/fsmonitor/__init__.py:437:
22 > 'HG_PENDING' not in os.environ)
23 use encoding.environ instead (py3)
24 hgext/fsmonitor/__init__.py:548:
25 > if sys.platform == 'darwin':
26 use pycompat.sysplatform instead (py3)
12 Skipping i18n/polib.py it has no-che?k-code (glob)
27 Skipping i18n/polib.py it has no-che?k-code (glob)
28 mercurial/demandimport.py:309:
29 > if os.environ.get('HGDEMANDIMPORT') != 'disable':
30 use encoding.environ instead (py3)
31 mercurial/encoding.py:54:
32 > environ = os.environ
33 use encoding.environ instead (py3)
34 mercurial/encoding.py:56:
35 > environ = os.environb
36 use encoding.environ instead (py3)
37 mercurial/encoding.py:61:
38 > for k, v in os.environ.items())
39 use encoding.environ instead (py3)
40 mercurial/encoding.py:203:
41 > for k, v in os.environ.items())
42 use encoding.environ instead (py3)
13 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
43 Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
14 Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
44 Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
45 mercurial/policy.py:45:
46 > policy = os.environ.get('HGMODULEPOLICY', policy)
47 use encoding.environ instead (py3)
15 Skipping mercurial/statprof.py it has no-che?k-code (glob)
48 Skipping mercurial/statprof.py it has no-che?k-code (glob)
49 mercurial/win32.py:443:
50 > env, os.getcwd(), ctypes.byref(si), ctypes.byref(pi))
51 use pycompat.getcwd instead (py3)
52 [1]
16
53
17 @commands in debugcommands.py should be in alphabetical order.
54 @commands in debugcommands.py should be in alphabetical order.
18
55
General Comments 0
You need to be logged in to leave comments. Login now