diff --git a/scripts/setup/generate_secrets.py b/scripts/setup/generate_secrets.py index bd04d79da7..29411bdd0a 100755 --- a/scripts/setup/generate_secrets.py +++ b/scripts/setup/generate_secrets.py @@ -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 diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 17d893dcf4..d2358bae83 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -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", diff --git a/zerver/lib/bot_lib.py b/zerver/lib/bot_lib.py index 0ea790e0c5..e74010117f 100644 --- a/zerver/lib/bot_lib.py +++ b/zerver/lib/bot_lib.py @@ -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)) diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py index e38c87a50a..4fca0b71ab 100644 --- a/zerver/lib/test_helpers.py +++ b/zerver/lib/test_helpers.py @@ -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 diff --git a/zerver/migrations/0077_add_file_name_field_to_realm_emoji.py b/zerver/migrations/0077_add_file_name_field_to_realm_emoji.py index 09255452a4..c58b0da283 100644 --- a/zerver/migrations/0077_add_file_name_field_to_realm_emoji.py +++ b/zerver/migrations/0077_add_file_name_field_to_realm_emoji.py @@ -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): diff --git a/zproject/backends.py b/zproject/backends.py index 929f768937..65326e1db2 100644 --- a/zproject/backends.py +++ b/zproject/backends.py @@ -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: