コード例 #1
0
def jstyle(root, parent, flist, output):
    ret = 0
    output.write("Java style:\n")
    for f in flist(lambda x: x.endswith('.java')):
        with io.open(f, mode='rb') as fh:
            ret |= JStyle.jstyle(fh, output=output, picky=True)
    return ret
コード例 #2
0
def cdm_jstyle(ui, repo, *args, **opts):
    '''check active Java source files for common stylistic errors

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

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

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

    for f, e in filelist:
        if e and e.is_removed():
            continue
        elif not f.endswith('.java'):
            continue
        elif (e or opts.get('honour_nots')) and exclude(f):
            ui.status('Skipping %s...\n' % f)
            continue

        fh = open(f, 'r')
        ret |= JStyle.jstyle(fh, output=ui, picky=True)
        fh.close()
    return ret
コード例 #3
0
def jstyle(root, parent, flist, output):
    ret = 0
    output.write("Java style:\n")
    for f in flist(lambda x: x.endswith('.java')):
        with io.open(f, encoding='utf-8', errors='replace') as fh:
            ret |= JStyle.jstyle(fh, output=output, picky=True)
    return ret
コード例 #4
0
ファイル: git-pbchk.py プロジェクト: karky7/illumos-gate
def jstyle(root, parent, flist, output):
    ret = 0
    output.write("Java style:\n")
    for f in flist(lambda x: x.endswith('.java')):
        fh = open(f, 'r')
        ret |= JStyle.jstyle(fh, output=output, picky=True)
        fh.close()
    return ret
コード例 #5
0
ファイル: git-pbchk.py プロジェクト: bahamas10/openzfs
def jstyle(root, parent, flist, output):
    ret = 0
    output.write("Java style:\n")
    for f in flist(lambda x: x.endswith('.java')):
        fh = open(f, 'r')
        ret |= JStyle.jstyle(fh, output=output, picky=True)
        fh.close()
    return ret
コード例 #6
0
ファイル: cdm.py プロジェクト: illumsoft/illumos-gate
def cdm_jstyle(ui, repo, *args, **opts):
    'check active Java source files for common stylistic errors'

    filelist = opts.get('filelist') or _buildfilelist(repo, args)

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

    ret = 0
    exclude = not_check(repo, 'jstyle')

    for f, e in filelist.iteritems():
        if e and e.is_removed():
            continue
        elif not f.endswith('.java'):
            continue
        elif (e or opts.get('honour_nots')) and exclude(f):
            ui.status('Skipping %s...\n' % f)
            continue

        fh = open(f, 'r')
        ret |= JStyle.jstyle(fh, output=ui, picky=True)
        fh.close()
    return ret