Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App_check_warn #63

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/nbmetaclean/app_check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse

from .check import check_nb_ec, check_nb_errors
from .check import check_nb_ec, check_nb_errors, check_nb_warnings
from .helpers import get_nb_names_from_list, read_nb

parser = argparse.ArgumentParser(
Expand All @@ -23,6 +23,11 @@
action="store_true",
help="Check errors in outputs.",
)
parser.add_argument(
"--warn",
action="store_true",
help="Check warnings in outputs.",
)
parser.add_argument(
"--not_strict",
action="store_true",
Expand Down Expand Up @@ -73,15 +78,26 @@ def app_check() -> None:
print("- ", nb)

if cfg.err:
wrong_err = []
nb_errors = []
for nb in nb_files:
result = check_nb_errors(read_nb(nb))
if not result:
wrong_err.append(nb)
nb_errors.append(nb)

if nb_errors:
print(f"{len(nb_errors)} notebooks with some errors in outputs:")
for nb in nb_errors:
print("- ", nb)
if cfg.warn:
nb_warnings = []
for nb in nb_files:
result = check_nb_warnings(read_nb(nb))
if not result:
nb_warnings.append(nb)

if wrong_err:
print(f"{len(wrong_err)} notebooks with some errors in outputs:")
for nb in wrong_err:
if nb_warnings:
print(f"{len(nb_warnings)} notebooks with some warnings in outputs:")
for nb in nb_warnings:
print("- ", nb)


Expand Down