• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created about 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A pre-commit hook for Ruff.

ruff-pre-commit

Ruff image image image Actions status

A pre-commit hook for Ruff.

Distributed as a standalone repository to enable installing Ruff via prebuilt wheels from PyPI.

Using Ruff with pre-commit

Add this to your .pre-commit-config.yaml:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.292
  hooks:
    - id: ruff

Or, to enable autofix:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.292
  hooks:
    - id: ruff
      args: [--fix, --exit-non-zero-on-fix]

To run the hook on Jupyter Notebooks too:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.292
  hooks:
    - id: ruff
      types_or: [python, pyi, jupyter]

Ruff's pre-commit hook should be placed after other formatting tools, such as Black and isort, unless you enable autofix, in which case, Ruff's pre-commit hook should run before Black, isort, and other formatting tools, as Ruff's autofix behavior can output code changes that require reformatting.

Using Ruff's formatter (unstable)

Ruff's formatter is in Alpha, but can used with pre-commit by adding the ruff-format hook:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.292
  hooks:
    - id: ruff-format

To check formatting without changing files, use --check:

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.0.292
  hooks:
    - id: ruff-format
      args: [--check]

Note v0.0.290 is the minimum version that provides the ruff-format hook.

License

MIT

More Repositories

1

ruff

An extremely fast Python linter, written in Rust.
Rust
15,164
star
2

ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
TypeScript
405
star
3

whisper.cpp-cli

Packages whisper.cpp into pre-built, pip-installable wheels, for macOS and Linux.
Python
157
star
4

ruff-lsp

A Language Server Protocol implementation for Ruff.
Python
142
star
5

script

JavaScript implementation of Script, Bitcoin's scripting language.
JavaScript
118
star
6

semantic

A Python library for extracting semantic information from text, such as dates and numbers.
Python
74
star
7

autobot

GitHub Copilot, for your existing codebase.
Python
71
star
8

point-location

Kirkpatrick's Algorithm for Log(n) point location in planar subdivisions.
Python
68
star
9

online_boosting

A suite of boosting algorithms for the online learning setting.
Python
61
star
10

java-ml

Java implementations of several Machine Learning classification algorithms.
Java
54
star
11

trellis

Write Dockerfiles and CI pipelines in TypeScript.
TypeScript
35
star
12

android-lite

A 26 KB-take on the Khan Android app.
Java
23
star
13

OCaml-SAT-Solvers

An OCaml implementation of the DPLL algorithm for solving SAT instances. Uses nothing beyond the OCaml List library.
OCaml
18
star
14

altcoin-analysis

Quantitative analysis of altcoins, or "Bitcoin alternatives."
Python
10
star
15

ocaml-futures

True OCaml futures using UNIX processes and pipes.
OCaml
9
star
16

graph-matching

An implementation of the 'Matching with our Eyes Closed' algorithm for generating a randomized matching for a non-bipartite graph in an online manner.
Python
7
star
17

es6-npm-boilerplate

Boilerplate for authoring in ES6 and publishing in ES5.
JavaScript
6
star
18

mongoose-proptypes

Generate React PropTypes for your Mongoose schema.
JavaScript
6
star
19

notes

LaTeX notes from a variety of Princeton Computer Science courses.
TeX
4
star
20

charliermarsh

4
star
21

ruff-action

GitHub Action for Ruff
3
star
22

valid-media-queries

Validates CSS media queries.
JavaScript
3
star
23

sweet-rcss

A quick experiment in sweeting your JavaScript for use with RCSS.
JavaScript
1
star
24

pycon-us-2024

1
star
25

iOS-Elements

Some iOS modules and UI elements pulled together over various projects.
Objective-C
1
star