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

WIP: Improve logging output in Chasten #100

Closed
wants to merge 5 commits into from
Closed
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
14 changes: 14 additions & 0 deletions chasten/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,17 @@ def analyze( # noqa: PLR0913, PLR0915
save: bool = typer.Option(False, help="Enable saving of output file(s)."),
) -> None:
"""💫 Analyze the AST of Python source code."""
# add name of project
output.logger.debug(f"Analyze the AST of project {project} ")
# add logger for debug
output.setup(debug_level, debug_destination)
output.logger.debug(f"Display verbose output? {verbose}")
output.logger.debug(f"Debug level? {debug_level.value}")
output.logger.debug(f"Debug destination? {debug_destination.value}")
# add logger for path
output.logger.debug(f"Input path {input_path}")
output.logger.debug(f"Save file in {output_directory}")
output.logger.debug(f"Config path: {config}")
# output the preamble, including extra parameters specific to this function
output_preamble(
verbose,
Expand All @@ -451,6 +462,7 @@ def analyze( # noqa: PLR0913, PLR0915
)
# extract the current version of the program
chasten_version = util.get_chasten_version()
output.logger.debug(f"Current version of chasten: {chasten_version}")
# create the include and exclude criteria
include = results.CheckCriterion(
attribute=str(checks.fix_check_criterion(check_include[0])),
Expand Down Expand Up @@ -482,6 +494,7 @@ def analyze( # noqa: PLR0913, PLR0915
(validated, checks_dict) = validate_configuration_files(config, verbose)
# some aspect of the configuration was not
# valid, so exit early and signal an error

if not validated:
output.console.print(
"\n:person_shrugging: Cannot perform analysis due to configuration error(s).\n"
Expand Down Expand Up @@ -534,6 +547,7 @@ def analyze( # noqa: PLR0913, PLR0915
# that attribute does not exist inside of the current_check; importantly,
# having a count or a min or a max is all optional in a checks file
(min_count, max_count) = checks.extract_min_max(current_check)
output.logger.debug(f"{min_count},{max_count}")
# extract details about the check to display in the header
# of the syntax box for this specific check
check_id = current_check[constants.checks.Check_Id] # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion scripts/extract_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
filename = "chasten/util.py"
covered_lines = set(data.lines(filename)) # type: ignore

print(f"Covered lines in {filename}:") # noqa
print(f"Covered lines in {filename}:") # noqa
print(covered_lines) # noqa