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

set regular logging level to ERROR #5957

Merged
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,3 @@ Documentation resides over at [pipenv.pypa.io](https://pipenv.pypa.io/en/latest/
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=pypa/pipenv&type=Date" />
</picture>
</a>

1 change: 1 addition & 0 deletions pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ def check(
output=output,
key=key,
quiet=quiet,
verbose=state.verbose,
exit_code=exit_code,
policy_file=policy_file,
save_json=save_json,
Expand Down
70 changes: 48 additions & 22 deletions pipenv/routines/check.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import json as simplejson
import logging
import os
import sys
import tempfile
Expand All @@ -12,6 +13,40 @@
from pipenv.vendor import click, plette


def build_options(
audit_and_monitor=True,
exit_code=True,
output="screen",
save_json="",
policy_file="",
safety_project=None,
temp_requirements_name="",
):
options = [
"--audit-and-monitor" if audit_and_monitor else "--disable-audit-and-monitor",
"--exit-code" if exit_code else "--continue-on-error",
]
formats = {"full-report": "--full-report", "minimal": "--json"}

if output in formats:
options.append(formats.get(output, ""))
elif output not in ["screen", "default"]:
options.append(f"--output={output}")

if save_json:
options.append(f"--save-json={save_json}")

if policy_file:
options.append(f"--policy-file={policy_file}")

if safety_project:
options.append(f"--project={safety_project}")

options.extend(["--file", temp_requirements_name])

return options


def do_check(
project,
python=False,
Expand All @@ -21,6 +56,7 @@ def do_check(
output="screen",
key=None,
quiet=False,
verbose=False,
exit_code=True,
policy_file="",
save_json="",
Expand All @@ -32,6 +68,9 @@ def do_check(
):
import json

if not verbose:
logging.getLogger("pipenv").setLevel(logging.WARN)

if not system:
# Ensure that virtualenv is available.
ensure_project(
Expand Down Expand Up @@ -120,27 +159,6 @@ def do_check(
else:
ignored = []

options = [
"--audit-and-monitor" if audit_and_monitor else "--disable-audit-and-monitor",
"--exit-code" if exit_code else "--continue-on-error",
]

formats = {"full-report": "--full-report", "minimal": "--json"}
if output in formats:
options.append(formats.get(output, ""))

elif output not in ["screen", "default"]:
options.append(f"--output={output}")

if save_json:
options.append(f"--save-json={save_json}")

if policy_file:
options.append(f"--policy-file={policy_file}")

if safety_project:
options.append(f"--project={safety_project}")

if use_installed:
target_venv_packages = run_command(
_cmd + ["-m", "pip", "list", "--format=freeze"],
Expand All @@ -165,7 +183,15 @@ def do_check(
temp_requirements.write(target_venv_packages.stdout.strip())
temp_requirements.close()

options.extend(["--file", temp_requirements.name])
options = build_options(
audit_and_monitor=audit_and_monitor,
exit_code=exit_code,
output=output,
save_json=save_json,
policy_file=policy_file,
safety_project=safety_project,
temp_requirements_name=temp_requirements.name,
)

cmd = _cmd + [safety_path, "check"] + options

Expand Down