Skip to content

Commit 93cd13e

Browse files
Enforce --write-changes in interactive mode
Co-authored-by: Dimitri Papadopoulos <[email protected]>
1 parent a28e3c7 commit 93cd13e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

codespell_lib/_codespell.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,9 @@ def main(*args: str) -> int:
11261126
for ifile, cfg_file in enumerate(used_cfg_files, start=1):
11271127
print(f" {ifile}: {cfg_file}")
11281128

1129+
if options.interactive > 0:
1130+
options.write_changes = True
1131+
11291132
if options.regex and options.write_changes:
11301133
return _usage_error(
11311134
parser,

codespell_lib/tests/test_basic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ def test_interactivity(
243243
cs.main("-i", "-1", fname)
244244
assert e.type is SystemExit
245245
assert e.value.code != 0
246-
with FakeStdin("y\n"):
247-
assert cs.main("-i", "3", fname) == 1
248246
with FakeStdin("n\n"):
249247
result = cs.main("-w", "-i", "3", fname, std=True)
250248
assert isinstance(result, tuple)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ max-complexity = 45
169169
[tool.ruff.lint.pylint]
170170
allow-magic-value-types = ["bytes", "int", "str",]
171171
max-args = 13
172-
max-branches = 47
172+
max-branches = 48
173173
max-returns = 12
174174
max-statements = 119

0 commit comments

Comments
 (0)