Skip to content

Commit bde564a

Browse files
authored
turn on disallowed html tags and filter broken site link (#496)
1 parent 381d1f7 commit bde564a

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

azdev/operations/linter/rules/command_group_rules.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def require_wait_command_if_no_wait(linter, command_group_name):
4545
raise RuleError("Group does not have a 'wait' command, yet '{}' exposes '--no-wait'".format(cmd))
4646

4747

48-
@CommandGroupRule(LinterSeverity.MEDIUM)
48+
@CommandGroupRule(LinterSeverity.HIGH)
4949
def disallowed_html_tag_from_command_group(linter, command_group_name):
5050
if command_group_name == '' or not linter.get_loaded_help_entry(command_group_name):
5151
return
@@ -69,9 +69,11 @@ def broken_site_link_from_command_group(linter, command_group_name):
6969
if command_group_name == '' or not linter.get_loaded_help_entry(command_group_name):
7070
return
7171
help_entry = linter.get_loaded_help_entry(command_group_name)
72-
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary)):
72+
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary,
73+
linter.diffed_lines)):
7374
raise RuleError("Broken links {} in short summary. "
7475
"If link is an example, please wrap it with backtick. ".format(broken_links))
75-
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary)):
76+
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary,
77+
linter.diffed_lines)):
7678
raise RuleError("Broken links {} in long summary. "
7779
"If link is an example, please wrap it with backtick. ".format(broken_links))

azdev/operations/linter/rules/command_rules.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def group_delete_commands_should_confirm(linter, command_name):
4040
"Please make sure to ask for confirmation.")
4141

4242

43-
@CommandRule(LinterSeverity.MEDIUM)
43+
@CommandRule(LinterSeverity.HIGH)
4444
def disallowed_html_tag_from_command(linter, command_name):
4545
if command_name == '' or not linter.get_loaded_help_entry(command_name):
4646
return
@@ -64,9 +64,11 @@ def broken_site_link_from_command(linter, command_name):
6464
if command_name == '' or not linter.get_loaded_help_entry(command_name):
6565
return
6666
help_entry = linter.get_loaded_help_entry(command_name)
67-
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary)):
67+
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary,
68+
linter.diffed_lines)):
6869
raise RuleError("Broken links {} in short summary. "
6970
"If link is an example, please wrap it with backtick. ".format(broken_links))
70-
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary)):
71+
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary,
72+
linter.diffed_lines)):
7173
raise RuleError("Broken links {} in long summary. "
7274
"If link is an example, please wrap it with backtick. ".format(broken_links))

azdev/operations/linter/rules/parameter_rules.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def option_should_not_contain_under_score(linter, command_name, parameter_name):
174174
raise RuleError("Argument's option {} contains '_' which should be '-' instead.".format(option))
175175

176176

177-
@ParameterRule(LinterSeverity.MEDIUM)
177+
@ParameterRule(LinterSeverity.HIGH)
178178
def disallowed_html_tag_from_parameter(linter, command_name, parameter_name):
179179
if linter.command_expired(command_name) or not linter.get_parameter_help_info(command_name, parameter_name):
180180
return
@@ -199,9 +199,11 @@ def broken_site_link_from_parameter(linter, command_name, parameter_name):
199199
if linter.command_expired(command_name) or not linter.get_parameter_help_info(command_name, parameter_name):
200200
return
201201
help_entry = linter.get_parameter_help_info(command_name, parameter_name)
202-
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary)):
202+
if help_entry.short_summary and (broken_links := has_broken_site_links(help_entry.short_summary,
203+
linter.diffed_lines)):
203204
raise RuleError("Broken links {} in short summary. "
204205
"If link is an example, please wrap it with backtick. ".format(broken_links))
205-
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary)):
206+
if help_entry.long_summary and (broken_links := has_broken_site_links(help_entry.long_summary,
207+
linter.diffed_lines)):
206208
raise RuleError("Broken links {} in long summary. "
207209
"If link is an example, please wrap it with backtick. ".format(broken_links))

0 commit comments

Comments
 (0)