From 5c3ad8f81ed82fc686b96df20806f664ac228136 Mon Sep 17 00:00:00 2001 From: Aristotelis Mikropoulos Date: Mon, 5 Oct 2020 21:25:35 +0300 Subject: [PATCH 1/3] Add disable/enable error code opt to config_types --- mypy/config_parser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mypy/config_parser.py b/mypy/config_parser.py index e5f769f0986b..2acfd122267b 100644 --- a/mypy/config_parser.py +++ b/mypy/config_parser.py @@ -94,6 +94,8 @@ def check_follow_imports(choice: str) -> str: 'plugins': lambda s: [p.strip() for p in s.split(',')], 'always_true': lambda s: [p.strip() for p in s.split(',')], 'always_false': lambda s: [p.strip() for p in s.split(',')], + 'disable_error_code': lambda s: [p.strip() for p in s.split(',')], + 'enable_error_code': lambda s: [p.strip() for p in s.split(',')], 'package_root': lambda s: [p.strip() for p in s.split(',')], 'cache_dir': expand_path, 'python_executable': expand_path, From 88a7ace31055908999893b9fee252e000460e342 Mon Sep 17 00:00:00 2001 From: Aristotelis Mikropoulos Date: Mon, 5 Oct 2020 21:57:51 +0300 Subject: [PATCH 2/3] Add disable error code config file test --- test-data/unit/check-flags.test | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index b58320600a11..f42701fcfce8 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1078,6 +1078,15 @@ always_true = YOLO1, YOLO always_false = BLAH, BLAH1 [builtins fixtures/bool.pyi] +[case testDisableErrorCodeConfigFile] +# flags: --config-file tmp/mypy.ini --disallow-untyped-defs +import foo +def foo(): + pass +[file mypy.ini] +\[mypy] +disable_error_code = import, no-untyped-def + [case testCheckDisallowAnyGenericsNamedTuple] # flags: --disallow-any-generics from typing import NamedTuple From c701d3a8c9696440f005a23ab620a8b6f12ce416 Mon Sep 17 00:00:00 2001 From: Aristotelis Mikropoulos Date: Mon, 5 Oct 2020 22:06:30 +0300 Subject: [PATCH 3/3] Fixed disable error code test case --- test-data/unit/check-flags.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index f42701fcfce8..286c457cc5be 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1081,7 +1081,7 @@ always_false = BLAH, BLAH1 [case testDisableErrorCodeConfigFile] # flags: --config-file tmp/mypy.ini --disallow-untyped-defs import foo -def foo(): +def bar(): pass [file mypy.ini] \[mypy]