Commit Graph

317 Commits

Author SHA1 Message Date
renovate[bot] 3fd22973da
Update pre-commit dependencies (#10822) 2024-04-08 21:31:38 +01:00
renovate[bot] 388658efdb
Update pre-commit dependencies (#10698)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-04-06 23:00:41 +00:00
Charlie Marsh 8118d29419
Rename `ruff_cli` crate to `ruff` (#9557)
## Summary

Long ago, we had a single `ruff` crate. We started to break that up, and
at some point, we wanted to separate the CLI from the core library. So
we created `ruff_cli`, which created a `ruff` binary. Later, the `ruff`
crate was renamed to `ruff_linter` and further broken up into additional
crates.

(This is all from memory -- I didn't bother to look through the history
to ensure that this is 100% correct :))

Now that `ruff` no longer exists, this PR renames `ruff_cli` to `ruff`.
The primary benefit is that the binary target and the crate name are now
the same, which helps with downstream tooling like `cargo-dist`, and
also removes some complexity from the crate and `Cargo.toml` itself.

## Test Plan

- Ran `rm -rf target/release`.
- Ran `cargo build --release`.
- Verified that `./target/release/ruff` was created.
2024-01-16 17:47:01 -05:00
Zanie Blue 5b3e922050
Upgrade pre-commit dependencies (#8518) 2023-11-06 10:08:22 -06:00
trag1c 1672a3d3b7
Added tabs for configuration files in the documentation (#8480)
## Summary

Closes #8384.

## Test Plan

Checked whether it renders properly on the `mkdocs serve` preview.
2023-11-05 17:10:29 +00:00
Zanie Blue 29573daef5
Use production builds of Ruff for pre-commit (#8410)
Requiring `cargo build` per commit is way too slow. Instead, we use the
production Ruff version. Additionally, Black is replaced with the Ruff
formatter.
2023-11-01 16:33:09 -05:00
Charlie Marsh f6d6200aae
Rework the documentation to incorporate the Ruff formatter (#7732)
## Summary

This PR updates our documentation for the upcoming formatter release.

Broadly, the documentation is now structured as follows:

- Overview
- Tutorial
- Installing Ruff
- The Ruff Linter
    - Overview
    - `ruff check`
    - Rule selection
    - Error suppression
    - Exit codes
- The Ruff Formatter
    - Overview
    - `ruff format`
    - Philosophy
    - Configuration
    - Format suppression
    - Exit codes
    - Black compatibility
        - Known deviations
- Configuring Ruff
    - pyproject.toml
    - File discovery
    - Configuration discovery
    - CLI
    - Shell autocompletion
- Preview
- Rules
- Settings
- Integrations
    - `pre-commit`
    - VS Code
    - LSP
    - PyCharm
    - GitHub Actions
- FAQ
- Contributing

The major changes include:

- Removing the "Usage" section from the docs, and instead folding that
information into "Integrations" and the new Linter and Formatter
sections.
- Breaking up "Configuration" into "Configuring Ruff" (for generic
configuration), and new Linter- and Formatter-specific sections.
- Updating all example configurations to use `[tool.ruff.lint]` and
`[tool.ruff.format]`.

My suggestion is to pull and build the docs locally, and review by
reading them in the browser rather than trying to parse all the code
changes.

Closes https://github.com/astral-sh/ruff/issues/7235.

Closes https://github.com/astral-sh/ruff/issues/7647.
2023-10-20 23:08:26 +00:00
Zanie Blue 81275d12e9
Add documentation for fixes (#7901)
Adds documentation for using `ruff check . --fix`

Uses the draft of the "Automatic fixes" section from
https://github.com/astral-sh/ruff/pull/7732 and adds documentation for
unsafe fixes, applicability levels, and
https://github.com/astral-sh/ruff/pull/7841

I enabled admonitions because they're nice. We should use them more.
2023-10-11 16:41:17 +00:00
Charlie Marsh 5849a75223
Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
Charlie Marsh a3a531e0d4
Add alpha instructions to the `ruff_python_formatter` README (#7064) 2023-09-06 11:55:16 +00:00
Zanie Blue 67b88803d8
Use prettier to format yaml files in pre-commit (#6250)
Prompted by
https://github.com/astral-sh/ruff/pull/6248#discussion_r1280855848
2023-08-01 16:45:08 +00:00
Charlie Marsh e7b059cc5c
Fix nested lists in CONTRIBUTING.md (#5721)
## Summary

We have a lot of two-space-indented stuff, but apparently it needs to be
four-space indented to render as expected in MkDocs.
2023-07-13 16:32:59 +00:00
Charlie Marsh 6587fb844a
Add snapshot tests for resolver (#5404)
## Summary

This PR adds some snapshot tests for the resolver based on executing
resolutions within a "mock" of the Airflow repo (that is: a folder that
contains a subset of the repo's files, but all empty, and with an
only-partially-complete virtual environment). It's intended to act as a
lightweight integration test, to enable us to test resolutions on a
"real" project without adding a dependency on Airflow itself.
2023-06-28 13:38:51 +00:00
Micha Reiser 8879927b9a
Use `insta::glob` instead of `fixture` macro (#5364) 2023-06-26 08:46:18 +00:00
Thomas de Zeeuw 17f1ecd56e
Open cache files in parallel (#5120)
## Summary

Open cache files in parallel (again), brings the performance back to be roughly equal to the old implementation.

## Test Plan

Existing tests should keep working.
2023-06-20 17:43:09 +02:00
konstin 5c416e4d9b
Pre commit without cargo and other pre-PR improvements (#5146)
This tackles three problems:
* pre-commit was slow because it ran cargo commands
* Improve the clarity on what you need to run to get your PR pass on CI
(and make those fast)
* You had to compile and run `cargo dev generate-all` separately, which
was slow

The first change is to remove all cargo commands except running ruff
itself from pre-commit. With `cargo run --bin ruff` already compiled it
takes about 7s on my machine. It would make sense to also use the ruff
pre-commit action here even if we're then lagging a release behind for
checking ruff on ruff.

The contributing guide is now clear about what you need to run:

```shell
cargo clippy --workspace --all-targets --all-features -- -D warnings  # Linting...
RUFF_UPDATE_SCHEMA=1 cargo test  # Testing and updating ruff.schema.json
pre-commit run --all-files  # rust and python formatting, markdown and python linting, etc.
```

Example timings from my machine:

`cargo clippy --workspace --all-targets --all-features -- -D warnings`:
23s
`RUFF_UPDATE_SCHEMA=1 cargo test`: 2min (recompiling), 1min (no code
changes, this is mainly doc tests)
`pre-commit run --all-files`: 7s

The exact numbers don't matter so much as the approximate experience (6s
is easier to just wait than 1min, esp if you need to fix and rerun). The
biggest remaining block seems to be doc tests, i'm surprised i didn't
find any solution to speeding them up (nextest simply doesn't run them
at all). Also note that the formatter has it's own tests which are much
faster since they avoid linking ruff (`cargo test
ruff_python_formatter`).

The third change is to enable `cargo test` to update the schema. Similar
to `INSTA_UPDATE=always`, i've added `RUFF_UPDATE_SCHEMA=1` (name open
to bikeshedding), so `RUFF_UPDATE_SCHEMA=1 cargo test` updates the
schema, while `cargo test` still fails as expected if the repo isn't
up-to-date.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2023-06-18 11:00:42 +00:00
Thomas de Zeeuw e7316c1cc6
Consider ignore-names in all pep8 naming rules (#5079)
## Summary

This changes all remaining pep8 naming rules to consider the
`ingore-names` argument.

Closes #5050

## Test Plan

Added new tests.
2023-06-14 16:57:09 +02:00
konstin 775326790e
Fix pre-commit typos action (#4876)
The typos pre-commit action would also edit test fixtures and snapshots. Unfortunately the pre-commit action also doesn't respect _typos.toml and typos action doesn't allow for an exclude key, so i've added a top level exclude key. I have confirmed that this does stop typos from rewriting my fixtures and snapshots
2023-06-06 08:06:48 +02:00
Julian LaNeve 5756829344
markdownlint: enforce 100 char max length (#4698) 2023-05-28 22:45:56 -04:00
Evan Rittenhouse b1d01b1950
Add a PR template (#4582) 2023-05-24 02:17:38 +00:00
Calum Young ba6370e5d0
Move black excludes from pre-commit config to pyproject.toml (#4370) 2023-05-11 09:00:05 -04:00
Calum Young f0f4bf2929
Move typos to pre-commit config (#4148) 2023-04-29 12:13:35 -04:00
Jonathan Plasse b8ae1e0e05
Add `pre-commit` in CI (#3707) 2023-03-24 17:20:13 -04:00
Jonathan Plasse 7f3b748401
Fix Ruff pre-commit hook errors (#3706) 2023-03-23 22:52:24 -04:00
Jonathan Plasse 92aa3a8178
Use language: system for Rust hooks (#3616) 2023-03-20 22:44:21 -04:00
Xuehai Pan 78c2b0ac47
ci: add dependabot integration for GitHub Actions (#3504) 2023-03-14 10:31:26 -04:00
Jonathan Plasse d285f5c90a
Run automatically format code blocks with Black (#3191) 2023-02-27 10:14:05 -05:00
Jonathan Plasse 39b9a1637f
Fix Markdown errors in docs (#3187) 2023-02-24 13:06:48 -05:00
Jonathan Plasse a688a237d7
Add black to pre-commit (#3192) 2023-02-23 16:24:23 -05:00
Jonathan Plasse d6a100028c
Update docs and pre-commit after #3006 (#3038) 2023-02-19 14:23:01 -05:00
Jonathan Plasse db4c611c6f
Fix broken links and markdown style (#3017) 2023-02-19 08:46:49 -05:00
Edgar R. M 147c6ff1db
Exclude `crates/ruff_python_formatter/resources` from pre-commit check (#2947) 2023-02-15 22:56:42 -05:00
Micha Reiser cd8be8c0be
refactor: Introduce crates folder (#2088)
This PR introduces a new `crates` directory and moves all "product" crates into that folder. 

Part of #2059.
2023-02-05 16:47:48 -05:00
Charlie Marsh b5ac93d2ee
Move Clippy configuration to config.toml (#2541) 2023-02-03 09:26:36 -05:00
Jonathan Plasse bdcab87d2f
Add `markdownlint` and dev Ruff to `pre-commit` (#2303) 2023-02-02 16:29:07 -05:00
Jonathan Plasse 335395adec
Mirror CI clippy command for pre-commit hook (#2494) 2023-02-02 14:59:19 -05:00
Charlie Marsh 651f6b6bce Bump Ruff version to 0.0.240 2023-02-02 12:45:23 -05:00
Charlie Marsh c15595325c Bump version to 0.0.239 2023-01-31 19:06:22 -05:00
Charlie Marsh 1cbd929a0a Bump version to 0.0.238 2023-01-30 16:44:19 -05:00
Charlie Marsh add7fefeb5 Bump version to 0.0.237 2023-01-28 10:52:14 -05:00
Simon Brugman 4f067d806e
add clippy and rust_dev to pre-commit (#2256)
I presume the reasoning for not including clippy in `pre-commit` was that it passes all files. This can be turned off with `pass_filenames`, in which case it only runs once.

`cargo +nightly dev generate-all` is also added (when excluding `target` is does not give false positives).

(The overhead of these commands is not much when the build is there. People can always choose to run only certain hooks with `pre-commit run [hook] --all-files`)
2023-01-27 18:53:44 -05:00
Charlie Marsh 0b34ca7107
Move off nightly Rust for dev workflows (#2278) 2023-01-27 18:35:19 -05:00
Charlie Marsh 685d9ab848 Bump version to 0.0.236 2023-01-26 18:47:00 -05:00
Charlie Marsh edd0e16a02 Bump version to 0.0.235 2023-01-25 18:28:27 -05:00
Charlie Marsh 9b07d0bd92 Bump version to 0.0.234 2023-01-25 16:55:57 -05:00
Jonathan Plasse 82d7814101
Update .pre-commit-config.yml (#2139) 2023-01-24 19:45:34 -05:00
Charlie Marsh 605416922d Bump version to 0.0.233 2023-01-24 10:46:49 -05:00
Charlie Marsh d645a19e0a Bump version to 0.0.232 2023-01-24 09:49:07 -05:00
Charlie Marsh 1c3265ef98 Bump version to 0.0.231 2023-01-23 12:51:09 -05:00
Charlie Marsh 23b622943e Bump version to 0.0.230 2023-01-22 13:58:41 -05:00
Charlie Marsh 84300e00ff Bump version to 0.0.229 2023-01-21 13:18:06 -05:00
Charlie Marsh 5377d24507 Bump version to 0.0.228 2023-01-20 09:58:56 -05:00
Charlie Marsh cf56955ba6 Bump version to 0.0.227 2023-01-19 23:24:52 -05:00
Charlie Marsh d8645acd1f Bump version to 0.0.226 2023-01-18 20:54:38 -05:00
Aarni Koskela ff2be35f51
Run cargo fmt in pre-commit (#1968)
Since `cargo fmt` is a required CI check, we could just as well run it in `pre-commit`.
2023-01-18 13:14:51 -05:00
Charlie Marsh cdb4700813 Bump version to 0.0.225 2023-01-18 00:22:48 -05:00
Charlie Marsh 74a8a218f3 Bump version to 0.0.224 2023-01-16 23:43:14 -05:00
Charlie Marsh e8577d5e26 Bump version to 0.0.223 2023-01-15 22:44:01 -05:00
Charlie Marsh e3cc918b93 Bump version to 0.0.222 2023-01-14 23:34:53 -05:00
Charlie Marsh 931d41bff1 Revert "Bump version to 0.0.222"
This reverts commit 852aab5758.
2023-01-13 23:56:29 -05:00
Charlie Marsh 852aab5758 Bump version to 0.0.222 2023-01-13 23:50:08 -05:00
Charlie Marsh ee6c81d02a Bump version to 0.0.221 2023-01-13 23:33:15 -05:00
Charlie Marsh 9aeb5df5fe Bump version to 0.0.220 2023-01-12 17:57:04 -05:00
Charlie Marsh d8162ce79d Bump version to 0.0.219 2023-01-11 23:46:01 -05:00
Charlie Marsh cfbd068dd5 Bump version to 0.0.218 2023-01-10 21:28:23 -05:00
Charlie Marsh edab268d50 Bump version to 0.0.217 2023-01-09 23:26:22 -05:00
Charlie Marsh caf6c65de7 Bump version to 0.0.216 2023-01-09 01:14:28 -05:00
Charlie Marsh 0152814a00 Bump version to 0.0.215 2023-01-07 22:17:29 -05:00
Charlie Marsh edf46c06d0 Bump version to 0.0.214 2023-01-07 15:34:45 -05:00
Charlie Marsh f1c3ebfe0f Bump version to 0.0.213 2023-01-07 00:30:56 -05:00
Charlie Marsh ee4cae97d5 Bump version to 0.0.212 2023-01-05 21:25:42 -05:00
Charlie Marsh 7b59cd2d32 Bump version to 0.0.211 2023-01-04 23:13:04 -05:00
Charlie Marsh aacfc9ee0b Bump version to 0.0.210 2023-01-03 21:46:08 -05:00
Charlie Marsh e9a236f740 Bump version to 0.0.209 2023-01-03 08:27:28 -05:00
Charlie Marsh 8b277138de Bump version to 0.0.208 2023-01-02 23:19:03 -05:00
Charlie Marsh f74050e5b1 Bump version to 0.0.207 2023-01-02 14:39:32 -05:00
Charlie Marsh 2315db7d13 Bump version to 0.0.206 2023-01-01 16:39:29 -05:00
Charlie Marsh 0e8c237167 Bump version to 0.0.205 2022-12-31 13:44:39 -05:00
Charlie Marsh 0c215365ae Bump version to 0.0.204 2022-12-31 08:20:09 -05:00
Charlie Marsh 74903f23d6 Bump version to 0.0.203 2022-12-30 15:33:30 -05:00
Charlie Marsh 818582fe8a Bump version to 0.0.202 2022-12-30 08:16:32 -05:00
Charlie Marsh 4a6e5d1549 Bump version to 0.0.201 2022-12-29 23:01:35 -05:00
Charlie Marsh 118a93260a Bump version to 0.0.200 2022-12-29 13:31:23 -05:00
Charlie Marsh 057414ddd4 Bump version to 0.0.199 2022-12-28 20:58:43 -05:00
Charlie Marsh c679570041 Bump version to 0.0.198 2022-12-27 21:39:53 -05:00
Charlie Marsh 043d31dcdf Bump version to 0.0.197 2022-12-27 17:05:15 -05:00
Charlie Marsh 3e96803033 Bump version to 0.0.196 2022-12-27 12:02:02 -05:00
Charlie Marsh 1e4b1533ad Bump version to 0.0.195 2022-12-26 20:41:39 -05:00
Charlie Marsh 5ef8bff341 Bump version to 0.0.194 2022-12-25 19:54:45 -05:00
Charlie Marsh f6ca49e05f Bump version to 0.0.193 2022-12-24 14:56:26 -05:00
Charlie Marsh 51bda28a7d Bump version to 0.0.192 2022-12-22 17:31:31 -05:00
Charlie Marsh 03e4f5be8a Bump version to 0.0.191 2022-12-21 21:16:21 -05:00
Charlie Marsh 20234c6156 Bump version to 0.0.190 2022-12-21 16:01:48 -05:00
Charlie Marsh ef8fe31c0c Bump version to 0.0.189 2022-12-20 13:26:17 -05:00
Charlie Marsh 4107bc828d Bump version to 0.0.188 2022-12-19 12:18:06 -05:00
Charlie Marsh b5ab492a70 Bump version to 0.0.187 2022-12-18 20:09:02 -05:00
Charlie Marsh 1028ed3565 Bump version to 0.0.186 2022-12-18 14:30:30 -05:00
Charlie Marsh a2806eb8ef Bump version to 0.0.185 2022-12-16 23:47:56 -05:00
Charlie Marsh 1e19142d0e Bump version to 0.0.184 2022-12-16 14:36:25 -05:00
Charlie Marsh a9f56ee76e Bump version to 0.0.183 2022-12-15 23:15:12 -05:00
Charlie Marsh 1ea2e93f8e Bump version to 0.0.182 2022-12-14 22:57:22 -05:00
Charlie Marsh d814ebd21f Bump version to 0.0.181 2022-12-14 17:35:36 -05:00
Charlie Marsh 854cd14842 Bump version to 0.0.180 2022-12-14 13:21:10 -05:00
Charlie Marsh 765d21c7b0 Bump version to 0.0.179 2022-12-13 10:17:16 -05:00
Charlie Marsh f3e11a30cb Bump version to 0.0.178 2022-12-12 22:06:04 -05:00
Charlie Marsh 19e9eb1af8 Bump version to 0.0.177 2022-12-11 22:38:52 -05:00
Charlie Marsh 9161b866b5 Bump version to 0.0.176 2022-12-11 10:19:50 -05:00
Charlie Marsh c86e52193c Bump version to 0.0.175 2022-12-10 21:23:19 -05:00
Charlie Marsh 63b3e00c97 Bump version to 0.0.174 2022-12-10 12:08:48 -05:00
Charlie Marsh 257bd7f1d7 Bump version to 0.0.173 2022-12-09 23:23:12 -05:00
Charlie Marsh b35a804f9d Bump version to 0.0.172 2022-12-09 17:47:34 -05:00
Charlie Marsh dfd6225d85 Bump version to 0.0.171 2022-12-08 23:18:48 -05:00
Charlie Marsh a710e35ebc Bump version to 0.0.170 2022-12-08 11:36:24 -05:00
Charlie Marsh 5c8655f479 Bump ruff_macros to 0.0.169 2022-12-07 19:10:16 -05:00
Charlie Marsh 4405a6a903 Bump version to 0.0.168 2022-12-07 13:18:40 -05:00
Charlie Marsh d698c6123e Bump version to 0.0.167 2022-12-07 10:37:31 -05:00
Charlie Marsh 80e2f0c92e Bump version to 0.0.166 2022-12-06 16:06:19 -05:00
Charlie Marsh f1d3e3698a Bump version to 0.0.165 2022-12-06 00:03:30 -05:00
Charlie Marsh f2ad915224 Bump version to 0.0.164 2022-12-05 23:37:22 -05:00
Charlie Marsh 1339e2a002 Bump version to 0.0.163 2022-12-05 20:45:24 -05:00
Charlie Marsh 995994be3e Bump version to 0.0.162 2022-12-05 19:07:44 -05:00
Charlie Marsh 4b41ae3f53 Bump version to 0.0.161 2022-12-05 17:02:05 -05:00
Charlie Marsh 40b7c64f7d Bump version to 0.0.160 2022-12-05 12:56:38 -05:00
Charlie Marsh 1d1662cb9c Bump version to 0.0.159 2022-12-05 11:22:02 -05:00
Charlie Marsh 7024ad7cc7 Bump version to 0.0.158 2022-12-04 21:22:24 -05:00
Charlie Marsh 5e9a8fcf53 Bump version to 0.0.157 2022-12-04 14:46:46 -05:00
Charlie Marsh d06dc4c72d Bump version to 0.0.156 2022-12-04 10:22:09 -05:00
Charlie Marsh 4b0c3e3bc9 Bump version to 0.0.155 2022-12-04 00:12:00 -05:00
Charlie Marsh b6b509811d Bump version to 0.0.154 2022-12-03 20:14:38 -05:00
Charlie Marsh e66b786229 Bump version to 0.0.153 2022-12-03 17:05:39 -05:00
Charlie Marsh 1a33ee3fc4 Bump version to 0.0.152 2022-12-02 13:23:00 -05:00
Charlie Marsh 1a24d78f67 Bump version to 0.0.151 2022-12-01 22:31:44 -05:00
Charlie Marsh d699bb7b86 Bump version to 0.0.150 2022-12-01 16:31:18 -05:00
Charlie Marsh 6fa0f21227 Bump version to 0.0.149 2022-11-30 00:51:36 -05:00
Charlie Marsh 30ff4de9a3 Bump version to 0.0.148 2022-11-29 22:50:30 -05:00
Charlie Marsh 2fe22a223b Bump version to 0.0.147 2022-11-29 20:17:58 -05:00
Charlie Marsh 0e6a38e6d8 Bump version to 0.0.146 2022-11-28 22:27:41 -05:00
Charlie Marsh dca994d05f Bump version to 0.0.145 2022-11-28 20:57:58 -05:00
Charlie Marsh 72453695d6 Bump version to 0.0.144 2022-11-28 20:11:08 -05:00
Charlie Marsh ea9acda732 Bump version to 0.0.143 2022-11-28 15:42:25 -05:00
Charlie Marsh e2c4a098de Bump version to 0.0.142 2022-11-28 00:19:27 -05:00
Charlie Marsh 9897f81cf3 Bump version to 0.0.141 2022-11-26 16:33:08 -05:00
Charlie Marsh 14cf36f922 Bump version to 0.0.140 2022-11-26 15:05:46 -05:00
Charlie Marsh 560558b814 Bump version to 0.0.139 2022-11-25 18:38:26 -05:00
Charlie Marsh 0b60242fb7 Bump version to 0.0.138 2022-11-25 00:05:41 -05:00
Charlie Marsh 68668a584b Bump version to 0.0.137 2022-11-23 20:28:45 -05:00
Charlie Marsh 58aac21a36 Bump version to 0.0.136 2022-11-23 17:41:17 -05:00
Charlie Marsh 66975876b2 Bump version to 0.0.135 2022-11-22 19:21:53 -05:00
Charlie Marsh 59615486d8 Bump version to 0.0.134 2022-11-21 16:15:23 -05:00
Charlie Marsh 0b9188011b Bump version to 0.0.133 2022-11-21 13:39:37 -05:00