Skip to content

Commit

Permalink
fix: only log flynt result if --flynt enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Feb 3, 2025
1 parent e1bd762 commit c45f934
Showing 1 changed file with 7 additions and 6 deletions.
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 _reformat_and_flynt_single_file( # noqa: PLR0913
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 the code re-formatter on the isorted and fstringified contents of each
# edited to-file
formatted = _maybe_reformat_single_file(
Expand Down Expand Up @@ -279,7 +274,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_reformat_single_file(
Expand Down

0 comments on commit c45f934

Please sign in to comment.