<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>barabane</title><generator>teletype.in</generator><description><![CDATA[&quot;Код — это диалог между человеком и машиной, в котором важно найти общий язык.&quot;
— ChatGPT]]></description><link>https://teletype.in/@barabane1?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=barabane1</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/barabane1?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/barabane1?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Wed, 24 Jun 2026 03:23:18 GMT</pubDate><lastBuildDate>Wed, 24 Jun 2026 03:23:18 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@barabane1/ruff</guid><link>https://teletype.in/@barabane1/ruff?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=barabane1</link><comments>https://teletype.in/@barabane1/ruff?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=barabane1#comments</comments><dc:creator>barabane1</dc:creator><title>Ruff 🐶🐡</title><pubDate>Wed, 25 Dec 2024 18:45:39 GMT</pubDate><media:content medium="image" url="https://img4.teletype.in/files/7f/be/7fbe44eb-8a4f-41bf-849e-1a37feaf0798.png"></media:content><category>Разработка</category><description><![CDATA[<img src="https://img2.teletype.in/files/97/a9/97a9042d-8723-46b8-bbc2-085fa07a30af.png"></img>Ruff 🐶🐡]]></description><content:encoded><![CDATA[
  <figure id="0MjC" class="m_column">
    <img src="https://img2.teletype.in/files/97/a9/97a9042d-8723-46b8-bbc2-085fa07a30af.png" width="1280" />
  </figure>
  <p id="TP8W">В очередной раз добавляя в проект <strong>Flake</strong>, <strong>isort</strong> и <strong>Black</strong>, я подумал<em> &quot;Эх вот был бы такой инструмент который объединяет в себе все эти линтеры и форматеры, работает в связке с <strong>pre-commit</strong>, и еще чтобы все настройки были в одном файле&quot;</em>. Оказывается такой инструмент есть и называется он <a href="https://docs.astral.sh/ruff/" target="_blank">Ruff</a> (что в переводе - Ёрш(???) 🤔)</p>
  <p id="2wQO"><strong>Ruff </strong>- это линтер + форматер для Python написанный на <strong>Rust</strong>. Он объединяет в себе все вышеуказанные инструменты и для его настройки нужен всего 1 файл(ruff.toml или pyproject.toml, кому как удобнее)</p>
  <p id="BrAr">Для того, чтобы использовать <strong>Ruff </strong>достаточно знать 2 команды:</p>
  <pre id="N8UR">ruff format - запускает форматер 
ruff check - запускает линтер (если запустить с флагом --fix сразу исправит все ошибки)</pre>
  <p id="uOQ5">А вот так его можно запускать в <strong>pre-commit</strong>:</p>
  <pre id="xEIk" data-lang="bash">repos:
  - repo: local
    hooks:
      - id: ruff-check
        name: Ruff Check with Fix
        entry: ruff check --fix
        language: python
        types: [python]
        additional_dependencies: [ruff]
      - id: ruff-format
        name: Ruff Format
        entry: ruff format
        language: python
        types: [python]
        additional_dependencies: [ruff]
</pre>
  <p id="QaPW">Ниже оставил конфигурацию моего ruff.toml, который я использую в каждом проекте:</p>
  <pre id="QaPW" data-lang="bash">exclude = [
    &quot;.bzr&quot;,
    &quot;.direnv&quot;,
    &quot;.eggs&quot;,
    &quot;.git&quot;,
    &quot;.hg&quot;,
    &quot;.mypy_cache&quot;,
    &quot;.nox&quot;,
    &quot;.pants.d&quot;,
    &quot;.ruff_cache&quot;,
    &quot;.svn&quot;,
    &quot;.tox&quot;,
    &quot;.venv&quot;,
    &quot;__pypackages__&quot;,
    &quot;_build&quot;,
    &quot;buck-out&quot;,
    &quot;build&quot;,
    &quot;dist&quot;,
    &quot;node_modules&quot;,
    &quot;venv&quot;,
    &quot;env.py&quot;
]
target-version = &quot;py312&quot;

[lint]
select = [
    &quot;I&quot;,
    &quot;F&quot;,
    &quot;E&quot;,
    &quot;W&quot;,
    &quot;I001&quot;,
    &quot;T201&quot;
]

[format]
quote-style = &quot;single&quot;</pre>

]]></content:encoded></item></channel></rss>