Skip to content

Commit b73b42f

Browse files
committed
wip
1 parent bbdc1da commit b73b42f

File tree

6 files changed

+73
-122
lines changed

6 files changed

+73
-122
lines changed

mypy/build.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ def save_baseline(manager: BuildManager):
10911091
file.parent.mkdir(parents=True)
10921092
data: BaselineType = {
10931093
"files": new_baseline,
1094-
"format": "1.7",
1094+
"format": "2.6",
10951095
"targets": manager.options._targets,
10961096
}
10971097
with file.open("w") as f:
@@ -1159,7 +1159,7 @@ def error(msg: str | None = None) -> bool:
11591159

11601160
if baseline_format is None and error():
11611161
return
1162-
elif baseline_format != "1.7":
1162+
elif baseline_format != "2.6":
11631163
if not options.write_baseline:
11641164
error(
11651165
f"error: Baseline file '{file}' was generated with an old version of basedmypy.\n"

mypy/errors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ def remove_duplicates(errors: list[ErrorInfo]) -> list[ErrorInfo]:
13891389
return unduplicated_result
13901390

13911391
allowed = self.options.baseline_allows
1392-
banned = self.options.baseline_allows
1392+
banned = self.options.baseline_bans
13931393
rejected = []
13941394
error_list = []
13951395

@@ -1404,7 +1404,7 @@ def yes_no(condition: bool) -> bool:
14041404
if allowed:
14051405
return yes_no(error.code in allowed)
14061406
if banned:
1407-
return yes_no(error.code in banned)
1407+
return yes_no(error.code not in banned)
14081408
return yes_no(True)
14091409

14101410
result = {

mypy/main.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import time
1010
from collections import defaultdict
1111
from gettext import gettext
12+
from operator import itemgetter
1213
from typing import IO, Any, Final, NoReturn, Sequence, TextIO
1314

1415
import mypy.options
@@ -134,8 +135,8 @@ def main(
134135
all_errors[error.code.code] += 1
135136
if all_errors:
136137
max_code_name_length = max(len(code_name) for code_name in all_errors)
137-
for code_name, count in all_errors.items():
138-
stdout.write(f" {code_name:<{max_code_name_length}} {count:>5}\n")
138+
for error_code, count in sorted(all_errors.items(), key=itemgetter(1)):
139+
stdout.write(f" {error_code:<{max_code_name_length}} {count:>5}\n")
139140
if options.write_baseline and res:
140141
n_files = len(res.manager.errors.all_errors)
141142
stats = res.manager.errors.baseline_stats
@@ -144,7 +145,8 @@ def main(
144145
new_errors = n_errors - rejected
145146
previous = res.manager.errors.original_baseline
146147
stdout.write(formatter.style("baseline:\n", color="none", bold=True))
147-
stdout.write(f" {new_errors} new error{plural_s(new_errors)}\n")
148+
if new_errors >= 0:
149+
stdout.write(f" {new_errors} new error{plural_s(new_errors)}\n")
148150
stdout.write(f" {total} error{plural_s(total)} in baseline\n")
149151
difference = (
150152
len(
@@ -653,7 +655,7 @@ def add_invertible_flag(
653655
)
654656
add_invertible_flag(
655657
"--no-summary",
656-
default=False,
658+
default=True,
657659
help="don't show an error code summary at the end",
658660
group=based_group,
659661
)

mypy/test/testcmdline.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_python_cmdline(testcase: DataDrivenTestCase, step: int) -> None:
6565
if "# dont-normalize-output:" in testcase.input:
6666
testcase.normalize_output = False
6767
args.append("--show-traceback")
68+
args.append("--no-summary")
6869
based = "based" in testcase.parent.name
6970
if not based:
7071
args.append("--no-strict")
@@ -116,7 +117,7 @@ def test_python_cmdline(testcase: DataDrivenTestCase, step: int) -> None:
116117
# Remove temp file.
117118
os.remove(program_path)
118119
# Compare actual output to expected.
119-
if testcase.output_files:
120+
if testcase.output_files and False:
120121
assert not testcase.output, "output not checked when outfile supplied"
121122
# Ignore stdout, but we insist on empty stderr and zero status.
122123
if err or result:
@@ -126,6 +127,8 @@ def test_python_cmdline(testcase: DataDrivenTestCase, step: int) -> None:
126127
)
127128
check_test_output_files(testcase, step)
128129
else:
130+
if testcase.output_files:
131+
check_test_output_files(testcase, step)
129132
if testcase.normalize_output:
130133
out = normalize_error_messages(err + out)
131134
obvious_result = 1 if out else 0

0 commit comments

Comments
 (0)