def hdrchk(root, parent, flist, output): ret = 0 output.write("Header format:\n") for f in flist(lambda x: x.endswith('.h')): with io.open(f, encoding='utf-8', errors='replace') as fh: ret |= HdrChk.hdrchk(fh, lenient=True, output=output) return ret
def cdm_hdrchk(ui, repo, *args, **opts): '''check active C header files conform to the O/N header rules Check that any added or modified C header files conform to the O/N header rules. See the section 'HEADER STANDARDS' in the hdrchk(1) manual page for more information on the rules for O/N header file formatting. Files can be excluded from this check using the hdrchk.NOT file. See NOT Files in the extension documentation ('hg help cdm'). ''' filelist = buildfilelist(wslist[repo], opts.get('parent'), args) exclude = not_check(repo, 'hdrchk') ret = 0 ui.write('Header format check:\n') for f, e in filelist: if e and e.is_removed(): continue elif not f.endswith('.h'): continue elif (e or opts.get('honour_nots')) and exclude(f): ui.status('Skipping %s...\n' % f) continue fh = open(f, 'r') ret |= HdrChk.hdrchk(fh, lenient=True, output=ui) fh.close() return ret
def hdrchk(root, parent, flist, output): ret = 0 output.write("Header format:\n") for f in flist(lambda x: x.endswith('.h')): fh = open(f, 'r') ret |= HdrChk.hdrchk(fh, lenient=True, output=output) fh.close() return ret
def cdm_hdrchk(ui, repo, *args, **opts): '''check active header files conform to O/N rules''' filelist = buildfilelist(wslist[repo], opts.get('parent'), args) exclude = not_check(repo, 'hdrchk') ret = 0 ui.write('Header format check:\n') for f, e in filelist: if e and e.is_removed(): continue elif not f.endswith('.h'): continue elif (e or opts.get('honour_nots')) and exclude(f): ui.status('Skipping %s...\n' % f) continue fh = open(f, 'r') ret |= HdrChk.hdrchk(fh, lenient=True, output=ui) fh.close() return ret
def hdrchk(self, fh, name=None, lenient=False): out = StringIO() HdrChk.hdrchk(fh, filename=name, lenient=lenient, output=out) return out.getvalue()