Skip to content

Commit 7aa5f77

Browse files
authored
Merge pull request #760 from akaihola/flynt-log
Only log flynt result if --flynt enabled
2 parents e1bd762 + 113467c commit 7aa5f77

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Internal
5858
- No need to use `typing.Pattern` instead of `re.Pattern` in Python 3.9+.
5959
- Always use newest artifact upload/download actions from the v4 series in the CI build.
6060
- Use `datetime.datetime.now()`, not ``.utcnow()`` to silence a deprecation warning.
61+
- Suppress logging about Flynt unless Flynt is enabled.
6162

6263

6364
2.1.1_ - 2024-04-16

src/darker/__main__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,6 @@ def _reformat_and_flynt_single_file( # noqa: PLR0913
209209
relative_path_in_rev2, exclude.flynt, edited_linenums_differ, rev2_isorted
210210
)
211211
has_fstring_changes = fstringified != rev2_isorted
212-
logger.debug(
213-
"Flynt resulted in %s lines, with %s changes from fstringification",
214-
len(fstringified.lines),
215-
"some" if has_fstring_changes else "no",
216-
)
217212
# 3. run the code re-formatter on the isorted and fstringified contents of each
218213
# edited to-file
219214
formatted = _maybe_reformat_single_file(
@@ -279,7 +274,13 @@ def _maybe_flynt_single_file(
279274
if glob_any(relpath_in_rev2, exclude):
280275
# `--flynt` option not specified, don't reformat
281276
return rev2_isorted
282-
return apply_flynt(rev2_isorted, relpath_in_rev2, edited_linenums_differ)
277+
result = apply_flynt(rev2_isorted, relpath_in_rev2, edited_linenums_differ)
278+
logger.debug(
279+
"Flynt resulted in %s lines, with %s changes from fstringification",
280+
len(result.lines),
281+
"some" if result != rev2_isorted else "no",
282+
)
283+
return result
283284

284285

285286
def _maybe_reformat_single_file(

0 commit comments

Comments
 (0)