diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ebfffb40e3..8e983a20c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -203,9 +203,13 @@ repos: - types-requests args: - --python-version=3.13 - - --txt-report=.tox/.tmp/.test-results/mypy--py-3.13 + - --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.13 - --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.13 - --html-report=.tox/.tmp/.test-results/mypy--py-3.13 + - --linecount-report=.tox/.tmp/.test-results/mypy--py-3.13 + - --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.13 + - --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.13 + - --txt-report=.tox/.tmp/.test-results/mypy--py-3.13 pass_filenames: false - id: mypy alias: mypy-py312 @@ -229,9 +233,13 @@ repos: - types-requests args: - --python-version=3.12 - - --txt-report=.tox/.tmp/.test-results/mypy--py-3.12 + - --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.12 - --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.12 - --html-report=.tox/.tmp/.test-results/mypy--py-3.12 + - --linecount-report=.tox/.tmp/.test-results/mypy--py-3.12 + - --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.12 + - --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.12 + - --txt-report=.tox/.tmp/.test-results/mypy--py-3.12 pass_filenames: false - id: mypy alias: mypy-py311 @@ -255,9 +263,13 @@ repos: - types-requests args: - --python-version=3.11 - - --txt-report=.tox/.tmp/.test-results/mypy--py-3.11 + - --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.11 - --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.11 - --html-report=.tox/.tmp/.test-results/mypy--py-3.11 + - --linecount-report=.tox/.tmp/.test-results/mypy--py-3.11 + - --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.11 + - --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.11 + - --txt-report=.tox/.tmp/.test-results/mypy--py-3.11 pass_filenames: false - repo: https://github.com/PyCQA/pylint.git diff --git a/tox.ini b/tox.ini index b9c455d8f6..712c2d2e0b 100644 --- a/tox.ini +++ b/tox.ini @@ -245,6 +245,33 @@ commands_post = ); \ print("codecov-flags=MyPy", file=gh_output_fd); \ gh_output_fd.close()' + {envpython} \ + {[python-cli-options]byte-errors} \ + {[python-cli-options]max-isolation} \ + {[python-cli-options]warnings-to-errors} \ + -c \ + 'import itertools, os, pathlib, shlex, sys; \ + os.getenv("GITHUB_ACTIONS") == "true" or sys.exit(); \ + test_results_dir = pathlib.Path(r"{temp_dir}") / ".test-results"; \ + text_and_json_reports = itertools.chain( \ + test_results_dir.glob("mypy--py-*{/}*.json"), \ + test_results_dir.glob("mypy--py-*{/}*.txt"), \ + ); \ + report_contents = { \ + report{:} report.read_text() \ + for report in text_and_json_reports \ + }; \ + reports_summary_text_blob = "\n\n".join( \ + f"\N\{NUMBER SIGN\}\N\{NUMBER SIGN\} {report_path.parent.name}{:} " \ + f"`{report_path.name}`\n\n" \ + f"```{report_path.suffix[1:]}\n{report_text}\n```\n" \ + for report_path, report_text in report_contents.items() \ + ); \ + gh_summary_fd = open( \ + os.environ["GITHUB_STEP_SUMMARY"], encoding="utf-8", mode="a", \ + ); \ + print(reports_summary_text_blob, file=gh_summary_fd); \ + gh_summary_fd.close()' # Print out the output coverage dir and a way to serve html: {envpython} \ {[python-cli-options]byte-errors} \ @@ -273,6 +300,9 @@ commands_post = print(\ f"\nTo open the HTML coverage reports, run\n\n\ \t\{coverage_html_report_open_cmds_blob !s\}\n"\ + ); \ + print(\ + f"[*] Find rest of JSON and text reports, are in the same directories."\ )\ ' \ {posargs:--all-files}