예제 #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
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
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
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