예제 #1
0
def cstyle(fh, filename=None, output=sys.stderr, **opts):
	opttrans = {'check_continuation': '-c',
		    'heuristic': '-h',
		    'picky': '-p',
		    'verbose': '-v',
		    'ignore_hdr_comment': '-C',
		    'check_posix_types': '-P',
		    'doxygen_comments': '-o doxygen',
		    'splint_comments': '-o splint'}

	for x in filter(lambda x: x not in opttrans, opts):
		raise TypeError('cstyle() got an unexpected keyword '
				'argument %s' % x)

	options = [opttrans[x] for x in opts if opts[x]]

	if not filename:
		filename = fh.name

	ret, tmpfile = processcheck('cstyle', options, fh, output)

	if tmpfile:
		for line in tmpfile:
			line = line.replace('<stdin>', filename)
			output.write(line)

		tmpfile.close()
	return ret
예제 #2
0
파일: JStyle.py 프로젝트: wca/openzfs
def jstyle(fh, filename=None, output=sys.stderr, **opts):
    opttrans = {
        'check_continuation': '-c',
        'heuristic': '-h',
        'picky': '-p',
        'ignore_hdr_comment': '-C',
        'verbose': '-v',
        'tabs': '-t'
    }

    for x in filter(lambda x: x not in opttrans, opts):
        raise TypeError('jstyle() got an unexpected keyword '
                        'argument %s' % x)

    options = [opttrans[x] for x in opts if opts[x]]

    if not filename:
        filename = fh.name

    ret, tmpfile = processcheck('jstyle', options, fh, output)

    if tmpfile:
        for line in tmpfile:
            line = line.replace('<stdin>', filename)
            output.write(line)

        tmpfile.close()

    return ret
예제 #3
0
def lint(fh, filename=None, output=sys.stderr, **opts):
	if not filename:
		filename = fh.name

	options = ['-n', '/dev/stdin', '/dev/null']

	ret, tmpfile = processcheck('shcomp', options, fh, output)

	if tmpfile:
		for line in tmpfile:
			if '`...` obsolete' in line:
				continue
			ret = 1

			line = line.replace('/dev/stdin', filename)
			line = line.replace('warning: ', '')
			output.write(line)

		tmpfile.close()
	return ret
예제 #4
0
파일: ManLint.py 프로젝트: wca/openzfs
def manlint(fh, filename=None, output=sys.stderr, **opts):
	opttrans = { 'picky': None }

	for x in filter(lambda x: x not in opttrans, opts):
		raise TypeError('mandoc() got an unexpected keyword '
				'argument %s' % x)

	options = [opttrans[x] for x in opts if opts[x] and opttrans[x]]
	options.append('-Tlint')

	if not filename:
		filename = fh.name

	ret, tmpfile = processcheck('mandoc', options, fh, output)

	if tmpfile:
		for line in tmpfile:
			line = line.replace('<stdin>', filename)
			output.write(line)

		tmpfile.close()
	return ret