def on_pr_opened(self, api, payload): diff = api.get_diff() for line in diff.split('\n'): if is_addition(line) and line.find("<title></title>") > -1: # This test doesn't consider case and whitespace the same way # that a HTML parser does, so empty title elements might still # go unnoticed. It will catch the low-hanging fruit, though. self.warn(WARNING) return
def get_added_lines(self): diff = self.get_diff() for line in diff.splitlines(): if is_addition(line): # prefix of one or two pluses (+) yield line
def on_pr_opened(self, api, payload): diff = api.get_diff() for line in diff.split('\n'): if is_addition(line) and line.find('unsafe ') > -1: self.warn(unsafe_warning_msg) return