Switch to using ruff in my pyfmt script
- ID
bceac54- date
2024-06-02 09:06:41+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
5c804c4- message
Switch to using `ruff` in my `pyfmt` script For https://github.com/alexwlchan/alexwlchan/issues/9- changed files
1 file, 2 additions, 31 deletions
Changed files
fish_functions/pyfmt.fish (1094) → fish_functions/pyfmt.fish (219)
diff --git a/fish_functions/pyfmt.fish b/fish_functions/pyfmt.fish
index 8e243e5..ac7746b 100644
--- a/fish_functions/pyfmt.fish
+++ b/fish_functions/pyfmt.fish
@@ -1,24 +1,3 @@
-# Run some basic Python formatting over a directory.
-#
-# This uses black and flake8; if they're not available in the current
-# virtualenv, it will fall back to copies in the scripts repo.
-
-function _run_black
- if which black >/dev/null
- black $argv
- else
- ~/repos/scripts/.venv/bin/black $argv
- end
-end
-
-function _run_flake8
- if which flake8 >/dev/null
- flake8 $argv
- else
- ~/repos/scripts/.venv/bin/flake8 $argv
- end
-end
-
function pyfmt --description "Run Python formatting over a directory"
if test (count $argv) -eq 0
set root $PWD
@@ -26,14 +5,6 @@ function pyfmt --description "Run Python formatting over a directory"
set root $argv[1]
end
- _run_black "$root"
-
- # E501 = line too long; anything up to 100-ish is fine in my book
- # (the "ish" is intentional; see https://www.youtube.com/watch?v=wf-BqAjZb8M)
- #
- # E203/W503/W504 = this is where black and flake8 conflict, see https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated
- _run_flake8 \
- --ignore=E501,E203,W503 --extend-select=W504 \
- --exclude .venv \
- "$root"
+ ruff check "$root"
+ ruff format "$root"
end