Commit Graph

36 Commits

Author SHA1 Message Date
Charlie Marsh b49aa35074
Split LICENSE addendum by derivation type (#20222)
## Summary

Per
https://github.com/astral-sh/ruff/issues/20191#issuecomment-3251131478,
this PR restructures the license file to draw a distinction between
projects from which we've (e.g.) drawn source code and projects whose
rules we've implemented but have otherwise not reused or adapted source
code from, which are credited in the README. While I was here, I also
sorted the list.
2025-09-03 21:35:33 -04:00
Auguste Lalande 4bc73dd87e
[`pydoclint`] Implement `docstring-missing-exception` and `docstring-extraneous-exception` (`DOC501`, `DOC502`) (#11471)
## Summary

These are the first rules implemented as part of #458, but I plan to
implement more.

Specifically, this implements `docstring-missing-exception` which checks
for raised exceptions not documented in the docstring, and
`docstring-extraneous-exception` which checks for exceptions in the
docstring not present in the body.

## Test Plan

Test fixtures added for both google and numpy style.
2024-07-20 19:41:51 +00:00
Kar Petrosyan 2ff1afb15c
Add initial flake8-trio rule (#8439)
## Summary

This pull request adds
[flake8-trio](https://github.com/Zac-HD/flake8-trio) support to ruff,
which is a very useful plugin for trio users to avoid very common
mistakes.

Part of https://github.com/astral-sh/ruff/issues/8451.

## Test Plan

Traditional rule testing, as [described in the
documentation](https://docs.astral.sh/ruff/contributing/#rule-testing-fixtures-and-snapshots).
2023-11-03 01:05:12 +00:00
Mahesh Saripalli ee9ee005c5
Update flake8-self license to MIT (#7552)
## Summary

This PR updates the flake8-self license from Freely Distributable to the
MIT License to match the upstream license, which was recently updated.


f5fc507515/LICENSE
2023-09-20 17:17:55 -04:00
qdegraaf 3112202a5b
[`flake8-logging`] Add `flake8_logging` boilerplate and first rule `LOG009` (#7249)
## Summary

Adds `LOG009` from
[flake8-logging](https://github.com/adamchainz/flake8-logging). Also
adds the boilerplate for a new plugin

Checks for usages of undocumented `logging.WARN` constant and suggests
replacement with `logging.WARNING`.

## Test Plan

`cargo test` with fresh fixture

## Issue links

Refers: https://github.com/astral-sh/ruff/issues/7248
2023-09-15 01:41:32 +00:00
Charlie Marsh 1ed227a1e0
Port Pyright's import resolver to Rust (#5381)
## Summary

This PR contains the first step towards enabling robust first-party,
third-party, and standard library import resolution in Ruff (including
support for `typeshed`, stub files, native modules, etc.) by porting
Pyright's import resolver to Rust.

The strategy taken here was to start with a more-or-less direct port of
the Pyright's TypeScript resolver. The code is intentionally similar,
and the test suite is effectively a superset of Pyright's test suite for
its own resolver. Due to the nature of the port, the code is very, very
non-idiomatic for Rust. The code is also entirely unused outside of the
test suite, and no effort has been made to integrate it with the rest of
the codebase.

Future work will include:

- Refactoring the code (now that it works) to match Rust and Ruff
idioms.
- Further testing, in practice, to ensure that the resolver can resolve
imports in a complex project, when provided with a virtual environment
path.
- Caching, to minimize filesystem lookups and redundant resolutions.
- Integration into Ruff itself (use Ruff's existing settings, find rules
that can make use of robust resolution, etc.)
2023-06-27 16:15:07 +00:00
qdegraaf a477720f4e
[`perflint`] Add `perflint` plugin, add first rule `PERF102` (#4821)
## Summary

Adds boilerplate for implementing the
[perflint](https://github.com/tonybaloney/perflint/) plugin, plus a
first rule.

## Test Plan

Fixture added for PER8102

## Issue link

Refers: https://github.com/charliermarsh/ruff/issues/4789
2023-06-13 01:54:44 +00:00
qdegraaf 2bb32ee943
[`flake8-slots`] Add plugin, add `SLOT000`, `SLOT001` and `SLOT002` (#4909) 2023-06-09 04:14:16 +00:00
qdegraaf 8ba9eb83af
Implement `flake8-async` plugin (#4432) 2023-05-15 09:15:28 -04:00
Evan Rittenhouse 2f53781a77
Implement `flake8_todos` (#3921) 2023-05-13 14:19:06 +00:00
Charlie Marsh f23851130a
Add `flynt` to documentation (#4295) 2023-05-09 00:52:41 +00:00
Leiser Fernández Gallo 224e85c6d7
Implement `flake8-gettext` (#3785) 2023-03-28 23:32:02 +00:00
Charlie Marsh c3917eab38
Revert "Implement `flake8-i18n` (#3741)" (#3765) 2023-03-27 21:14:38 +00:00
Leiser Fernández Gallo 5cb120327c
Implement `flake8-i18n` (#3741) 2023-03-27 18:03:39 +00:00
Jonathan Plasse f70a49ed8b
Add autofix for magic methods (`ANN204`) (#3633) 2023-03-20 19:19:20 -04:00
Charlie Marsh f661c90bd7
Remove dependency on `ruff_rowan` (#2875)
This PR removes the dependency on `ruff_rowan` (i.e., Rome's fork of rust-analyzer's `rowan`), and in turn, trims out a lot of code in `ruff_formatter` that isn't necessary (or isn't _yet_ necessary) to power the autoformatter.

We may end up pulling some of this back in -- TBD. For example, the autoformatter has its own comment representation right now, but we may eventually want to use the `comments.rs` data structures defined in `rome_formatter`.
2023-02-15 03:54:08 +00:00
Charlie Marsh 3ef1c2e303
Add `rome_formatter` fork as `ruff_formatter` (#2872)
The Ruff autoformatter is going to be based on an intermediate representation (IR) formatted via [Wadler's algorithm](https://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf). This is architecturally similar to [Rome](https://github.com/rome/tools), Prettier, [Skip](https://github.com/skiplang/skip/blob/master/src/tools/printer/printer.sk), and others.

This PR adds a fork of the `rome_formatter` crate from [Rome](https://github.com/rome/tools), renamed here to `ruff_formatter`, which provides generic definitions for a formatter IR as well as a generic IR printer. (We've also pulled in `rome_rowan`, `rome_text_size`, and `rome_text_edit`, though some of these will be removed in future PRs.)

Why fork? `rome_formatter` contains code that's specific to Rome's AST representation (e.g., it relies on a fork of rust-analyzer's `rowan`), and we'll likely want to support different abstractions and formatting capabilities (there are already a few changes coming in future PRs). Once we've dropped `ruff_rowan` and trimmed down `ruff_formatter` to the code we currently need, it's also not a huge surface area to maintain and update.
2023-02-14 19:22:55 -05:00
Charlie Marsh ca8a122889
Add `flake8-django` to LICENSE (#2820) 2023-02-12 17:51:40 +00:00
Steve Dignam 67e58a024a
Add flake8-pyi with one rule (#2682)
Add basic scaffold for [flake8-pyi](https://github.com/PyCQA/flake8-pyi) and the first rule, Y001

rel: https://github.com/charliermarsh/ruff/issues/848
2023-02-09 19:03:11 -05:00
Maksudul Haque 9e59c99133
[`flake8-self`] Add Plugin and Rule `SLF001` (#2470) 2023-02-02 07:58:14 -05:00
Maksudul Haque 7c1a6bce7b
[`flake8-raise`] Add Plugin and `RSE102` Rule (#2354) 2023-01-31 18:09:40 -05:00
Edgar R. M e88275280b
Implement some rules from `flake8-logging-format` (#2150) 2023-01-26 12:58:10 -05:00
Charlie Marsh 16d2ece87d
Restore single-file license (#2180)
These were split into per-project licenses in #1648, but I don't like that they're no longer included in the distribution (due to current limitations in the `pyproject.toml` spec).
2023-01-25 17:59:12 -05:00
Charlie Marsh 9041423b92
Move external licenses to separate directory (#1648) 2023-01-04 20:07:51 -05:00
Charlie Marsh b078050732
Implicit flake8-implicit-str-concat (#1463) 2022-12-29 23:00:55 -05:00
Reiner Gerecke 7f25d1ec70
Implement SIM118 (key in dict) of flake8-simplify (#1195) 2022-12-11 10:05:11 -05:00
Charlie Marsh bb67fbb73a
Implement unused argument detection (`ARG`) (#1126)
Detect unused arguments
2022-12-07 12:15:41 -05:00
Charlie Marsh 291727a27d
Implement `flake8-return` plugin (#1016) 2022-12-03 20:12:11 -05:00
Jonathan Plasse 117fcb6936
Add no-eval rule from pygrep-hooks (#994) 2022-12-02 12:59:06 -05:00
Charlie Marsh 82b0b7941a
Implement eradicate (#947) 2022-11-28 20:54:33 -05:00
Denis Gavrilyuk 721a1e9443
Add flake8-debugger (#909) 2022-11-26 16:21:03 -05:00
Oliver Margetts 2cf2805848
Implement F521 (#898) 2022-11-24 18:09:36 -05:00
Jonathan Plasse 2f894e3951
Add flake8-blind-except (#805) 2022-11-18 12:15:10 -05:00
Charlie Marsh f0a54716e5
Implement flake8-tidy-imports (#789) 2022-11-17 11:44:06 -05:00
Charlie Marsh 5717cc97d7 Add references to Flake8 licenses 2022-11-15 23:07:41 -05:00
Charlie Marsh 974a80a26d
Create LICENSE 2022-08-10 15:44:55 -04:00