mirror of
https://github.com/zulip/zulip.git
synced 2025-10-25 17:14:02 +00:00
lint: Migrate typing.Text check to semgrep.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
e5779c1ca0
commit
d0d8c358b3
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
from typing import List, Text
|
||||
from typing import List
|
||||
|
||||
from gitlint.git import GitCommit
|
||||
from gitlint.options import StrOption
|
||||
@@ -85,7 +85,7 @@ imperative_forms = [
|
||||
imperative_forms.sort()
|
||||
|
||||
|
||||
def head_binary_search(key: Text, words: List[str]) -> str:
|
||||
def head_binary_search(key: str, words: List[str]) -> str:
|
||||
""" Find the imperative mood version of `word` by looking at the first
|
||||
3 characters. """
|
||||
|
||||
@@ -124,7 +124,7 @@ class ImperativeMood(LineRule):
|
||||
error_msg = ('The first word in commit title should be in imperative mood '
|
||||
'("{word}" -> "{imperative}"): "{title}"')
|
||||
|
||||
def validate(self, line: Text, commit: GitCommit) -> List[RuleViolation]:
|
||||
def validate(self, line: str, commit: GitCommit) -> List[RuleViolation]:
|
||||
violations = []
|
||||
|
||||
# Ignore the section tag (ie `<section tag>: <message body>.`)
|
||||
@@ -152,7 +152,7 @@ class TitleMatchRegexAllowException(LineRule):
|
||||
target = CommitMessageTitle
|
||||
options_spec = [StrOption('regex', ".*", "Regex the title should match")]
|
||||
|
||||
def validate(self, title: Text, commit: GitCommit) -> List[RuleViolation]:
|
||||
def validate(self, title: str, commit: GitCommit) -> List[RuleViolation]:
|
||||
|
||||
regex = self.options['regex'].value
|
||||
pattern = re.compile(regex, re.UNICODE)
|
||||
|
||||
Reference in New Issue
Block a user