Details
Details
- Reviewers
spectral - Group Reviewers
hg-reviewers - Commits
- rHG4889b84b15f2: check-code: suggest pycompat.is(posix|windows|darwin)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| spectral |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| pyfilters = [ | pyfilters = [ | ||||
| (r"""(?msx)(?P<comment>\#.*?$)| | (r"""(?msx)(?P<comment>\#.*?$)| | ||||
| ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | ||||
| (?P<text>(([^\\]|\\.)*?)) | (?P<text>(([^\\]|\\.)*?)) | ||||
| (?P=quote))""", reppython), | (?P=quote))""", reppython), | ||||
| ] | ] | ||||
| # non-filter patterns | |||||
| pynfpats = [ | |||||
| [ | |||||
| (r'pycompat\.osname\s*[=!]=\s*[\'"]nt[\'"]', "use pycompat.iswindows"), | |||||
| (r'pycompat\.osname\s*[=!]=\s*[\'"]posix[\'"]', "use pycompat.isposix"), | |||||
| (r'pycompat\.sysplatform\s*[!=]=\s*[\'"]darwin[\'"]', | |||||
| "use pycompat.isdarwin"), | |||||
| ], | |||||
| # warnings | |||||
| [], | |||||
| ] | |||||
| # extension non-filter patterns | # extension non-filter patterns | ||||
| pyextnfpats = [ | pyextnfpats = [ | ||||
| [(r'^"""\n?[A-Z]', "don't capitalize docstring title")], | [(r'^"""\n?[A-Z]', "don't capitalize docstring title")], | ||||
| # warnings | # warnings | ||||
| [], | [], | ||||
| ] | ] | ||||
| txtfilters = [] | txtfilters = [] | ||||
| (r'os\.setenv', "modifying the environ dict is not preferred"), | (r'os\.setenv', "modifying the environ dict is not preferred"), | ||||
| ], | ], | ||||
| # warnings | # warnings | ||||
| [], | [], | ||||
| ] | ] | ||||
| checks = [ | checks = [ | ||||
| ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats), | ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats), | ||||
| ('python', r'.*\.(py|cgi)$', r'^#!.*python', [], pynfpats), | |||||
| ('python', r'.*hgext.*\.py$', '', [], pyextnfpats), | ('python', r'.*hgext.*\.py$', '', [], pyextnfpats), | ||||
| ('python 3', r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py', | ('python 3', r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py', | ||||
| '', pyfilters, py3pats), | '', pyfilters, py3pats), | ||||
| ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), | ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), | ||||
| ('c', r'.*\.[ch]$', '', cfilters, cpats), | ('c', r'.*\.[ch]$', '', cfilters, cpats), | ||||
| ('unified test', r'.*\.t$', '', utestfilters, utestpats), | ('unified test', r'.*\.t$', '', utestfilters, utestpats), | ||||
| ('layering violation repo in revlog', r'mercurial/revlog\.py', '', | ('layering violation repo in revlog', r'mercurial/revlog\.py', '', | ||||
| pyfilters, inrevlogpats), | pyfilters, inrevlogpats), | ||||