0
1

PythonのLinterであるRuffの使い方を雑にメモしていく。

Last updated at Posted at 2024-07-11

インストール

pip install ruff

設定方法

自分はryeを使っているのでpyproject.tomlで以下のように書き込んでいく。
上のリンクにもあるようにruff.tomlも使える。

[tool.ruff.lint]
select = [
    # pycodestyle
    "E",
    # Pyflakes
    "F",
    # pyupgrade
    "UP",
    # flake8-bugbear
    "B",
    # flake8-simplify
    "SIM",
    # isort
    "I",
]

使えるルール

以上のとおり。

VSCodeでの設定方法

image.png

拡張機能の設定で以下の箇所を設定するだけ。

image.png

チェック

ruff check hogehoge.py
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1