contrib/check-code.py
changeset 34648 4889b84b15f2
parent 34642 a679aa582d8d
child 34799 0b46352384a0
equal deleted inserted replaced
34647:dacfcdd8b94e 34648:4889b84b15f2
   395          ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
   395          ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
   396           (?P<text>(([^\\]|\\.)*?))
   396           (?P<text>(([^\\]|\\.)*?))
   397           (?P=quote))""", reppython),
   397           (?P=quote))""", reppython),
   398 ]
   398 ]
   399 
   399 
       
   400 # non-filter patterns
       
   401 pynfpats = [
       
   402     [
       
   403     (r'pycompat\.osname\s*[=!]=\s*[\'"]nt[\'"]', "use pycompat.iswindows"),
       
   404     (r'pycompat\.osname\s*[=!]=\s*[\'"]posix[\'"]', "use pycompat.isposix"),
       
   405     (r'pycompat\.sysplatform\s*[!=]=\s*[\'"]darwin[\'"]',
       
   406      "use pycompat.isdarwin"),
       
   407     ],
       
   408     # warnings
       
   409     [],
       
   410 ]
       
   411 
   400 # extension non-filter patterns
   412 # extension non-filter patterns
   401 pyextnfpats = [
   413 pyextnfpats = [
   402     [(r'^"""\n?[A-Z]', "don't capitalize docstring title")],
   414     [(r'^"""\n?[A-Z]', "don't capitalize docstring title")],
   403     # warnings
   415     # warnings
   404     [],
   416     [],
   511   [],
   523   [],
   512 ]
   524 ]
   513 
   525 
   514 checks = [
   526 checks = [
   515     ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
   527     ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
       
   528     ('python', r'.*\.(py|cgi)$', r'^#!.*python', [], pynfpats),
   516     ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
   529     ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
   517     ('python 3', r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py',
   530     ('python 3', r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py',
   518      '', pyfilters, py3pats),
   531      '', pyfilters, py3pats),
   519     ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
   532     ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
   520     ('c', r'.*\.[ch]$', '', cfilters, cpats),
   533     ('c', r'.*\.[ch]$', '', cfilters, cpats),