Skip to content

Commit ea3055a

Browse files
committed
Remove lint_roller.sh script. It's served its purpose.
1 parent 0b4550e commit ea3055a

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

repo_helper/files/linting.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"lint_warn_list",
4343
"make_pylintrc",
4444
"make_lint_roller",
45+
"remove_lint_roller",
4546
"code_only_warning",
4647
]
4748

@@ -293,6 +294,22 @@ def make_pylintrc(repo_path: pathlib.Path, templates: jinja2.Environment) -> Lis
293294

294295

295296
@management.register("lint_roller")
297+
def remove_lint_roller(repo_path: pathlib.Path, templates: jinja2.Environment) -> List[str]:
298+
"""
299+
Remove the old lint_roller.sh script to the desired repo.
300+
301+
:param repo_path: Path to the repository root.
302+
:param templates:
303+
"""
304+
305+
lint_file = PathPlus(repo_path / "lint_roller.sh")
306+
if lint_file.is_file():
307+
lint_file.unlink()
308+
309+
return [lint_file.name]
310+
311+
312+
# @management.register("lint_roller")
296313
def make_lint_roller(repo_path: pathlib.Path, templates: jinja2.Environment) -> List[str]:
297314
"""
298315
Add the lint_roller.sh script to the desired repo.

tests/test_core_/test_via_run_repo_helper_forward_stdout.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ The following files will be committed:
3232
MANIFEST.in
3333
README.rst
3434
__pkginfo__.py
35-
lint_roller.sh
3635
pyproject.toml
3736
repo_helper.yml
3837
setup.cfg

tests/test_files/test_linting.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from pytest_regressions.file_regression import FileRegressionFixture
2828

2929
# this package
30-
from repo_helper.files.linting import make_lint_roller, make_pylintrc
30+
from repo_helper.files.linting import make_lint_roller, make_pylintrc, remove_lint_roller
3131
from tests.common import check_file_output
3232

3333

@@ -37,6 +37,13 @@ def test_pylintrc(tmp_pathplus, demo_environment, file_regression: FileRegressio
3737
check_file_output(tmp_pathplus / managed_files[0], file_regression)
3838

3939

40+
def test_lint_roller_removal(tmp_pathplus, demo_environment):
41+
managed_files = remove_lint_roller(tmp_pathplus, demo_environment)
42+
assert managed_files == ["lint_roller.sh"]
43+
assert not (tmp_pathplus / managed_files[0]).exists()
44+
assert not (tmp_pathplus / managed_files[0]).is_file()
45+
46+
4047
def test_lint_roller_case_1(tmp_pathplus, demo_environment, file_regression: FileRegressionFixture):
4148
managed_files = make_lint_roller(tmp_pathplus, demo_environment)
4249
assert managed_files == ["lint_roller.sh"]

0 commit comments

Comments
 (0)