Skip to content

Commit

Permalink
Update check_pull_request.py (Azure#21493)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzelin007 authored Mar 4, 2022
1 parent 90e7b8b commit 13cc83d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion scripts/ci/check_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ def regex_line(line):
logger.info('%s%s: missing ` around %s', line, yellow, command)
logger.error(' ' * idx + '↑' + ' ' * (index - idx - 2) + '↑')
error_flag = True
# First word after the colon must be capitalized
if i == ':':
# check extra space character before colon
if idx - 1 >= 0 and line[idx - 1] == ' ':
logger.info('%s%s: please delete extra space character before :', line, yellow)
logger.error(' ' * (idx - 1) + '↑')
error_flag = True
# First word after the colon must be capitalized
index = 0
if line[idx + 1] == ' ' and line[idx + 2].islower() and line[idx + 2: idx + 5] != 'az ':
index = idx + 2
Expand Down Expand Up @@ -163,6 +168,17 @@ def regex_line(line):
'follow https://aka.ms/submitAzPR\n', red, word, yellow, green, k, yellow)
error_flag = True
break
# check extra consecutive spaces
if i == ' ' and (idx + 1) < len(line) and line[idx + 1] == ' ':
logger.info('%s%s: please delete the extra space character', line, yellow)
logger.error(' ' * (idx + 1) + '↑')
error_flag = True

# last character check
if line[-1] in ['.', ',', ' ']:
logger.info('%s%s: please delete the last character', line, yellow)
logger.error(' ' * idx + '↑')
error_flag = True

return error_flag

Expand Down

0 comments on commit 13cc83d

Please sign in to comment.