mirror of https://github.com/zulip/zulip.git
lint: Add a lint check for bare `type: ignore`s.
This commit is contained in:
parent
e6e3bbb780
commit
53e4d8562b
|
@ -61,7 +61,7 @@ def get_old_conf(output_filename):
|
|||
secrets_file = six.moves.configparser.RawConfigParser()
|
||||
secrets_file.read(output_filename)
|
||||
|
||||
return dict(secrets_file.items("secrets")) # type: ignore
|
||||
return dict(secrets_file.items("secrets")) # type: ignore # likely typeshed issue
|
||||
|
||||
def generate_secrets(development=False):
|
||||
# type: (bool) -> None
|
||||
|
|
|
@ -205,6 +205,11 @@ def build_custom_checkers(by_lang):
|
|||
'description': 'Use `is None` to check whether something is None'},
|
||||
{'pattern': "type:[(]",
|
||||
'description': 'Missing whitespace after ":" in type annotation'},
|
||||
{'pattern': "type: ignore$",
|
||||
'exclude': set(['tools/tests',
|
||||
'zerver/lib/test_runner.py',
|
||||
'zerver/tests']),
|
||||
'description': '"type: ignore" should always end with "# type: ignore # explanation for why"'},
|
||||
{'pattern': "# type [(]",
|
||||
'description': 'Missing : after type in type annotation'},
|
||||
{'pattern': "#type",
|
||||
|
|
|
@ -76,5 +76,5 @@ class EmbeddedBotHandler(object):
|
|||
our_dir, '..', 'bots', bot_name, bot_name + '.conf'))
|
||||
section = section or bot_name
|
||||
config = configparser.ConfigParser()
|
||||
config.readfp(open(conf_file_path)) # type: ignore
|
||||
config.readfp(open(conf_file_path)) # type: ignore # likely typeshed issue
|
||||
return dict(config.items(section))
|
||||
|
|
|
@ -171,7 +171,7 @@ def stdout_suppressed():
|
|||
"""Redirect stdout to /dev/null."""
|
||||
|
||||
with open(os.devnull, 'a') as devnull:
|
||||
stdout, sys.stdout = sys.stdout, devnull # type: ignore
|
||||
stdout, sys.stdout = sys.stdout, devnull # type: ignore # monkey-patching
|
||||
yield stdout
|
||||
sys.stdout = stdout
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class LocalUploader(Uploader):
|
|||
def write_local_file(self, path, file_data):
|
||||
# type: (Text, binary_type) -> None
|
||||
self.mkdirs(path)
|
||||
with open(path, 'wb') as f: # type: ignore
|
||||
with open(path, 'wb') as f: # type: ignore # likely mypy bug
|
||||
f.write(file_data)
|
||||
|
||||
def upload_files(self, response, resized_image, dst_path_id):
|
||||
|
|
|
@ -244,7 +244,7 @@ class SocialAuthMixin(ZulipAuthMixin):
|
|||
"""
|
||||
try:
|
||||
# Call the auth_complete method of BaseOAuth2 is Python Social Auth
|
||||
return super(SocialAuthMixin, self).auth_complete(*args, **kwargs) # type: ignore
|
||||
return super(SocialAuthMixin, self).auth_complete(*args, **kwargs) # type: ignore # monkey-patching
|
||||
except AuthFailed:
|
||||
return None
|
||||
except SocialAuthBaseException as e:
|
||||
|
|
Loading…
Reference in New Issue