Skip to content

Commit a00b6cc

Browse files
committed
Use the "ruff clean" command to clear all ruff cache dirs
1 parent 4dca320 commit a00b6cc

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

plugins/tasks.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
- setuptools >= 39.1.0
1010
"""
1111

12-
import os
1312
import pathlib
14-
import shutil
1513

1614
import invoke
1715

@@ -40,23 +38,6 @@
4038
TASK_ROOT_STR = str(TASK_ROOT)
4139

4240

43-
# shared function
44-
def rmrf(items, verbose=True):
45-
"""Silently remove a list of directories or files"""
46-
if isinstance(items, str):
47-
items = [items]
48-
49-
for item in items:
50-
if verbose:
51-
print("Removing {}".format(item))
52-
shutil.rmtree(item, ignore_errors=True)
53-
# rmtree doesn't remove bare files
54-
try:
55-
os.remove(item)
56-
except FileNotFoundError:
57-
pass
58-
59-
6041
@invoke.task(pre=[ext_test_tasks.pytest])
6142
@invoke.task()
6243
def pytest(_):
@@ -173,14 +154,3 @@ def format(context):
173154

174155

175156
namespace.add_task(format)
176-
177-
178-
@invoke.task()
179-
def ruff_clean(context):
180-
"""Remove .ruff_cache directory"""
181-
with context.cd(TASK_ROOT_STR):
182-
dirs = ['.ruff_cache']
183-
rmrf(dirs)
184-
185-
186-
namespace_clean.add_task(ruff_clean, 'ruff')

tasks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ def format(context):
371371
def ruff_clean(context):
372372
"""Remove .ruff_cache directory"""
373373
with context.cd(TASK_ROOT_STR):
374-
dirs = ['.ruff_cache']
375-
rmrf(dirs)
374+
context.run("ruff clean")
376375

377376

378377
namespace_clean.add_task(ruff_clean, 'ruff')

0 commit comments

Comments
 (0)