From 0b0d6e8f3dbc6d6c487686a16933bec746511b3d Mon Sep 17 00:00:00 2001 From: ktro2828 Date: Fri, 14 Nov 2025 12:59:18 +0900 Subject: [PATCH 1/3] refactor: remove include_warning option Signed-off-by: ktro2828 --- docs/cli/t4sanity.md | 1 - t4_devkit/cli/sanity.py | 10 +--------- t4_devkit/sanity/run.py | 17 ++++------------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/docs/cli/t4sanity.md b/docs/cli/t4sanity.md index fe074c9..09dd8d8 100644 --- a/docs/cli/t4sanity.md +++ b/docs/cli/t4sanity.md @@ -13,7 +13,6 @@ $ t4sanity -h │ --output -o TEXT Path to output JSON file. [default: None] │ │ --revision -rv TEXT Specify if you want to check the specific version. [default: None] │ │ --exclude -e TEXT Exclude specific rules or rule groups. [default: None] │ -│ --include-warning -iw Indicates whether to report any warnings. │ │ --strict -s Indicates whether warnings are treated as failures. │ │ --install-completion Install completion for the current shell. │ │ --show-completion Show completion for the current shell, to copy it or customize the installation. │ diff --git a/t4_devkit/cli/sanity.py b/t4_devkit/cli/sanity.py index facdcd2..036b852 100644 --- a/t4_devkit/cli/sanity.py +++ b/t4_devkit/cli/sanity.py @@ -36,19 +36,11 @@ def main( excludes: list[str] | None = typer.Option( None, "-e", "--exclude", help="Exclude specific rules or rule groups." ), - include_warning: bool = typer.Option( - False, "-iw", "--include-warning", help="Indicates whether to report any warnings." - ), strict: bool = typer.Option( False, "-s", "--strict", help="Indicates whether warnings are treated as failures." ), ) -> None: - result = sanity_check( - data_root=data_root, - revision=revision, - excludes=excludes, - include_warning=include_warning, - ) + result = sanity_check(data_root=data_root, revision=revision, excludes=excludes) print_sanity_result(result, strict=strict) diff --git a/t4_devkit/sanity/run.py b/t4_devkit/sanity/run.py index cd62ab9..ae91431 100644 --- a/t4_devkit/sanity/run.py +++ b/t4_devkit/sanity/run.py @@ -1,6 +1,5 @@ from __future__ import annotations -import warnings from typing import Sequence from .context import SanityContext @@ -14,7 +13,6 @@ def sanity_check( data_root: str, revision: str | None = None, *, - include_warning: bool = False, excludes: Sequence[str] | None = None, ) -> SanityResult: """Run sanity checks on the given data root. @@ -22,21 +20,14 @@ def sanity_check( Args: data_root (str): The root directory of the data. revision (str | None, optional): The revision to check. If None, the latest revision is used. - include_warning (bool, optional): Whether to include warning checks. excludes (Sequence[str] | None, optional): A list of rule names or groups to exclude. Returns: A SanityResult object. """ - with warnings.catch_warnings(): - if include_warning: - warnings.simplefilter("error") - else: - warnings.simplefilter("ignore") + context = SanityContext.from_path(data_root, revision=revision) - context = SanityContext.from_path(data_root, revision=revision) + checkers = CHECKERS.build(excludes=excludes) + reports = [checker(context) for checker in checkers] - checkers = CHECKERS.build(excludes=excludes) - reports = [checker(context) for checker in checkers] - - return SanityResult.from_context(context, reports) + return SanityResult.from_context(context, reports) From 8d9534c6862f4b5acbece323190d1c275e5af9de Mon Sep 17 00:00:00 2001 From: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Date: Fri, 14 Nov 2025 13:00:38 +0900 Subject: [PATCH 2/3] Update t4_devkit/cli/sanity.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- t4_devkit/cli/sanity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t4_devkit/cli/sanity.py b/t4_devkit/cli/sanity.py index 036b852..555655b 100644 --- a/t4_devkit/cli/sanity.py +++ b/t4_devkit/cli/sanity.py @@ -37,7 +37,7 @@ def main( None, "-e", "--exclude", help="Exclude specific rules or rule groups." ), strict: bool = typer.Option( - False, "-s", "--strict", help="Indicates whether warnings are treated as failures." + False, "-s", "--strict", help="By default, warnings do not cause failure. If set, warnings are treated as failures." ), ) -> None: result = sanity_check(data_root=data_root, revision=revision, excludes=excludes) From 5e154e4c766680bf4fccf44591e754e02d123552 Mon Sep 17 00:00:00 2001 From: ktro2828 <60615504+ktro2828@users.noreply.github.com> Date: Fri, 14 Nov 2025 04:01:37 +0000 Subject: [PATCH 3/3] style(pre-commit): autofix --- t4_devkit/cli/sanity.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t4_devkit/cli/sanity.py b/t4_devkit/cli/sanity.py index 555655b..6c5ed79 100644 --- a/t4_devkit/cli/sanity.py +++ b/t4_devkit/cli/sanity.py @@ -37,7 +37,10 @@ def main( None, "-e", "--exclude", help="Exclude specific rules or rule groups." ), strict: bool = typer.Option( - False, "-s", "--strict", help="By default, warnings do not cause failure. If set, warnings are treated as failures." + False, + "-s", + "--strict", + help="By default, warnings do not cause failure. If set, warnings are treated as failures.", ), ) -> None: result = sanity_check(data_root=data_root, revision=revision, excludes=excludes)