コード例 #1
0
def cdm_cstyle(ui, repo, *args, **opts):
    '''check active C source files conform to the C Style Guide

    Check that any added or modified C source file conform to the C
    Style Guide.

    See the C Style Guide for more information about correct C source
    formatting.
    (http://hub.opensolaris.org/bin/download/Community+Group+on/WebHome/cstyle.ms.pdf)

    Files can be excluded from this check using the cstyle.NOT file.
    See NOT Files in the extension documentation ('hg help cdm').
    '''

    filelist = buildfilelist(wslist[repo], opts.get('parent'), args)
    exclude = not_check(repo, 'cstyle')
    ret = 0

    ui.write('C style check:\n')

    for f, e in filelist:
        if e and e.is_removed():
            continue
        elif not (f.endswith('.c') or 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 |= CStyle.cstyle(fh, output=ui,
                             picky=True, check_posix_types=True,
                             check_continuation=True)
        fh.close()
    return ret
コード例 #2
0
ファイル: cdm.py プロジェクト: xiaobiqiang/opensolaris
def cdm_cstyle(ui, repo, *args, **opts):
    '''check active C source files conform to the C Style Guide

    See http://opensolaris.org/os/community/documentation/getting_started_docs/cstyle.ms.pdf'''

    filelist = buildfilelist(wslist[repo], opts.get('parent'), args)
    exclude = not_check(repo, 'cstyle')
    ret = 0

    ui.write('C style check:\n')

    for f, e in filelist:
        if e and e.is_removed():
            continue
        elif not (f.endswith('.c') or 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 |= CStyle.cstyle(fh,
                             output=ui,
                             picky=True,
                             check_posix_types=True,
                             check_continuation=True)
        fh.close()
    return ret
コード例 #3
0
def cstyle(root, parent, flist, output):
    ret = 0
    output.write("C style:\n")
    for f in flist(lambda x: x.endswith('.c') or x.endswith('.h')):
        with io.open(f, mode='rb') as fh:
            ret |= CStyle.cstyle(fh, output=output, picky=True,
                             check_posix_types=True,
                             check_continuation=True)
    return ret
コード例 #4
0
ファイル: git-pbchk.py プロジェクト: bahamas10/openzfs
def cstyle(root, parent, flist, output):
    ret = 0
    output.write("C style:\n")
    for f in flist(lambda x: x.endswith('.c') or x.endswith('.h')):
        fh = open(f, 'r')
        ret |= CStyle.cstyle(fh, output=output, picky=True,
                             check_posix_types=True,
                             check_continuation=True)
        fh.close()
    return ret
コード例 #5
0
def cstyle(root, parent, flist, output):
    ret = 0
    output.write("C style:\n")
    for f in flist(lambda x: x.endswith('.c') or x.endswith('.h')):
        fh = open(f, 'r')
        ret |= CStyle.cstyle(fh, output=output, picky=True,
                             check_posix_types=True,
                             check_continuation=True)
        fh.close()
    return ret