|
@ -32,14 +32,20 @@ def lint_csharp(filename): |
|
|
if len(line) > MAX_LINE_LENGTH: |
|
|
if len(line) > MAX_LINE_LENGTH: |
|
|
if not re.match(r'\s*// https?:', line): |
|
|
if not re.match(r'\s*// https?:', line): |
|
|
emit_error(filename, line_num, 'line too long') |
|
|
emit_error(filename, line_num, 'line too long') |
|
|
|
|
|
if re.match(r'\s*//\S', line): |
|
|
|
|
|
emit_error(filename, line_num, 'no space between // and comment') |
|
|
|
|
|
match = re.match(r'\s*const.* (\w+) =', line) |
|
|
|
|
|
if match: |
|
|
|
|
|
identifier = match.group(1) |
|
|
|
|
|
if not re.fullmatch(r'[A-Z_]+', identifier): |
|
|
|
|
|
emit_error(filename, line_num, |
|
|
|
|
|
'const field %s should be in ALL_CAPS' % identifier) |
|
|
if re.search(r'\t', line): |
|
|
if re.search(r'\t', line): |
|
|
emit_error(filename, line_num, 'illegal \\t character') |
|
|
emit_error(filename, line_num, 'illegal \\t character') |
|
|
if re.search(r'\r', line): |
|
|
if re.search(r'\r', line): |
|
|
emit_error(filename, line_num, 'illegal \\r character') |
|
|
emit_error(filename, line_num, 'illegal \\r character') |
|
|
if re.search(r'\s+$', line): |
|
|
if re.search(r'\s+$', line): |
|
|
emit_error(filename, line_num, 'trailing whitespace') |
|
|
emit_error(filename, line_num, 'trailing whitespace') |
|
|
if re.match(r'\s*//\S', line): |
|
|
|
|
|
emit_error(filename, line_num, 'no space between // and comment') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(args): |
|
|
def main(args): |
|
|