[image] felix:
apply plugin: ‘com.palantir.transforms.lang.format-code-ruff’
+1 to @A_Klapp 's point. It would be nice to configure what happens during “Alt-Shift-F”. in my experience, I found that Ruff or Black formatters mismatch what Alt-Shift-F does in major two ways:
only Alt-Shift-F d… Answer from Yurii.Mashtalir on community.palantir.com
GitHub
github.com › astral-sh › ruff-pre-commit
GitHub - astral-sh/ruff-pre-commit: A pre-commit hook for Ruff. · GitHub
A pre-commit hook for Ruff. Contribute to astral-sh/ruff-pre-commit development by creating an account on GitHub.
Starred by 1.9K users
Forked by 98 users
Languages Python
Ruff code formatter and pre-commit hooks
We are interrested to implement a code formatting and check through Ruff. Does a template or any example of Ruff setup over a code repository exist ? Does AIP assist would be able to bring some formatting rules through code sample ? Does pre-commit hooks can be implemented to ensure that a ... More on community.palantir.com
How to use Ruff?
You run it separately until you develop a set of rules you are comfortable with it enforcing, and a subset you are comfortable with it fixing. Given that any decent IDE will integrate it, I would assume it's very rare that any developer ever runs it manually. More on reddit.com
On pre-commit, black, ruff, ruff-format and everything else $linter related - openstack-discuss - lists.openstack.org
In addition to black, we also added other linters like bandit [3] and pyupgrade [4], including these in pre-commit so that they would run automatically on commit and in CI. However, as anyone reading the orange site or surveying the broader Python landscape might be aware, the ruff [5] linter ... More on lists.openstack.org
I Built a tool that auto-syncs pre-commit hook versions with `uv.lock`
You sir, are a credit to your family name and a boon to the human race. More on reddit.com
Videos
35:47
Python Tutorial: Ruff - A Fast Linter & Formatter to Replace Multiple ...
04:45
Boost Your Python Code Quality: Pre-commit Tutorial (UV & Ruff) ...
Increase Python code quality with pre-commit
04:52
How to Run a Python Script Upon Commit Using a Pre-Commit Hook ...
02:13
Precommit Hooks Are Always Bad - YouTube
YouTube
Astral
docs.astral.sh › ruff › integrations
Integrations | Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.17 hooks: # Run the linter. - id: ruff-check types_or: [ python, pyi ] args: [ --fix ] # Run the formatter.
GitHub
github.com › astral-sh › ruff-pre-commit › blob › main › README.md
ruff-pre-commit/README.md at main · astral-sh/ruff-pre-commit
A pre-commit hook for Ruff. Contribute to astral-sh/ruff-pre-commit development by creating an account on GitHub.
Author astral-sh
GitHub
github.com › charliermarsh › ruff-pre-commit › blob › main › .pre-commit-hooks.yaml
ruff-pre-commit/.pre-commit-hooks.yaml at main · astral-sh/ruff-pre-commit
entry: ruff check --force-exclude · language: python · types_or: [python, pyi, jupyter] args: [] require_serial: true · additional_dependencies: [] minimum_pre_commit_version: "2.9.2" · - id: ruff-format · name: ruff format · description: "Run 'ruff format' for extremely fast Python formatting" entry: ruff format --force-exclude ·
Author astral-sh
Jose Ricardo Zapata
joserzapata.github.io › data-science-project-template › pre-commit
⚙️ Pre-commit configuration - Data science project template
ruff: This hook runs the Ruff linter with the --fix option to automatically fix issues in scripts and notebooks and a custom configuration file. ... This repository contains a mirror of mypy for pre-commit.
GitHub
github.com › nholuongut › ruff-pre-commit
GitHub - nholuongut/ruff-pre-commit: A pre-commit hook for Ruff
repos: - repo: https://github.com/nholuongut/ruff-pre-commit.git # Ruff version. rev: v0.7.0 hooks: # Run the linter. - id: ruff # Run the formatter.
Author nholuongut
GitHub
github.com › astral-sh › ruff › blob › main › .pre-commit-config.yaml
ruff/.pre-commit-config.yaml at main · astral-sh/ruff
- repo: https://github.com/astral-sh/ruff-pre-commit · rev: v0.15.15 · hooks: - id: ruff-format · name: mdtest format · types_or: [markdown] files: '^crates/.*/resources/mdtest/.*\.md$' pass_filenames: true ·
Author astral-sh
Directed Ignorance
directedignorance.com › blog › ruff-sorting-imports-with-pre-commit
Ruff: Sorting Imports With pre-commit - Directed Ignorance
May 13, 2024 - After some searching, I found that you could sort the imports with ruff as follows [1]: ... Looks good! I’d have liked to have one command instead of two, and it would have been nice if I didn’t need to run check with a specific rule selected, but hey, this is still pretty easy to do. The only thing left was to figure out how to cajole it to a pre-commit hook.
Medium
medium.com › @gnetkov › automating-code-quality-control-with-pre-commit-hooks-fdbc1ec5cfea
Automating Code Quality Control with Pre-commit Hooks | by Fedor GNETKOV | Medium
January 1, 2025 - We have created a project with fully configured pre-commit hooks that check code quality and run tests for both the backend and frontend. This project can be used with any Python framework (Django, Flask, FastAPI) and JavaScript/TypeScript frameworks (ReactJS, VueJS, Angular, Svelte). You may need to make minor adjustments to the configuration to suit your specific needs. Additionally, you can modify and fine-tune the configurations for Ruff, MyPy, Prettier, and ESLint as you like since they offer great flexibility in customization.
Astral
docs.astral.sh › ruff › tutorial
Tutorial | Ruff
This tutorial has focused on Ruff's command-line interface, but Ruff can also be used as a pre-commit hook via ruff-pre-commit:
jmanteau
jmanteau.fr › posts › moving-to-a-new-python-tooling-stack-ruff-pre-commit
Moving to a New Python Tooling Stack: Ruff & Pre-Commit - jmanteau
November 23, 2023 - Ruff with all-in-one linting/formatting/analyzing and Pre-Commit with
GitHub
github.com › yt-dlp › yt-dlp › pull › 7409
Add `hatch`, `ruff`, `pre-commit` and dev convenience by Grub4K · Pull Request #7409 · yt-dlp/yt-dlp
IMPORTANT: PRs without the template ... PR adds ruff into the pyproject.toml and runs it in the quick-test workflow. It also adds support for hatch and some convenience scripts for developers. Additionally the linter and formatter get run before commits, using pre-commit Template Before submitting ...
Author yt-dlp
Astral
docs.astral.sh › ruff › settings
Settings | Ruff
Setting force-exclude = true will cause Ruff to respect these exclusions unequivocally. This is useful for pre-commit, which explicitly passes all changed files to the ruff-pre-commit plugin, regardless of whether they're marked as excluded by Ruff's own settings.
Reddit
reddit.com › r/learnpython › how to use ruff?
r/learnpython on Reddit: How to use Ruff?
February 11, 2026 -
I'm mainly just a hobby programmer but I'm trying to up my CI/CD game. I'm comfortable with mypy and pytest and I'm now looking to integrate ruff. Obviously I know how to launch it, but I'm confused about how its used in practice.
For example, running as:
ruff check ruff format --check
And then manually addressing objections? Or, do you just let ruff make its changes:
ruff check --fix ruff format
...or something else entirely? Thanks.
Top answer 1 of 5
3
You run it separately until you develop a set of rules you are comfortable with it enforcing, and a subset you are comfortable with it fixing. Given that any decent IDE will integrate it, I would assume it's very rare that any developer ever runs it manually.
2 of 5
2
I would just have it fail your pipelines for now. Then later on as you get comfortable with it, you can let it do its thing automatically.
Scientific Python Development
learn.scientific-python.org › development › guides › style
Style & static checks - Scientific Python Development Guide
Ruff, the powerful Rust-based linter, has a formatter that is designed with the help of some of the Black authors to look 99.9% like Black, but run 30x faster. Here is the snippet to add the formatter to your .pre-commit-config.yml (combine with the Ruff linter below):
Openstack
lists.openstack.org › archives › list › openstack-discuss@lists.openstack.org › thread › Q5M7RGCSSFHFIK3RA7MTSY4K6KKOECNE
On pre-commit, black, ruff, ruff-format and everything else $linter related - openstack-discuss - lists.openstack.org
Top tips: * Have your 'pep8' target (and any other linter-related target run 'pre-commit' rather than the linters themselves), and don't forget to remove linters from test-requirements.txt once you do (with the exception of hacking if you have custom hacking rules) * Consider using ruff and ruff-format in place of all non-hacking linters/formatters: it's seriously fast and provides rules to cover most of these.