@@ -257,6 +257,38 @@ def pycache_clean(context):
257257
258258namespace_clean .add_task (pycache_clean , 'pycache' )
259259
260+
261+ # ruff fast linter
262+ @invoke .task ()
263+ def lint (context ):
264+ """Run ruff fast linter"""
265+ with context .cd (TASK_ROOT_STR ):
266+ context .run ("ruff check" )
267+
268+
269+ namespace .add_task (lint )
270+
271+
272+ # ruff fast formatter
273+ @invoke .task ()
274+ def format (context ):
275+ """Run ruff format --check"""
276+ with context .cd (TASK_ROOT_STR ):
277+ context .run ("ruff format --check" )
278+
279+
280+ namespace .add_task (format )
281+
282+
283+ @invoke .task ()
284+ def ruff_clean (context ):
285+ """Remove .ruff_cache directory"""
286+ with context .cd (TASK_ROOT_STR ):
287+ context .run ("ruff clean" )
288+
289+
290+ namespace_clean .add_task (ruff_clean , 'ruff' )
291+
260292#
261293# make a dummy clean task which runs all the tasks in the clean namespace
262294clean_tasks = list (namespace_clean .tasks .values ())
@@ -343,35 +375,3 @@ def pypi_test(context):
343375
344376
345377namespace .add_task (pypi_test )
346-
347-
348- # ruff fast linter
349- @invoke .task ()
350- def lint (context ):
351- """Run ruff fast linter"""
352- with context .cd (TASK_ROOT_STR ):
353- context .run ("ruff check" )
354-
355-
356- namespace .add_task (lint )
357-
358-
359- # ruff fast formatter
360- @invoke .task ()
361- def format (context ):
362- """Run ruff format --check"""
363- with context .cd (TASK_ROOT_STR ):
364- context .run ("ruff format --check" )
365-
366-
367- namespace .add_task (format )
368-
369-
370- @invoke .task ()
371- def ruff_clean (context ):
372- """Remove .ruff_cache directory"""
373- with context .cd (TASK_ROOT_STR ):
374- context .run ("ruff clean" )
375-
376-
377- namespace_clean .add_task (ruff_clean , 'ruff' )
0 commit comments