lint: require const field names to be in ALL_CAPS
GitOrigin-RevId: 8b6c20e6d978f2756bdbf946ff860ce5cc48e3ce
This commit is contained in:
parent
5549f15029
commit
6b95a66859
@ -32,14 +32,20 @@ def lint_csharp(filename):
|
||||
if len(line) > MAX_LINE_LENGTH:
|
||||
if not re.match(r'\s*// https?:', line):
|
||||
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):
|
||||
emit_error(filename, line_num, 'illegal \\t character')
|
||||
if re.search(r'\r', line):
|
||||
emit_error(filename, line_num, 'illegal \\r character')
|
||||
if re.search(r'\s+$', line):
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user