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

Only log flynt result if --flynt enabled #760

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 7 additions & 6 deletions src/darker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ def _blacken_and_flynt_single_file(
relative_path_in_rev2, exclude.flynt, edited_linenums_differ, rev2_isorted
)
has_fstring_changes = fstringified != rev2_isorted
logger.debug(
"Flynt resulted in %s lines, with %s changes from fstringification",
len(fstringified.lines),
"some" if has_fstring_changes else "no",
)
# 3. run black on the isorted and fstringified contents of each edited to-file
formatted = _maybe_blacken_single_file(
relative_path_in_rev2, exclude.black, fstringified, black_config
Expand Down Expand Up @@ -267,7 +262,13 @@ def _maybe_flynt_single_file(
if glob_any(relpath_in_rev2, exclude):
# `--flynt` option not specified, don't reformat
return rev2_isorted
return apply_flynt(rev2_isorted, relpath_in_rev2, edited_linenums_differ)
result = apply_flynt(rev2_isorted, relpath_in_rev2, edited_linenums_differ)
logger.debug(
"Flynt resulted in %s lines, with %s changes from fstringification",
len(result.lines),
"some" if result != rev2_isorted else "no",
)
return result


def _maybe_blacken_single_file(
Expand Down
Loading