From b4200ecd95b1fb599a2f5a58228a230c5ed5ece5 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Wed, 12 Apr 2023 12:00:32 -0400 Subject: [PATCH 1/3] Add `flynt` to pre-commit --- .pre-commit-config.yaml | 6 ++++++ pyproject.toml | 3 +++ 2 files changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6394b790..332f5c5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,12 @@ repos: additional_dependencies: - tomli +- repo: https://github.com/ikamensh/flynt/ + rev: '0.78' + hooks: + - id: flynt + exclude: "src/stpipe/extern/.*" + - repo: https://github.com/asottile/pyupgrade rev: 'v3.3.1' hooks: diff --git a/pyproject.toml b/pyproject.toml index 3ee4ac07..e95e3e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,6 +115,9 @@ force-exclude = ''' ) ''' +[tool.flynt] +exclude = ["src/stpipe/extern/*"] + [tool.codespell] skip="*.pdf,*.fits,*.asdf,.tox,build,./tags,.git,docs/_build" # ignore-words-list=""" From 6c9b6284c4e6d5509e3171dba78733bbbe8308f9 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Wed, 12 Apr 2023 12:01:55 -0400 Subject: [PATCH 2/3] Changes made by `flynt` --- tests/test_logger.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_logger.py b/tests/test_logger.py index a0f9c8c4..03817dc8 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -16,15 +16,13 @@ def clean_up_logging(): def test_configuration(tmpdir): logfilename = tmpdir.join("output.log") - configuration = """ + configuration = f""" [.] -handler = file:{} +handler = file:{logfilename} break_level = ERROR level = WARNING format = '%(message)s' -""".format( - logfilename - ) +""" fd = io.StringIO() fd.write(configuration) From 6b01759ddf5ada13d62ae939bfc4970546cb114c Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Wed, 12 Apr 2023 12:06:44 -0400 Subject: [PATCH 3/3] Update changes --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 35832c60..65b46e97 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,7 @@ - Add spell checking through the ``codespell`` tool. [#81] - Drop support for Python 3.8 [#93] - Remove ``stdatamodels`` dependency, as it is no longer used. [#91] +- Add ``flynt`` string update checking tool. [#92] 0.4.6 (2023-03-27) ==================