Charlie Marsh
23b622943e
Bump version to 0.0.230
2023-01-22 13:58:41 -05:00
Harutaka Kawamura
a7ce8621a9
Update RustPython to fix Dict.keys type ( #2086 )
...
This PR upgrades RustPython to fix the type of `Dict.keys` to `Vec<Option<Expr>>` (see https://github.com/RustPython/RustPython/pull/4449 for why this change was needed) and unblock #1884 .
2023-01-22 13:24:00 -05:00
Shannon Rothe
36fb8f7a63
flake8_to_ruff: support isort options ( #2082 )
...
See: https://github.com/charliermarsh/ruff/issues/1749 .
2023-01-22 13:18:01 -05:00
alm
e11cf1bf65
Update linters PyPI links to latest version ( #2062 )
2023-01-22 13:10:22 -05:00
Maksudul Haque
75e16c0ce5
[pep8-naming][N806] Don't mark TypeVar & NewType Assignment as Errors ( #2085 )
...
closes https://github.com/charliermarsh/ruff/issues/1985
2023-01-22 12:54:13 -05:00
Martin Fischer
1beedf20f9
fix: add_rule.py for --linter ruff
2023-01-22 11:51:29 -05:00
Martin Fischer
4758ee6ac4
refactor: Generate Linter -> RuleSelector mapping via macro
...
To enable ruff_dev to automatically generate the rule Markdown tables in
the README the ruff library contained the following function:
Linter::codes() -> Vec<RuleSelector>
which was slightly changed to `fn prefixes(&self) -> Prefixes` in
9dc66b5a65 to enable ruff_dev to split
up the Markdown tables for linters that have multiple prefixes
(pycodestyle has E & W, Pylint has PLC, PLE, PLR & PLW).
The definition of this method was however largely redundant with the
#[prefix] macro attributes in the Linter enum, which are used to
derive the Linter::parse_code function, used by the --explain command.
This commit removes the redundant Linter::prefixes by introducing a
same-named method with a different signature to the RuleNamespace trait:
fn prefixes(&self) -> &'static [&'static str];
As well as implementing IntoIterator<Rule> for &Linter. We extend the
extisting RuleNamespace proc macro to automatically derive both
implementations from the Linter enum definition.
To support the previously mentioned Markdown table splitting we
introduce a very simple hand-written method to the Linter impl:
fn categories(&self) -> Option<&'static [LinterCategory]>;
2023-01-22 11:51:29 -05:00
Martin Fischer
c3dd1b0e3c
refactor: Rename ParseCode trait to RuleNamespace
...
ParseCode was a fitting name since the trait only contained a single
parse_code method ... since we now however want to introduce an
additional `prefixes` method RuleNamespace is more fitting.
2023-01-22 11:51:29 -05:00
Martin Fischer
87443e6301
Support prefix "PL" to select all of Pylint
2023-01-22 11:51:29 -05:00
Martin Fischer
16d2ceba79
refactor: Avoid unnecessary Map indexing
2023-01-22 11:51:29 -05:00
Martin Fischer
aedee7294e
refactor: Stop using Ident as BTreeMap key
...
Using Ident as the key type is inconvenient since creating an Ident
requires the specification of a Span, which isn't actually used by
the Hash implementation of Ident.
2023-01-22 11:51:29 -05:00
Martin Fischer
4f12b31dc8
refactor: Drop RuleSelector::codes in favor of IntoIterator impl
2023-01-22 11:51:29 -05:00
Martin Fischer
9f14e7c830
refactor: Update some variable/field/method names
2023-01-22 11:51:29 -05:00
Martin Fischer
4cc492a17a
refactor: Encapsulate PerFileIgnore impl details
2023-01-22 11:51:29 -05:00
Martin Fischer
028436af81
refactor: Group Configuration struct fields
2023-01-22 11:51:29 -05:00
Martin Fischer
da4994aa73
refactor: impl From<&Configuration> for RuleTable
2023-01-22 11:51:29 -05:00
Martin Fischer
4dcb491bec
refactor: Avoid some unnecessary allocations
2023-01-22 11:51:29 -05:00
Simon Brugman
6fc6bf0648
feat: enable autofix for TRY004 ( #2084 )
...
functionality was already implemented, just the trait needed to be added
2023-01-22 07:18:56 -05:00
Charlie Marsh
c1cb4796f8
Support decorators in source code generator ( #2081 )
2023-01-21 23:26:32 -05:00
Charlie Marsh
d81620397e
Improve generator precedence operations ( #2080 )
2023-01-21 23:21:37 -05:00
Charlie Marsh
84b1490d03
Base INP check on package inference ( #2079 )
...
If a file doesn't have a `package`, then it must both be in a directory that lacks an `__init__.py`, and a directory that _isn't_ marked as a namespace package.
Closes #2075 .
2023-01-21 19:49:56 -05:00
Simon Brugman
28f05aa6e7
feat: update scripts to new rules structure ( #2078 )
...
- optional `prefix` argument for `add_plugin.py`
- rules directory instead of `rules.rs`
- pathlib syntax
- fix test case where code was added instead of name
Example:
```
python scripts/add_plugin.py --url https://pypi.org/project/example/1.0.0/ example --prefix EXA
python scripts/add_rule.py --name SecondRule --code EXA002 --linter example
python scripts/add_rule.py --name FirstRule --code EXA001 --linter example
python scripts/add_rule.py --name ThirdRule --code EXA003 --linter example
```
Note that it breaks compatibility with 'old style' plugins (generation works fine, but namespaces need to be changed):
```
python scripts/add_rule.py --name DoTheThing --code PLC999 --linter pylint
```
2023-01-21 19:19:58 -05:00
Charlie Marsh
325faa8e18
Include package path in cache key ( #2077 )
...
Closes #2075 .
2023-01-21 18:33:35 -05:00
Charlie Marsh
6bfa1804de
Remove remaining ropey usages ( #2076 )
2023-01-21 18:24:10 -05:00
Charlie Marsh
4dcf284a04
Index source code upfront to power (row, column) lookups ( #1990 )
...
## Summary
The problem: given a (row, column) number (e.g., for a token in the AST), we need to be able to map it to a precise byte index in the source code. A while ago, we moved to `ropey` for this, since it was faster in practice (mostly, I think, because it's able to defer indexing). However, at some threshold of accesses, it becomes faster to index the string in advance, as we're doing here.
## Benchmark
It looks like this is ~3.6% slower for the default rule set, but ~9.3% faster for `--select ALL`.
**I suspect there's a strategy that would be strictly faster in both cases**, based on deferring even more computation (right now, we lazily compute these offsets, but we do it for the entire file at once, even if we only need some slice at the top), or caching the `ropey` lookups in some way.
Before:

After:

## Alternatives
I tried tweaking the `Vec::with_capacity` hints, and even trying `Vec::with_capacity(str_indices::lines_crlf::count_breaks(contents))` to do a quick scan of the number of lines, but that turned out to be slower.
2023-01-21 17:56:11 -05:00
Zeddicus414
08fc9b8095
ICN001 check from imports that have no alias ( #2072 )
...
Add tests.
Ensure that these cases are caught by ICN001:
```python
from xml.dom import minidom
from xml.dom.minidom import parseString
```
with config:
```toml
[tool.ruff.flake8-import-conventions.extend-aliases]
"dask.dataframe" = "dd"
"xml.dom.minidom" = "md"
"xml.dom.minidom.parseString" = "pstr"
```
2023-01-21 17:47:08 -05:00
Cosmo
39aed6f11d
Update link to Pylint parity tracking issue ( #2074 )
2023-01-21 17:46:55 -05:00
Zeddicus414
5726118cfe
ICN001 import-alias-is-not-conventional should check "from" imports ( #2070 )
...
Closes https://github.com/charliermarsh/ruff/issues/2047 .
2023-01-21 15:43:51 -05:00
Simon Brugman
67de8ac85e
feat: implementation for TRY004 ( #2066 )
...
See: #2056 .
2023-01-21 14:58:59 -05:00
figsoda
b1bda0de82
fix: pin rustpython to the same revision to fix cargo vendor ( #2069 )
...
I was trying to update ruff in nixpkgs and ran into this error when it was running `cargo vendor`
```
error: failed to sync
Caused by:
found duplicate version of package `rustpython-ast v0.2.0` vendored from two sources:
source 1: https://github.com/RustPython/RustPython.git?rev=62aa942bf506ea3d41ed0503b947b84141fdaa3c#62aa942b
source 2: https://github.com/RustPython/RustPython.git?rev=ff90fe52eea578c8ebdd9d95e078cc041a5959fa#ff90fe52
```
2023-01-21 14:40:00 -05:00
Charlie Marsh
84300e00ff
Bump version to 0.0.229
2023-01-21 13:18:06 -05:00
Charlie Marsh
fbee95a668
Avoid flagging redefined imports as unused in same-scope ( #2065 )
...
This is effectively a revert of #1173 , to favor false-negatives over false-positives in the same-scope case.
Closes #2044 .
2023-01-21 12:50:21 -05:00
Simon Brugman
afcf5c0ee0
feat: plugin scaffold for tryceratops with TRY300 ( #2055 )
...
Renamed to TRY to avoid conflicts, as proposed in https://github.com/guilatrova/tryceratops/pull/55
https://github.com/guilatrova/tryceratops/blob/main/docs/violations/TC300.md
See: #2056
2023-01-21 11:25:10 -05:00
Maksudul Haque
0c30768288
[flake8-builtins] Add builtins-ignorelist Option ( #2061 )
...
Closes #2053 .
2023-01-21 11:09:04 -05:00
Colin Delahunty
80295f335b
Pyupgrade: Printf string formatting ( #1803 )
2023-01-21 09:37:22 -05:00
Charlie Marsh
465943adf7
Revert "Upgrade to toml v0.5.11" ( #2058 )
...
This _did_ fix https://github.com/charliermarsh/ruff/issues/1894 , but was a little premature. `toml` doesn't actually depend on `toml-edit` yet, and `v0.5.11` was mostly about deprecations AFAICT. So upgrading might solve that issue, but could introduce other incompatibilities, and I'd like to minimize churn. I expect that `toml` will have a new release soon, so we can revert this revert.
Reverts charliermarsh/ruff#2040 .
2023-01-21 07:54:56 -05:00
Charlie Marsh
38eed292e4
Avoid removing comments in RUF005 ( #2057 )
...
Closes #2054 .
2023-01-21 07:37:25 -05:00
Harutaka Kawamura
883e650a35
Fix S101 range to only highlight assert ( #2052 )
...
Fix:
```
resources/test/fixtures/flake8_bandit/S101.py:2:1: S101 Use of `assert` detected
|
2 | assert True
| ^^^^^^^^^^^ S101
|
resources/test/fixtures/flake8_bandit/S101.py:8:5: S101 Use of `assert` detected
|
8 | assert x == 1
| ^^^^^^^^^^^^^ S101
|
resources/test/fixtures/flake8_bandit/S101.py:11:5: S101 Use of `assert` detected
|
11 | assert x == 2
| ^^^^^^^^^^^^^ S101
|
Found 3 error(s).
```
to:
```
resources/test/fixtures/flake8_bandit/S101.py:2:1: S101 Use of `assert` detected
|
2 | assert True
| ^^^^^^ S101
|
resources/test/fixtures/flake8_bandit/S101.py:8:5: S101 Use of `assert` detected
|
8 | assert x == 1
| ^^^^^^ S101
|
resources/test/fixtures/flake8_bandit/S101.py:11:5: S101 Use of `assert` detected
|
11 | assert x == 2
| ^^^^^^ S101
|
```
2023-01-21 07:15:00 -05:00
Harutaka Kawamura
eb1b5e5454
De-duplicate SIM102 ( #2050 )
...
The idea is the same as #1867 . Avoids emitting `SIM102` twice for the following code:
```python
if a:
if b:
if c:
d
```
```
resources/test/fixtures/flake8_simplify/SIM102.py:1:1: SIM102 Use a single `if` statement instead of nested `if` statements
resources/test/fixtures/flake8_simplify/SIM102.py:2:5: SIM102 Use a single `if` statement instead of nested `if` statements
```
2023-01-20 23:38:52 -05:00
Charlie Marsh
8e558a3458
Add scaffolding for flake8-type-checking extension ( #2048 )
...
This PR adds the scaffolding files for `flake8-type-checking`, along with the simplest rule (`empty-type-checking-block`), just as an example to get us started.
See: #1785 .
2023-01-20 22:41:36 -05:00
Martin Fischer
4e4643aa5d
refactor: Decouple Rule from linter prefixes
...
543865c96b introduced
RuleCode::origin() -> RuleOrigin generation via a macro, while that
signature now has been renamed to Rule::origin() -> Linter we actually
want to get rid of it since rules and linters shouldn't be this tightly
coupled (since one rule can exist in multiple linters).
Another disadvantage of the previous approach was that the prefixes
had to be defined in ruff_macros/src/prefixes.rs, which was easy to
miss when defining new linters in src/*, case in point
INP001 => violations::ImplicitNamespacePackage has in the meantime been
added without ruff_macros/src/prefixes.rs being updated accordingly
which resulted in `ruff --explain INP001` mistakenly reporting that the
rule belongs to isort (since INP001 starts with the isort prefix "I").
The derive proc macro introduced in this commit requires every variant
to have at least one #[prefix = "..."], eliminating such mistakes.
2023-01-20 20:25:57 -05:00
Martin Fischer
b19258a243
refactor: Rename RuleCodePrefix to RuleSelector
...
More accurate since the enum also encompasses:
* ALL (which isn't a prefix at all)
* fully-qualified rule codes (which aren't prefixes unless you say
they're a prefix to the empty string but that's not intuitive)
2023-01-20 20:25:57 -05:00
Martin Fischer
7fc42f8f85
refactor: Rename RuleOrigin to Linter
...
"origin" was accurate since ruff rules are currently always modeled
after one origin (except the Ruff-specific rules).
Since we however want to introduce a many-to-many mapping between codes
and rules, the term "origin" no longer makes much sense. Rules usually
don't have multiple origins but one linter implements a rule first and
then others implement it later (often inspired from another linter).
But we don't actually care much about where a rule originates from when
mapping multiple rule codes to one rule implementation, so renaming
RuleOrigin to Linter is less confusing with the many-to-many system.
2023-01-20 20:25:57 -05:00
Dmitry Dygalo
babe1eb7be
perf: Reduce allocations ( #2045 )
...
I found a few places where some allocations could be avoided.
2023-01-20 20:06:48 -05:00
Simon Brugman
608b2191aa
[flake8-executable] EXE003-005 ( #2023 )
...
Tracking issue: https://github.com/charliermarsh/ruff/issues/2024
Implementation for EXE003, EXE004 and EXE005 of `flake8-executable`
(shebang should contain "python", not have whitespace before, and should be on the first line)
Please take in mind that this is my first rust contribution.
The remaining EXE-rules are a combination of shebang (`lines.rs`), file permissions (`fs.rs`) and if-conditions (`ast.rs`). I was not able to find other rules that have interactions/dependencies in them. Any advice on how this can be best implemented would be very welcome.
For autofixing `EXE005`, I had in mind to _move_ the shebang line to the top op the file. This could be achieved by a combination of `Fix::insert` and `Fix::delete` (multiple fixes per diagnostic), or by implementing a dedicated `Fix::move`, or perhaps in other ways. For now I've left it out, but keen on hearing what you think would be most consistent with the package, and pointer where to start (if at all).
---
If you care about another testimonial:
`ruff` not only helps staying on top of the many excellent flake8 plugins and other Python code quality tools that are available, it also applies them at baffling speed.
(Planning to implement it soon for github.com/pandas-profiling/pandas-profiling (as largest contributor) and github.com/ing-bank/popmon.)
2023-01-20 18:19:07 -05:00
Eric Roberts
3939c2dbf7
Add support for pycodestyle E101 ( #2038 )
...
Rule described here: https://www.flake8rules.com/rules/E101.html
I tried to follow contributing guidelines closely, I've never worked with Rust before. Stumbled across Ruff a few days ago and would like to use it in our project, but we use a bunch of flake8 rules that are not yet implemented in ruff, so I decided to give it a go.
2023-01-20 17:24:58 -05:00
Charlie Marsh
20a9252e92
Upgrade to toml v0.5.11 ( #2040 )
...
In #1680 , we moved over to `toml_edit`. But it looks like `toml` now uses `toml_edit`, and has implemented some improvements (e.g., this closes #1894 ).
2023-01-20 17:20:45 -05:00
Hugo van Kemenade
a0e3347e43
README: --force-exclude is already set ( #2042 )
...
Re: https://github.com/charliermarsh/ruff-pre-commit/issues/19 / https://github.com/charliermarsh/ruff-pre-commit/pull/20
This is now always set, no need to include it in the README example.
2023-01-20 17:20:22 -05:00
Charlie Marsh
9e704a7c63
Only fix true-false returns for return-bool-condition-directly ( #2037 )
...
Closes #2035 .
2023-01-20 13:17:19 -05:00
Zeddicus414
c9da98e0b7
Fix D404 NoThisPrefix not working with whitespace. ( #2036 )
...
D404 should trigger for """ This is a docstring."""
Add a few tests to ensure the fix worked.
2023-01-20 13:01:31 -05:00
Charlie Marsh
5377d24507
Bump version to 0.0.228
2023-01-20 09:58:56 -05:00
Florian Best
db8e4500ee
fix(pydocstyle): Avoid trimming docstring if starts with leading quote ( #2027 )
...
Fixes : #2017
looks like the other way round is also possible to break:
```""" "foo"""`
2023-01-20 09:57:48 -05:00
Aarni Koskela
bd2de5624e
Move readme dev details to CONTRIBUTING.md and fix contradictions ( #2030 )
...
Following up on #2018/#2019 discussion, this moves the readme's development-related bits to `CONTRIBUTING.md` to avoid duplication, and fixes up the commands accordingly 😄
2023-01-20 09:23:28 -05:00
Aarni Koskela
3a81f893cc
Bump terminfo to remove a whole bunch of unnecessary dependencies ( #2022 )
...
See 6281c6b8f7
```
$ cargo update -p terminfo
Updating crates.io index
Removing cfg-if v0.1.10
Removing dirs v2.0.2
Removing getrandom v0.1.16
Removing phf v0.8.0
Updating phf_codegen v0.8.0 -> v0.11.1
Updating phf_generator v0.8.0 -> v0.11.1
Removing phf_shared v0.8.0
Removing rand v0.7.3
Removing rand_chacha v0.2.2
Removing rand_core v0.5.1
Removing rand_hc v0.2.0
Removing rand_pcg v0.2.1
Updating terminfo v0.7.3 -> v0.7.5
Removing wasi v0.9.0+wasi-snapshot-preview1
```
2023-01-20 09:09:02 -05:00
Charlie Marsh
fd6dc2a343
Use platform-appropriate newline character for LibCST embedding ( #2028 )
...
Closes #2026 .
2023-01-20 09:08:04 -05:00
Martin Fischer
8693236f9e
Make CI test add_*.py scripts
2023-01-20 08:09:54 -05:00
Martin Fischer
44e2b6208a
fix: Update add_rule.py to create new files for rules
2023-01-20 08:09:54 -05:00
Martin Fischer
16c81f75c2
fix: Update add_rule.py to account for 16e79c8d
2023-01-20 08:09:54 -05:00
Martin Fischer
e1d6ac3265
fix: Update add_plugin.py to account for 9dc66b5a
2023-01-20 08:09:54 -05:00
Martin Fischer
3aec1100f5
fix: Update add_plugin.py to account for b78b6f27
2023-01-20 08:09:54 -05:00
Martin Fischer
c00df647e1
fix: Update add_rule.py to account for 81996f1bc
2023-01-20 08:09:54 -05:00
Martin Fischer
f012877be1
Add scripts/pyproject.toml to use ruff for ruff :)
2023-01-20 08:09:54 -05:00
Martin Fischer
ff6defc988
refactor: Introduce get_indent helper for scripts
2023-01-20 08:09:54 -05:00
Martin Fischer
67ca50e9f2
refactor: Reduce code duplication in scripts/
2023-01-20 08:09:54 -05:00
Martin Fischer
6cc160bc2b
Mark scripts/add_*.py as executable
2023-01-20 08:09:54 -05:00
Ville Skyttä
4bdf506d80
Grammar fixes ( #2014 )
2023-01-20 07:44:23 -05:00
Charlie Marsh
4af2353ef9
Avoid trimming docstring if ends in trailing quote ( #2025 )
...
Closes #2017 .
2023-01-20 07:41:58 -05:00
Ville Skyttä
6072edf5bf
Note .astimezone() in call-datetime-strptime-without-zone message ( #2015 )
2023-01-20 07:40:34 -05:00
Martin Fischer
4061eeeb32
Update CI to use MSRV for cargo test and build
...
As per Cargo.toml our minimal supported Rust version is 1.65.0, so we
should be using that version in our CI for cargo test and cargo build.
This was apparently accidentally changed in
79ca66ace5 .
2023-01-20 07:39:40 -05:00
Aarni Koskela
bea6deb0c3
Port pydocstyle code 401 (ImperativeMood) ( #1999 )
...
This adds support for pydocstyle code D401 using the `imperative` crate.
2023-01-20 07:18:27 -05:00
Colin Delahunty
81db00a3c4
Pyupgrade: Extraneous parenthesis ( #1926 )
2023-01-20 00:04:07 -05:00
Charlie Marsh
cf56955ba6
Bump version to 0.0.227
2023-01-19 23:24:52 -05:00
Charlie Marsh
8a8939afd8
Avoid checking row types for single-name @parametrize decorators ( #2013 )
...
Closes #2008 .
2023-01-19 22:13:17 -05:00
Martin Fischer
6acf2accc6
Improve --explain output
...
Previous output for `ruff --explain E711`:
E711 (pycodestyle): Comparison to `None` should be `cond is None`
New output:
none-comparison
Code: E711 (pycodestyle)
Autofix is always available.
Message formats:
* Comparison to `None` should be `cond is None`
* Comparison to `None` should be `cond is not None`
2023-01-19 22:08:00 -05:00
Charlie Marsh
ec0c7647ab
Avoid SIM401 in elif blocks ( #2012 )
...
For now, we're just gonna avoid flagging this for `elif` blocks, following the same reasoning as for ternaries. We can handle all of these cases, but we'll knock out the TODOs as a pair, and this avoids broken code.
Closes #2007 .
2023-01-19 21:57:18 -05:00
Charlie Marsh
045229630e
Upgrade RustPython ( #2011 )
...
This lets us revert the "manual" fix introduced in #1944 .
2023-01-19 21:49:12 -05:00
Martin Fischer
c600991905
Change AsRef<str> impl for Rule to kebab-case
...
As we surface rule names more to users we want
them to be easier to type than PascalCase.
Prior art:
Pylint and ESLint also use kebab-case for their rule names.
Clippy uses snake_case but only for syntactical reasons
(so that the argument to e.g. #![allow(clippy::some_lint)]
can be parsed as a path[1]).
[1]: https://doc.rust-lang.org/reference/paths.html
2023-01-19 21:37:11 -05:00
Charlie Marsh
f6a93a4c3d
Enable autofix for FitsOnOneLine (D200) ( #2006 )
...
Closes #1965 .
2023-01-19 19:24:50 -05:00
Aarni Koskela
de54ff114e
Add RUF005 "unpack instead of concatenating" check ( #1957 )
...
This PR adds a new check that turns expressions such as `[1, 2, 3] + foo` into `[1, 2, 3, *foo]`, since the latter is easier to read and faster:
```
~ $ python3.11 -m timeit -s 'b = [6, 5, 4]' '[1, 2, 3] + b'
5000000 loops, best of 5: 81.4 nsec per loop
~ $ python3.11 -m timeit -s 'b = [6, 5, 4]' '[1, 2, 3, *b]'
5000000 loops, best of 5: 66.2 nsec per loop
```
However there's a couple of gotchas:
* This felt like a `simplify` rule, so I borrowed an unused `SIM` code even if the upstream `flake8-simplify` doesn't do this transform. If it should be assigned some other code, let me know 😄
* **More importantly** this transform could be unsafe if the other operand of the `+` operation has overridden `__add__` to do something else. What's the `ruff` policy around potentially unsafe operations? (I think some of the suggestions other ported rules give could be semantically different from the original code, but I'm not sure.)
* I'm not a very established Rustacean, so there's no doubt my code isn't quite idiomatic. (For instance, is there a neater way to write that four-way `match` statement?)
Thanks for `ruff`, by the way! :)
2023-01-19 17:38:17 -05:00
Charlie Marsh
64b398c72b
Tweak some instructions in CONTRIBUTING.md
2023-01-19 17:17:39 -05:00
Aarni Koskela
c99bd3fa60
Split up pydocstyle rules ( #2003 )
...
As per @not-mAs per @not-my-profile's [comment](https://github.com/charliermarsh/ruff/pull/1999#discussion_r1081579337 ):
> we actually want to break up such rules.rs files into smaller files
this breaks up `pydocstyle/rules.rs` into a directory.y-profile's [comment](https://github.com/charliermarsh/ruff/pull/1999#discussion_r1081579337 ):
> we actually want to break up such rules.rs files into smaller files
this breaks up `pydocstyle/rules.rs` into a directory.
2023-01-19 13:17:25 -05:00
Martin Fischer
8ac930f886
Fix that --explain panics
...
This commit fixes a bug accidentally introduced in
6cf770a692 ,
which resulted every `ruff --explain <code>` invocation to fail with:
thread 'main' panicked at 'Mismatch between definition and access of `explain`.
Could not downcast to ruff::registry::Rule, need to downcast to &ruff::registry::Rule',
ruff_cli/src/cli.rs:184:18
We also add an integration test for --explain to prevent such bugs from
going by unnoticed in the future.
2023-01-19 12:58:44 -05:00
Charlie Marsh
ad80fdc2cd
Avoid SIM201 and SIM202 errors in __ne__ et al ( #2001 )
...
Closes #1986 .
2023-01-19 11:27:27 -05:00
Aarni Koskela
a0ea8fe22f
Apply #[derive(Default)] fixes suggested by Clippy ( #2000 )
...
These were bugging me every time I ran `clippy` 😁
2023-01-19 11:04:43 -05:00
Martin Fischer
3c3da8a88c
derive-msg-formats 5/5: Remove placeholder implementations
...
# This commit has been generated via the following Python script:
# (followed by `cargo +nightly fmt` and `cargo dev generate-all`)
# For the reasoning see the previous commit(s).
import re
import sys
for path in (
'src/violations.rs',
'src/rules/flake8_tidy_imports/banned_api.rs',
'src/rules/flake8_tidy_imports/relative_imports.rs',
):
with open(path) as f:
text = ''
while line := next(f, None):
if line.strip() != 'fn message(&self) -> String {':
text += line
continue
text += ' #[derive_message_formats]\n' + line
body = next(f)
while (line := next(f)) != ' }\n':
body += line
# body = re.sub(r'(?<!code\| |\.push\()format!', 'format!', body)
body = re.sub(
r'("[^"]+")\s*\.to_string\(\)', r'format!(\1)', body, re.DOTALL
)
body = re.sub(
r'(r#".+?"#)\s*\.to_string\(\)', r'format!(\1)', body, re.DOTALL
)
text += body + ' }\n'
while (line := next(f)).strip() != 'fn placeholder() -> Self {':
text += line
while (line := next(f)) != ' }\n':
pass
with open(path, 'w') as f:
f.write(text)
2023-01-19 11:03:32 -05:00
Martin Fischer
16e79c8db6
derive-msg-formats 4/5: Implement #[derive_message_formats]
...
The idea is nice and simple we replace:
fn placeholder() -> Self;
with
fn message_formats() -> &'static [&'static str];
So e.g. if a Violation implementation defines:
fn message(&self) -> String {
format!("Local variable `{name}` is assigned to but never used")
}
it would also have to define:
fn message_formats() -> &'static [&'static str] {
&["Local variable `{name}` is assigned to but never used"]
}
Since we however obviously do not want to duplicate all of our format
strings we simply introduce a new procedural macro attribute
#[derive_message_formats] that can be added to the message method
declaration in order to automatically derive the message_formats
implementation.
This commit implements the macro. The following and final commit
updates violations.rs to use the macro. (The changes have been separated
because the next commit is autogenerated via a Python script.)
2023-01-19 11:03:32 -05:00
Martin Fischer
8f6d8e215c
derive-msg-formats 3/5: Introduce Violation::AUTOFIX associated constant
...
ruff_dev::generate_rules_table previously documented which rules are
autofixable via DiagnosticKind::fixable ... since the DiagnosticKind was
obtained via Rule::kind (and Violation::placeholder) which we both want
to get rid of we have to obtain the autofixability via another way.
This commit implements such another way by adding an AUTOFIX
associated constant to the Violation trait. The constant is of the type
Option<AutoFixkind>, AutofixKind is a new struct containing an
Availability enum { Sometimes, Always}, letting us additionally document
that some autofixes are only available sometimes (which previously
wasn't documented). We intentionally introduce this information in a
struct so that we can easily introduce further autofix metadata in the
future such as autofix applicability[1].
[1]: https://doc.rust-lang.org/stable/nightly-rustc/rustc_errors/enum.Applicability.html
2023-01-19 11:03:32 -05:00
Martin Fischer
8993baab01
derive-msg-formats 2/5: Remove DiagnosticKind::summary
...
While ruff displays the string returned by Violation::message in its
output for detected violations the messages displayed in the README
and in the `--explain <code>` output previously used the
DiagnosticKind::summary() function which for some verbose messages
provided shorter descriptions.
This commit removes DiagnosticKind::summary, and moves the more
extensive documentation into doc comments ... these are not displayed
yet to the user but doing that is very much planned.
2023-01-19 11:03:32 -05:00
Martin Fischer
2568627c4c
derive-msg-formats 1/5: Remove unnecessary usages of Rule::kind
...
This commit series removes the following associated
function from the Violation trait:
fn placeholder() -> Self;
ruff previously used this placeholder approach for the messages it
listed in the README and displayed when invoked with --explain <code>.
This approach is suboptimal for three reasons:
1. The placeholder implementations are completely boring code since they
just initialize the struct with some dummy values.
2. Displaying concrete error messages with arbitrary interpolated values
can be confusing for the user since they might not recognize that the
values are interpolated.
3. Some violations have varying format strings depending on the
violation which could not be documented with the previous approach
(while we could have changed the signature to return Vec<Self> this
would still very much suffer from the previous two points).
We therefore drop Violation::placeholder in favor of a new macro-based
approach, explained in commit 4/5.
Violation::placeholder is only invoked via Rule::kind, so we firstly
have to get rid of all Rule::kind invocations ... this commit starts
removing the trivial cases.
2023-01-19 11:03:32 -05:00
Martin Fischer
9603a024b3
refactor: Move a bunch of pandas-vet logic to rules::pandas_vet
2023-01-19 11:03:32 -05:00
Charlie Marsh
a122d95ef5
Preserve unmatched comparators in SIM109 ( #1998 )
...
Closes #1993 .
2023-01-19 10:23:20 -05:00
Damien Allen
6ddfe50ac4
Added pylint formatter ( #1995 )
...
Fixes : #1953
@charliermarsh thank you for the tips in the issue.
I'm not very familiar with Rust, so please excuse if my string formatting syntax is messy.
In terms of testing, I compared output of `flake8 --format=pylint ` and `cargo run --format=pylint` on the same code and the output syntax seems to check out.
2023-01-19 08:01:27 -05:00
Martin Fischer
26901a78c9
Make define_rule_mapping! set rule code as doc comment of variants
...
Since the UI still relies on the rule codes this improves the developer
experience by letting developers view the code of a Rule enum variant by
hovering over it.
2023-01-19 07:37:16 -05:00
Martin Fischer
6649225167
rule 8/8: Automatically rewrite RuleCode to Rule
...
# This commit was automatically generated by running the following
# script (followed by `cargo +nightly fmt`):
import glob
import re
from typing import NamedTuple
class Rule(NamedTuple):
code: str
name: str
path: str
def rules() -> list[Rule]:
"""Returns all the rules defined in `src/registry.rs`."""
file = open('src/registry.rs')
rules = []
while next(file) != 'ruff_macros::define_rule_mapping!(\n':
continue
while (line := next(file)) != ');\n':
line = line.strip().rstrip(',')
if line.startswith('//'):
continue
code, path = line.split(' => ')
name = path.rsplit('::')[-1]
rules.append(Rule(code, name, path))
return rules
code2name = {r.code: r.name for r in rules()}
for pattern in ('src/**/*.rs', 'ruff_cli/**/*.rs', 'ruff_dev/**/*.rs', 'scripts/add_*.py'):
for name in glob.glob(pattern, recursive=True):
with open(name) as f:
text = f.read()
text = re.sub('Rule(?:Code)?::([A-Z]\w+)', lambda m: 'Rule::' + code2name[m.group(1)], text)
text = re.sub(r'(?<!"<FilePattern>:<)RuleCode\b', 'Rule', text)
text = re.sub('(use crate::registry::{.*, Rule), Rule(.*)', r'\1\2', text) # fix duplicate import
with open(name, 'w') as f:
f.write(text)
2023-01-18 23:51:48 -05:00
Martin Fischer
9e3083aa2c
rule 7/8: Change Rule enum definition
2023-01-18 23:51:48 -05:00
Martin Fischer
6d11ff3822
rule 6/8: Remove Serialize & Deserialize impls for Rule
2023-01-18 23:51:48 -05:00
Martin Fischer
6cf770a692
rule 5/8: Remove FromStr impl for Rule
2023-01-18 23:51:48 -05:00
Martin Fischer
3534e370e1
rule 4/8: Remove Display impl for Rule
2023-01-18 23:51:48 -05:00
Martin Fischer
dbcab5128c
rule 3/8: Remove AsRef<str> impl for Rule
2023-01-18 23:51:48 -05:00
Martin Fischer
3810250bb6
rule 2/8: Rename DiagnosticKind::code to rule
2023-01-18 23:51:48 -05:00
Martin Fischer
3c1c1e1dd3
rule 1/8: Rename RuleCode to Rule (backwards-compatible for now)
...
This commit series refactors ruff to decouple "rules" from "rule codes",
in order to:
1. Make our code more readable by changing e.g.
RuleCode::UP004 to Rule::UselessObjectInheritance.
2. Let us cleanly map multiple codes to one rule, for example:
[UP004] in pyupgrade, [R0205] in pylint and [PIE792] in flake8-pie
all refer to the rule UselessObjectInheritance but ruff currently
only associates that rule with the UP004 code (since the
implementation was initially modeled after pyupgrade).
3. Let us cleanly map one code to multiple rules, for example:
[C0103] from pylint encompasses N801, N802 and N803 from pep8-naming.
The latter two steps are not yet implemented by this commit series
but this refactoring enables us to introduce such a mapping. Such a
mapping would also let us expand flake8_to_ruff to support e.g. pylint.
After the next commit which just does some renaming the following four
commits remove all trait derivations from the Rule (previously RuleCode)
enum that depend on the variant names to guarantee that they are not
used anywhere anymore so that we can rename all of these variants in the
eigth and final commit without breaking anything.
While the plan very much is to also surface these human-friendly names
more in the user interface this is not yet done in this commit series,
which does not change anything about the UI: it's purely a refactor.
[UP004]: pyupgrade doesn't actually assign codes to its messages.
[R0205]: https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/useless-object-inheritance.html
[PIE792]: https://github.com/sbdchd/flake8-pie#pie792-no-inherit-object
[C0103]: https://pylint.pycqa.org/en/latest/user_guide/messages/convention/invalid-name.html
2023-01-18 23:51:48 -05:00
Martin Fischer
5b7bd93b91
refactor: Use Self:: in match arms
2023-01-18 23:51:48 -05:00
Martin Fischer
9e096b4a4c
refactor: Make define_rule_mapping! generate RuleCodePrefix directly
2023-01-18 23:51:48 -05:00
Charlie Marsh
d8645acd1f
Bump version to 0.0.226
2023-01-18 20:54:38 -05:00
Charlie Marsh
92dd073191
Add Pylint settings to lib_wasm.rs
2023-01-18 20:54:03 -05:00
Charlie Marsh
ff96219e62
Exclude None, Bool, and Ellipsis from ConstantType ( #1988 )
...
These have no effect, so it's confusing that they're even settable.
2023-01-18 20:50:09 -05:00
Charlie Marsh
d33424ec9d
Enable suppression of magic values by type ( #1987 )
...
Closes #1949 .
2023-01-18 20:44:24 -05:00
Charlie Marsh
34412a0a01
Avoid removing side effects for boolean simplifications ( #1984 )
...
Closes #1978 .
2023-01-18 19:08:14 -05:00
Charlie Marsh
ceb48d3a32
Use relative paths for INP001 ( #1981 )
2023-01-18 18:45:47 -05:00
Charlie Marsh
969a6f0d53
Replace misplaced-comparison-constant with SIM300 ( #1980 )
...
Closes : #1954 .
2023-01-18 18:42:49 -05:00
Charlie Marsh
7628876ff2
Invert order of yoda-conditions message ( #1979 )
...
The suggestion was wrong!
2023-01-18 18:27:36 -05:00
Charlie Marsh
ef355e5c2c
Remove artificial wraps from GitHub messages ( #1977 )
2023-01-18 18:20:56 -05:00
Charlie Marsh
97f55b8e97
Convert remaining call path sites to use SmallVec ( #1972 )
2023-01-18 14:50:33 -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
Anders Kaseorg
1e803f7108
README: Link “Flake8” for consistency with the rest of the list ( #1969 )
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 13:07:21 -05:00
Charlie Marsh
1ab0273aa7
Strip whitespace when injecting D209 newline ( #1967 )
...
Closes #1963 .
2023-01-18 12:09:17 -05:00
Charlie Marsh
5a7d8c25f4
Treat subscript accesses as unsafe effects for autofix ( #1966 )
...
See: #1809 .
2023-01-18 11:46:12 -05:00
Charlie Marsh
26d6414558
Fix UP003 check from rebase
2023-01-18 11:39:39 -05:00
Charlie Marsh
dae95626ae
Use smallvec for call path representation ( #1960 )
...
This provides a ~10% speed-up for large codebases with `--select ALL`:

2023-01-18 11:29:05 -05:00
Maksudul Haque
9a3e525930
[isort] Add no-lines-before Option ( #1955 )
...
Closes https://github.com/charliermarsh/ruff/issues/1916 .
2023-01-18 11:09:47 -05:00
Anders Kaseorg
b9c6cfc0ab
Autofix SIM117 (MultipleWithStatements) ( #1961 )
...
This is slightly buggy due to Instagram/LibCST#855 ; it will complain `[ERROR] Failed to fix nested with: Failed to extract CST from source` when trying to fix nested parenthesized `with` statements lacking trailing commas. But presumably people who write parenthesized `with` statements already knew that they don’t need to nest them.
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 11:06:04 -05:00
Charlie Marsh
b1f10c8339
Confine type-of-primitive checks to builtin type calls ( #1962 )
...
Closes #1958 .
2023-01-18 10:53:50 -05:00
Anders Kaseorg
83346de6e0
Autofix SIM102 (NestedIfStatements)
...
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 07:37:27 -05:00
Anders Kaseorg
b23cc31863
Change ast::helpers::has_coments to accept a Range
...
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 07:37:27 -05:00
Anders Kaseorg
462d81beb7
Ensure ast::whitespace::indentation extracts whitespace
...
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 07:37:27 -05:00
Anders Kaseorg
715ea2d374
Accept a Locator for ast::whitespace::indentation
...
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 07:37:27 -05:00
skykasko
6c7e60b4f9
Fix bad link for flake8-no-pep420 ( #1952 )
...
See https://github.com/charliermarsh/ruff/pull/1942 .
2023-01-18 07:36:05 -05:00
Maksudul Haque
868d0b3e29
[isort] Add constants and variables Options ( #1951 )
...
closes https://github.com/charliermarsh/ruff/issues/1819
2023-01-18 07:30:51 -05:00
Charlie Marsh
cdb4700813
Bump version to 0.0.225
2023-01-18 00:22:48 -05:00
Anders Kaseorg
ea4d54a90f
Restrict SIM105 to try blocks with a body of one simple statement ( #1948 )
...
If a `try` block has multiple statements, a compound statement, or
control flow, rewriting it with `contextlib.suppress` would obfuscate
the fact that the exception still short-circuits further statements in
the block.
Fixes #1947 .
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-18 00:22:22 -05:00
Charlie Marsh
51b917cfbf
Exempt contextlib.ExitStack() for SIM115 rules ( #1946 )
...
Since our binding tracking is somewhat limited, I opted to favor false negatives over false positives. So, e.g., this won't trigger SIM115:
```py
with contextlib.ExitStack():
f = exit_stack.enter_context(open("filename"))
```
(Notice that `exit_stack` is unbound.)
The alternative strategy required us to incorrectly trigger SIM115 on this:
```py
with contextlib.ExitStack() as exit_stack:
exit_stack_ = exit_stack
f = exit_stack_.enter_context(open("filename"))
```
Closes #1945 .
2023-01-17 22:39:54 -05:00
Edgar R. M
c880d744fd
Implement flake8-no-pep420 ( #1942 )
...
Closes https://github.com/charliermarsh/ruff/issues/1844 .
2023-01-17 22:10:32 -05:00
Charlie Marsh
84d1df08be
Avoid broken autofix for SIM103 with elif ( #1944 )
...
Also adjusts the generator to avoid the extra parentheses (and skips commented `if` statements).
Closes #1943 .
2023-01-17 22:03:17 -05:00
Charlie Marsh
b9bb5acff8
Remove unnecessary setuptools block
2023-01-17 21:17:37 -05:00
Charlie Marsh
ca7c3c2175
Avoid autofixing comma rules when --fix is not set ( #1940 )
...
Closes #1939 .
2023-01-17 20:09:01 -05:00
Charlie Marsh
8891e2e62b
Fix name of ruff-pre-commit event
2023-01-17 17:25:02 -05:00
Martin Fischer
53265e0ed4
cli: Catch panics to tell the user to report them ( #1928 )
2023-01-17 17:17:09 -05:00
Charlie Marsh
072849a8a9
Move @functools.cache rewrites to their own rule ( #1938 )
...
Closes #1934 .
2023-01-17 15:12:40 -05:00
Charlie Marsh
70ea4b25e8
Allow duplicate enum values for enum.auto() ( #1933 )
...
Closes #1932 .
2023-01-17 11:14:11 -05:00
Martin Fischer
30e133f3d8
refactor: Declare defaults once in settings::defaults
2023-01-17 09:20:57 -05:00
Martin Fischer
aa812de07e
refactor: Implement Default for Settings
2023-01-17 09:20:57 -05:00
Martin Fischer
57ac6a8444
refactor: Make resolve_codes take IntoIterator instead of Iterator
2023-01-17 09:20:57 -05:00
Martin Fischer
a6566b1b34
refactor: Merge Settings.enabled and Settings.fixable
...
The Settings struct previously contained the fields:
pub enabled: HashableHashSet<RuleCode>,
pub fixable: HashableHashSet<RuleCode>,
This commit merges both fields into one by introducing a new
RuleTable type, wrapping HashableHashMap<RuleCode, bool>,
which has the following benefits:
1. It makes the invalid state that a rule is
disabled but fixable unrepresentable.
2. It encapsulates the implementation details of the table.
(It currently uses an FxHashMap but that may change.)
3. It results in more readable code.
settings.rules.enabled(rule)
settings.rules.should_fix(rule)
is more readable than:
settings.enabled.contains(rule)
settings.fixable.contains(rule)
2023-01-17 09:20:57 -05:00
Martin Fischer
580da1fa6b
refactor: Group Settings fields
2023-01-17 09:20:57 -05:00
Martin Fischer
b78b6f275e
refactor: Define origin names & URLs within doc comments
2023-01-17 07:44:40 -05:00
Martin Fischer
6868bb46f5
refactor: Get rid of Platform enum
2023-01-17 07:44:40 -05:00
Martin Fischer
601848d9a8
refactor: Rename RuleOrigin::title to RuleOrigin::name
2023-01-17 07:44:40 -05:00
Martin Fischer
f4da7635f0
Add missing url for flake8-import-conventions
2023-01-17 07:44:40 -05:00
Charlie Marsh
74a8a218f3
Bump version to 0.0.224
2023-01-16 23:43:14 -05:00
Colin Delahunty
1730f2a603
[pyupgrade] Automatically rewrite format-strings to f-strings ( #1905 )
2023-01-16 23:06:39 -05:00
Charlie Marsh
a4862857de
Update PIE796 fixture
2023-01-16 19:29:14 -05:00
Leonardo Esparis
6e88c60c46
Add flake8-pie PIE796: prefer-unique-enum ( #1923 )
...
I accept any suggestion. By the way, I have a doubt, I have checked and all flake8-pie plugins can be fixed by ruff, but is it necessary that this one is also fixed automatically ?
rel #1543
2023-01-16 19:27:34 -05:00
Charlie Marsh
2ed1f78873
Add benchmark scripts for no-IO ( #1925 )
2023-01-16 17:38:40 -05:00
Charlie Marsh
f3bf008aed
Avoid removing statements that contain side-effects ( #1920 )
...
Closes #1917 .
2023-01-16 14:45:02 -05:00
Charlie Marsh
3b4aaa53c1
Add some new testimonials ( #1921 )
2023-01-16 14:44:52 -05:00
Charlie Marsh
6abf71639f
Avoid syntax errors when fixing parenthesized unused variables ( #1919 )
...
Closes #1917 .
2023-01-16 14:27:41 -05:00
Charlie Marsh
c0845a8c28
Rewrite lru_cache to cache on Python 3.9+ ( #1918 )
...
Closes #1913 .
2023-01-16 13:14:27 -05:00
Paul Barrett
019ecc4add
Trigger update to pre-commit mirror after pypi publish ( #1910 )
2023-01-16 13:14:18 -05:00
Martin Fischer
f4cf48d885
refactor: Move rule-specific details out of mod.rs via type aliases
2023-01-16 11:27:24 -05:00
Martin Fischer
005f5d7911
refactor: Make flake8_tidy_imports::Settings derive Default
2023-01-16 11:27:24 -05:00
Martin Fischer
2fce580693
refactor: Move flake8_tidy_imports Settings to mod.rs
2023-01-16 11:27:24 -05:00
Martin Fischer
8862565a0f
refactor: Split ruff::rules::flake8_tidy_imports::rules
2023-01-16 11:27:24 -05:00
Martin Fischer
5bf6da0db7
refactor: Rename BannedRelativeImport to RelativeImports
...
The idea is to follow the Rust naming convention for lints[1]:
> the lint name should make sense when read as
> "allow lint-name" or "allow lint-name items"
Following that convention prefixing "Banned" is
redundant as it could be prefixed to any lint name.
[1]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
2023-01-16 11:27:24 -05:00
Martin Fischer
ee655c1a88
refactor: Rename BannedApi to ApiBan to distinguish it from the violation struct
2023-01-16 11:27:24 -05:00
Harutaka Kawamura
2236b4bd59
Add backticks to B904's message ( #1914 )
...
This PR adds backticks to B904's message to improve readability.
Without backticks:
<img width="1480" alt="image" src="https://user-images.githubusercontent.com/17039389/212682457-71f13de9-e3dd-4ead-a82b-98e5b60653c2.png ">
With backticks:
<img width="1480" alt="image" src="https://user-images.githubusercontent.com/17039389/212682775-36868401-b63e-47d1-ae25-b43b61866b6c.png ">
2023-01-16 11:12:43 -05:00
Charlie Marsh
fbf311f7d5
Add instructions for Pyupgrade benchmark
2023-01-16 03:21:31 -05:00
Martin Fischer
8c18b28bc4
Derive Hash instead of implementing it by hand
...
The caching mechanism of the CLI (ruff_cli::cache) relies on
ruff::settings::Settings implementing the Hash trait.
The ruff::settings::Settings struct previously couldn't automatically
derive the Hash implementation via the #[derive(Hash)] macro attribute
since some of its field types intentionally[1][2] don't implement Hash
(namely regex::Regex, globset::GlobMatcher and globset::GlobSet and
HashMap and HashSet from the standard library).
The code therefore previously implemented the Hash trait by hand for the
whole struct. Implementing Hash by hand for structs that are subject to
change is a bad idea since it's very easy to forget to update the Hash
implementation when adding a new field to the struct. And the Hash
implementation indeed was already incorrect by omitting several fields
from the hash.
This commit introduces wrapper types for Regex, GlobMatcher, GlobSet,
HashSet & HashMap that implement Hash so that we can still add
#[derive(Hash)] to the Settings struct, guaranteeing a correct hash
implementation.
[1]: https://github.com/rust-lang/regex/issues/364#issuecomment-301082076
[2]: The standard library doesn't impl<T: Hash + Ord> Hash for HashSet<T>
presumably since sorted() requires an allocation and Hash
implementations are generally expected to work without allocations.
2023-01-16 01:42:55 -05:00
Charlie Marsh
42031b8574
Re-run benchmark and update documentation ( #1907 )
...
Closes #269 .
2023-01-16 01:38:58 -05:00
Charlie Marsh
3a3a5fcd81
Remove -dev suffix from flake8_to_ruff
2023-01-15 22:45:14 -05:00
Charlie Marsh
e8577d5e26
Bump version to 0.0.223
2023-01-15 22:44:01 -05:00
Charlie Marsh
bcb1e6ba20
Add flake8-commas to the README
2023-01-15 22:43:29 -05:00
Charlie Marsh
15403522c1
Avoid triggering SIM117 for async with statements ( #1903 )
...
Actually, it looks like _none_ of the existing rules should be triggered on async `with` statements.
Closes #1902 .
2023-01-15 21:42:36 -05:00
messense
cb4f305ced
Lock stdout once when printing diagnostics ( #1901 )
...
https://doc.rust-lang.org/stable/std/io/struct.Stdout.html
> Each handle shares a global buffer of data to be written to the standard output stream.
> Access is also synchronized via a lock and
> explicit control over locking is available via the [`lock`](https://doc.rust-lang.org/stable/std/io/struct.Stdout.html#method.lock ) method.
2023-01-15 21:04:00 -05:00
Charlie Marsh
d71a615b18
Buffer diagnostic writes to stdout ( #1900 )
2023-01-15 19:34:15 -05:00
Charlie Marsh
dfc2a34878
Remove rogue println
2023-01-15 18:59:59 -05:00
Charlie Marsh
7608087776
Don't require docstrings for setters and deleters ( #1899 )
2023-01-15 18:57:38 -05:00
Charlie Marsh
228f033e15
Skip noqa checker if no diagnostics are found ( #1898 )
2023-01-15 18:53:00 -05:00
Martin Fischer
d75d6d7c7c
refactor: Split CliSettings from Settings
...
We want to automatically derive Hash for the library settings, which
requires us to split off all the settings unused by the library
(since these shouldn't affect the hash used by ruff_cli::cache).
2023-01-15 15:19:42 -05:00
Martin Fischer
ef80ab205c
Mark Settings::for_rule(s) as test-only
2023-01-15 15:19:42 -05:00
Ran Benita
d3041587ad
Implement flake8-commas ( #1872 )
...
Implements [flake8-commas](https://github.com/PyCQA/flake8-commas ). Fixes #1058 .
The plugin is mostly redundant with Black (and also deprecated upstream), but very useful for projects which can't/won't use an auto-formatter.
This linter works on tokens. Before porting to Rust, I cleaned up the Python code ([link](https://gist.github.com/bluetech/7c5dcbdec4a73dd5a74d4bc09c72b8b9 )) and made sure the tests pass. In the Rust version I tried to add explanatory comments, to the best of my understanding of the original logic.
Some changes I did make:
- Got rid of rule C814 - "missing trailing comma in Python 2". Ruff doesn't support Python 2.
- Merged rules C815 - "missing trailing comma in Python 3.5+" and C816 - "missing trailing comma in Python 3.6+" into C812 - "missing trailing comma". These Python versions are outdated, didn't think it was worth the complication.
- Added autofixes for C812 and C819.
Autofix is missing for C818 - "trailing comma on bare tuple prohibited". It needs to turn e.g. `x = 1,` into `x = (1, )`, it's a bit difficult to do with tokens only, so I skipped it for now.
I ran the rules on cpython/Lib and on a big internal code base and it works as intended (though I only sampled the diffs).
2023-01-15 14:03:32 -05:00
Harutaka Kawamura
8d912404b7
Use more precise error ranges for RET505~508 ( #1895 )
2023-01-15 13:54:24 -05:00
Tom Fryers
85bdb45eca
Improve magic value message wording ( #1892 )
...
The message previously specified 'number', but the error applies to more types.
2023-01-15 12:53:02 -05:00
messense
c7d0d26981
Update add plugin/rule scripts ( #1889 )
...
Adjusted some file locations and changed to use [`pathlib`](https://docs.python.org/3/library/pathlib.html ) instead of `os.path`.
2023-01-15 12:49:42 -05:00
Charlie Marsh
5c6753e69e
Remove some Clippy allows ( #1888 )
2023-01-15 02:32:36 -05:00
Charlie Marsh
3791ca721a
Add a dedicated token indexer for continuations and comments ( #1886 )
...
The primary motivation is that we can now robustly detect `\` continuations due to the addition of `Tok::NonLogicalNewline`. This PR generalizes the approach we took to comments (track all lines that contain any comments), and applies it to continuations too.
2023-01-15 01:57:31 -05:00
Charlie Marsh
2c644619e0
Convert confusable violations to named fields ( #1887 )
...
See: #1871 .
2023-01-15 01:56:18 -05:00
Martin Fischer
81996f1bcc
Convert define_rule_mapping! to a procedural macro
...
define_rule_mapping! was previously implemented as a declarative macro,
which was however partially relying on an origin_by_code! proc macro
because declarative macros cannot match on substrings of identifiers.
Currently all define_rule_mapping! lines look like the following:
TID251 => violations::BannedApi,
TID252 => violations::BannedRelativeImport,
We want to break up violations.rs, moving the violation definitions to
the respective rule modules. To do this we want to change the previous
lines to:
TID251 => rules::flake8_tidy_imports::banned_api::BannedApi,
TID252 => rules::flake8_tidy_imports::relative_imports::RelativeImport,
This however doesn't work because the define_rule_mapping! macro is
currently defined as:
($($code:ident => $mod:ident::$name:ident,)+) => { ... }
That is it only supported $module::$name but not longer paths with
multiple modules. While we could define `=> $path:path`[1] then we
could no longer access the last path segment, which we need because
we use it for the DiagnosticKind variant names. And
`$path:path::$last:ident` doesn't work either because it would be
ambiguous (Rust wouldn't know where the path ends ... so path fragments
have to be followed by some punctuation/keyword that may not be part of
paths). And we also cannot just introduce a procedural macro like
path_basename!(...) because the following is not valid Rust code:
enum Foo { foo!(...), }
(macros cannot be called in the place where you define variants.)
So we have to convert define_rule_mapping! into a proc macro in order to
support paths of arbitrary length and this commit implements that.
[1]: https://doc.rust-lang.org/reference/macros-by-example.html#metavariables
2023-01-15 01:54:57 -05:00
Charlie Marsh
e3cc918b93
Bump version to 0.0.222
2023-01-14 23:34:53 -05:00
Charlie Marsh
d864477876
Turn doc references into links ( #1878 )
2023-01-14 23:27:45 -05:00
Charlie Marsh
e1ced89624
Document breaking --max-complexity change
2023-01-14 23:22:38 -05:00
Martin Fischer
4470d7ba04
Make the CI check for broken links in the Rust docs ( #1883 )
2023-01-14 23:18:17 -05:00
Harutaka Kawamura
2a1601749f
Fix range of SIM201, 202, and 208 ( #1880 )
...
Before
```
resources/test/fixtures/flake8_simplify/SIM208.py:1:13: SIM208 Use `a` instead of `not (not a)`
|
1 | if not (not a): # SIM208
| ^ SIM208
|
= help: Replace with `a`
resources/test/fixtures/flake8_simplify/SIM208.py:4:14: SIM208 Use `a == b` instead of `not (not a == b)`
|
4 | if not (not (a == b)): # SIM208
| ^^^^^^ SIM208
|
= help: Replace with `a == b`
```
After
```
resources/test/fixtures/flake8_simplify/SIM208.py:1:4: SIM208 Use `a` instead of `not (not a)`
|
1 | if not (not a): # SIM208
| ^^^^^^^^^^^ SIM208
|
= help: Replace with `a`
resources/test/fixtures/flake8_simplify/SIM208.py:4:4: SIM208 Use `a == b` instead of `not (not a == b)`
|
4 | if not (not (a == b)): # SIM208
| ^^^^^^^^^^^^^^^^^^ SIM208
|
= help: Replace with `a == b`
```
2023-01-14 21:17:32 -05:00
Charlie Marsh
a01edad1c4
Remove --max-complexity from the CLI ( #1877 )
2023-01-14 18:27:23 -05:00
Martin Fischer
a81ac6705d
Make ruff::source_code::{Generator, Locator, Stylist} private
2023-01-14 18:23:59 -05:00
Martin Fischer
d77675f30d
Make ruff::{ast, autofix, directives, rustpython_helpers} private
2023-01-14 18:23:59 -05:00
Martin Fischer
fe7658199d
Make ruff::violations private
2023-01-14 18:23:59 -05:00
Martin Fischer
cfa25ea4b0
Make ruff::rules private
2023-01-14 18:23:59 -05:00
Martin Fischer
c7f0f3b237
Regenerate insta snapshots
2023-01-14 11:48:02 -05:00
Martin Fischer
3b36030461
Introduce ruff::rules module
...
Resolves #1547 .
2023-01-14 11:48:02 -05:00
Charlie Marsh
812df77246
Add Dagster and SnowCLI
2023-01-14 10:45:16 -05:00
Martin Fischer
69b356e9b9
Add top-level doc comments for crates
...
Test by running:
cargo doc --no-deps --all --open
2023-01-14 10:11:30 -05:00
Martin Fischer
033d7d7e91
Disable doc generation for the ruff_cli binary
2023-01-14 10:11:30 -05:00
Martin Fischer
a181ca7a3d
Reduce the API of ruff_cli to ruff_cli::help()
2023-01-14 10:11:30 -05:00
Martin Fischer
92124001d5
Turn ruff_dev into a bin-only crate
2023-01-14 10:11:30 -05:00
Martin Fischer
06b389c5bc
Turn flake8_to_ruff into a bin-only crate
2023-01-14 10:11:30 -05:00
Thomas MK
9dc66b5a65
Split up the table corresponding to the pylint rules ( #1868 )
...
This makes it easier to see which rules you're enabling when selecting
one of the pylint codes (like `PLC`). This also makes it clearer what
those abbreviations stand for. When I first saw the pylint section, I
was very confused by that, so other might be as well.
See it rendered here:
https://github.com/thomkeh/ruff/blob/patch-1/README.md#pylint-plc-ple-plr-plw
2023-01-14 08:07:02 -05:00
Ran Benita
3447dd3615
Bump RustPython ( #1836 )
...
This bumps RustPython so we can use the new `NonLogicalNewline` token.
A couple of rules needed a fix due to the new token. There might be more
that are not caught by tests (anything working with tokens directly with
lookaheads), I hope not.
2023-01-14 08:03:27 -05:00
Harutaka Kawamura
42cb106377
Improve SIM117 ( #1867 )
...
This PR makes the following changes to improve `SIM117`:
- Avoid emitting `SIM117` multiple times within the same `with`
statement:
- Adjust the error range.
## Example
```python
with A() as a: # SIM117
with B() as b:
with C() as c:
print("hello")
```
### Current
```
resources/test/fixtures/flake8_simplify/SIM117.py:5:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
|
5 | / with A() as a: # SIM117
6 | | with B() as b:
7 | | with C() as c:
8 | | print("hello")
| |__________________________^ SIM117
|
resources/test/fixtures/flake8_simplify/SIM117.py:6:5: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
|
6 | with B() as b:
| _____^
7 | | with C() as c:
8 | | print("hello")
| |__________________________^ SIM117
|
```
### Improved
```
resources/test/fixtures/flake8_simplify/SIM117.py:5:1: SIM117 Use a single `with` statement with multiple contexts instead of nested `with` statements
|
5 | / with A() as a: # SIM117
6 | | with B() as b:
7 | | with C() as c:
| |______________________^ SIM117
|
```
Signed-off-by: harupy <hkawamura0130@gmail.com >
2023-01-14 07:59:24 -05:00
Charlie Marsh
027382f891
Add support for namespace packages ( #1859 )
...
Closes #1817 .
2023-01-14 07:31:57 -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
27fe4873f2
Fix placement of update feature flag
2023-01-13 23:46:32 -05:00
Charlie Marsh
ee6c81d02a
Bump version to 0.0.221
2023-01-13 23:33:15 -05:00
Charlie Marsh
59542344e2
Avoid unnecessary allocations for module names ( #1863 )
2023-01-13 23:26:34 -05:00
Martin Fischer
7b1ce72f86
Actually fix wasm-pack build command ( #1862 )
...
I initially attempted to run `wasm-pack build -p ruff` which gave the
error message:
Error: crate directory is missing a `Cargo.toml` file; is `-p` the wrong
directory?
I interpreted that as wasm-pack looking for the "ruff" directory because
I specified -p ruff, however actually the wasm-pack build usage is:
wasm-pack build [FLAGS] [OPTIONS] <path> <cargo-build-options>
And I was missing the `<path>` argument. So this actually wasn't at all
a bug in wasm-pack but just a confusing error message. And the symlink
hack I introduced in the previous commit didn't actually work ... I only
accidentally omitted the `-p` when testing (which ended up as `ruff`
being the <path> argument) ... CLIs are fun.
2023-01-13 23:20:20 -05:00
Martin Fischer
156e09536e
Add workaround for wasm-pack bug to fix the playground CI ( #1861 )
...
Fixes #1860 .
2023-01-13 22:46:51 -05:00
Charlie Marsh
22341c4ae4
Move repology down
2023-01-13 22:29:26 -05:00
Colin Delahunty
e4993bd7e2
Added ALE ( #1857 )
...
Fixes the sub issue I brought up in #1829 .
2023-01-13 21:39:51 -05:00
Martin Fischer
82aff5f9ec
Split off ruff_cli crate from ruff library
...
This lets you test the ruff linters or use the ruff library
without having to compile the ~100 additional dependencies
that are needed by the CLI.
Because we set the following in the [workspace] section of Cargo.toml:
default-members = [".", "ruff_cli"]
`cargo run` still runs the CLI and `cargo test` still tests
the code in src/ as well as the code in the new ruff_cli crate.
(But you can now also run `cargo test -p ruff` to only test the linters.)
2023-01-13 21:37:54 -05:00
Charlie Marsh
403a004e03
Refactor import-tracking to leverage existing AST bindings ( #1856 )
...
This PR refactors our import-tracking logic to leverage our existing
logic for tracking bindings. It's both a significant simplification, a
significant improvement (as we can now track reassignments), and closes
out a bunch of subtle bugs.
Though the AST tracks all bindings (e.g., when parsing `import os as
foo`, we bind the name `foo` to a `BindingKind::Importation` that points
to the `os` module), when I went to implement import tracking (e.g., to
ensure that if the user references `List`, it's actually `typing.List`),
I added a parallel system specifically for this use-case.
That was a mistake, for a few reasons:
1. It didn't track reassignments, so if you had `from typing import
List`, but `List` was later overridden, we'd still consider any
reference to `List` to be `typing.List`.
2. It required a bunch of extra logic, include complex logic to try and
optimize the lookups, since it's such a hot codepath.
3. There were a few bugs in the implementation that were just hard to
correct under the existing abstractions (e.g., if you did `from typing
import Optional as Foo`, then we'd treat any reference to `Foo` _or_
`Optional` as `typing.Optional` (even though, in that case, `Optional`
was really unbound).
The new implementation goes through our existing binding tracking: when
we get a reference, we find the appropriate binding given the current
scope stack, and normalize it back to its original target.
Closes #1690 .
Closes #1790 .
2023-01-13 20:39:54 -05:00
Charlie Marsh
0b92849996
Improve spacing preservation for C405 fixes ( #1855 )
...
We now preserve the spacing of the more common form:
```py
set((
1,
))
```
Rather than the less common form:
```py
set(
(1,)
)
```
2023-01-13 13:11:08 -05:00
Charlie Marsh
12440ede9c
Remove non-magic trailing comma from tuple ( #1854 )
...
Closes #1821 .
2023-01-13 12:56:42 -05:00
max0x53
fc3f722df5
Implement PLR0133 (ComparisonOfConstants) ( #1841 )
...
This PR adds [Pylint
`R0133`](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/comparison-of-constants.html )
Feel free to suggest changes and additions, I have tried to maintain
parity with the Pylint implementation
[`comparison_checker.py`](https://github.com/PyCQA/pylint/blob/main/pylint/checkers/base/comparison_checker.py#L247 )
See #970
2023-01-13 12:14:35 -05:00
Maksudul Haque
84ef7a0171
[isort] Add classes Config Option ( #1849 )
...
ref https://github.com/charliermarsh/ruff/issues/1819
2023-01-13 12:13:01 -05:00
Nicola Soranzo
66b1d09362
Clarify that some flake8-bugbear opinionated rules are already implemented ( #1847 )
...
E.g. B904 and B905.
2023-01-13 11:49:05 -05:00
Maksudul Haque
3ae01db226
[flake8-bugbear] Fix False Positives for B024 & B027 ( #1851 )
...
closes https://github.com/charliermarsh/ruff/issues/1848
2023-01-13 11:46:17 -05:00
Charlie Marsh
048e5774e8
Use absolute paths for --stdin-filename matching ( #1843 )
...
Non-basename glob matches (e.g., for `--per-file-ignores`) assume that
the path has been converted to an absolute path. (We do this for
filenames as part of the directory traversal.) For filenames passed via
stdin, though, we're missing this conversion. So `--per-file-ignores`
that rely on the _basename_ worked as expected, but directory paths did
not.
Closes #1840 .
2023-01-12 21:01:05 -05:00
max0x53
b47e8e6770
Implement PLR2004 (MagicValueComparison) ( #1828 )
...
This PR adds [Pylint
`R2004`](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/magic-value-comparison.html#magic-value-comparison-r2004 )
Feel free to suggest changes and additions, I have tried to maintain
parity with the Pylint implementation
[`magic_value.py`](https://github.com/PyCQA/pylint/blob/main/pylint/extensions/magic_value.py )
See #970
2023-01-12 19:44:18 -05:00
Jan Katins
ef17c82998
Document the way extend-ignore/select are applied ( #1839 )
...
Closes: https://github.com/charliermarsh/ruff/issues/1838
2023-01-12 19:44:03 -05:00
Charlie Marsh
9aeb5df5fe
Bump version to 0.0.220
2023-01-12 17:57:04 -05:00
Charlie Marsh
7ffba7b552
Use absolute paths for GitHub and Gitlab annotations ( #1837 )
...
Note that the _annotation path_ is absolute, while the path encoded in
the message remains relative.

Closes #1835 .
2023-01-12 17:54:34 -05:00
Charlie Marsh
06473bb1b5
Support for-else loops in SIM110 and SIM111 ( #1834 )
...
This PR adds support for `SIM110` and `SIM111` simplifications of the
form:
```py
def f():
# SIM110
for x in iterable:
if check(x):
return True
else:
return False
```
2023-01-12 17:04:58 -05:00
Ash Berlin-Taylor
bf5c048502
Airflow is now using ruff ( #1833 )
...
😀
2023-01-12 16:50:01 -05:00
Charlie Marsh
eaed08ae79
Skip SIM110/SIM111 fixes that create long lines
2023-01-12 16:21:54 -05:00
Charlie Marsh
e0fdc4c5e8
Avoid SIM110/SIM110 errors with else statements ( #1832 )
...
Closes #1831 .
2023-01-12 16:17:27 -05:00
Charlie Marsh
590bec57f4
Fix typo in relative-imports-order option name
2023-01-12 15:57:58 -05:00
Charlie Marsh
3110d342c7
Implement isort's reverse_relative setting ( #1826 )
...
This PR implements `reverse-relative`, from isort, but renames it to
`relative-imports-order` with the respected value `closest-to-furthest`
and `furthest-to-closest`, and the latter being the default.
Closes #1813 .
2023-01-12 15:48:40 -05:00
nefrob
39aae28eb4
📝 Update readme example for adding isort required imports ( #1824 )
...
Fixes use of isort name to the ruff name.
2023-01-12 13:18:06 -05:00
Charlie Marsh
dcccfe2591
Avoid parsing pyproject.toml files when settings are fixed ( #1827 )
...
Apart from being wasteful, this can also cause problems (see the linked
issue).
Resolves #1812 .
2023-01-12 13:15:44 -05:00
Martin Fischer
38f5e8f423
Decouple linter module from cache module
2023-01-12 13:09:59 -05:00
Martin Fischer
74f14182ea
Decouple resolver module from cli::Overrides
2023-01-12 13:09:59 -05:00
Charlie Marsh
bbc1e7804e
Don't trigger SIM401 for complex default values ( #1825 )
...
Resolves #1809 .
2023-01-12 12:51:23 -05:00
messense
c6320b29e4
Implement autofix for flake8-quotes ( #1810 )
...
Resolves #1789
2023-01-12 12:42:28 -05:00
Maksudul Haque
1a90408e8c
[flake8-bandit] Add Rule for S701 (jinja2 autoescape false) ( #1815 )
...
ref: https://github.com/charliermarsh/ruff/issues/1646
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-12 11:59:20 -05:00
Jeroen Van Goey
07134c50c8
Add usage of ruff in pandas to README ( #1811 )
...
pandas now uses ruff for linting, see
https://github.com/pandas-dev/pandas/pull/50160
2023-01-12 10:55:21 -05:00
Charlie Marsh
b36d4a15b0
Modify visibility and shuffle around some modules ( #1807 )
2023-01-11 23:57:05 -05:00
Charlie Marsh
d8162ce79d
Bump version to 0.0.219
2023-01-11 23:46:01 -05:00
Charlie Marsh
e11ef54bda
Improve globset documentation and help message ( #1808 )
...
Closes #1545 .
2023-01-11 23:41:56 -05:00
messense
9a07b0623e
Move top level ruff into python folder ( #1806 )
...
https://maturin.rs/project_layout.html#mixed-rustpython-project
Resolves #1805
2023-01-11 23:12:55 -05:00
Charlie Marsh
f450e2e79d
Implement doc line length enforcement ( #1804 )
...
This PR implements `W505` (`DocLineTooLong`), which is similar to `E501`
(`LineTooLong`) but confined to doc lines.
I based the "doc line" definition on pycodestyle, which defines a doc
line as a standalone comment or string statement. Our definition is a
bit more liberal, since we consider any string statement a doc line
(even if it's part of a multi-line statement) -- but that seems fine to
me.
Note that, unusually, this rule requires custom extraction from both the
token stream (to find standalone comments) and the AST (to find string
statements).
Closes #1784 .
2023-01-11 22:32:14 -05:00
Colin Delahunty
329946f162
Avoid erroneous Q002 error message for single-quote docstrings ( #1777 )
...
Fixes #1775 . Before implementing your solution I thought of a slightly
simpler one. However, it will let this function pass:
```
def double_inside_single(a):
'Double inside "single "'
```
If we want function to pass, my implementation works. But if we do not,
then I can go with how you suggested I implemented this (I left how I
would begin to handle it commented out). The bottom of the flake8-quotes
documentation seems to suggest that this should pass:
https://pypi.org/project/flake8-quotes/
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-11 20:01:54 -05:00
Charlie Marsh
588399e415
Fix Clippy error
2023-01-11 19:59:00 -05:00
Chammika Mannakkara
4523885268
flake8_simplify : SIM401 ( #1778 )
...
Ref #998
- Implements SIM401 with fix
- Added tests
Notes:
- only recognize simple ExprKind::Name variables in expr patterns for
now
- bug-fix from reference implementation: check 3-conditions (dict-key,
target-variable, dict-name) to be equal, `flake8_simplify` only test
first two (only first in second pattern)
2023-01-11 19:51:37 -05:00
Maksudul Haque
de81b0cd38
[flake8-simplify] Add Rule for SIM115 (Use context handler for opening files) ( #1782 )
...
ref: https://github.com/charliermarsh/ruff/issues/998
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-11 19:28:05 -05:00
Charlie Marsh
4fce296e3f
Skip SIM108 violations for complex if-statements ( #1802 )
...
We now skip SIM108 violations if: the resulting statement would exceed
the user-specified line length, or the `if` statement contains comments.
Closes #1719 .
Closes #1766 .
2023-01-11 19:21:30 -05:00
Charlie Marsh
9d48d7bbd1
Skip unused argument checks for magic methods ( #1801 )
...
We still check `__init__`, `__call__`, and `__new__`.
Closes #1796 .
2023-01-11 19:02:20 -05:00
Charlie Marsh
c56f263618
Avoid flagging builtins for OSError rewrites ( #1800 )
...
Related to (but does not fix) #1790 .
2023-01-11 18:49:25 -05:00
Grzegorz Bokota
fb2382fbc3
Update readme to reflect #1763 ( #1780 )
...
When checking changes in the 0.0.218 release I noticed that auto fixing
PT004 and PT005 was disabled but this change was not reflected in
README. So I create this small PR to do this.
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-11 18:37:41 -05:00
Charlie Marsh
c92a5a8704
Avoid rewriting flake8-comprehensions expressions for builtin overrides ( #1799 )
...
Closes #1788 .
2023-01-11 18:33:55 -05:00
Charlie Marsh
d7cf3147b7
Refactor flake8-comprehensions rules to take fewer arguments ( #1797 )
2023-01-11 18:21:18 -05:00
Charlie Marsh
bf4d35c705
Convert flake8-comprehensions checks to Checker style ( #1795 )
2023-01-11 18:11:20 -05:00
Charlie Marsh
4e97e9c7cf
Improve PIE794 autofix behavior ( #1794 )
...
We now: (1) trigger PIE794 for objects without bases (not sure why this
was omitted before); and (2) remove the entire line, rather than leaving
behind trailing whitespace.
Resolves #1787 .
2023-01-11 18:01:29 -05:00
Charlie Marsh
a3fcc3b28d
Disable update check by default ( #1786 )
...
This has received enough criticism that I'm comfortable making it
opt-in.
2023-01-11 13:47:40 -05:00
Charlie Marsh
cfbd068dd5
Bump version to 0.0.218
2023-01-10 21:28:23 -05:00
Charlie Marsh
8aed23fe0a
Avoid B023 false-positives for some common builtins ( #1776 )
...
This is based on the upstream work in
https://github.com/PyCQA/flake8-bugbear/pull/303 and
https://github.com/PyCQA/flake8-bugbear/pull/305/files .
Resolves #1686 .
2023-01-10 21:23:48 -05:00
Colin Delahunty
c016c41c71
Pyupgrade: Format specifiers ( #1594 )
...
A part of #827 . Posting this for visibility. Still has some work to do
to be done.
Things that still need done before this is ready:
- [x] Does not work when the item is being assigned to a variable
- [x] Does not work if being used in a function call
- [x] Fix incorrectly removed calls in the function
- [x] Has not been tested with pyupgrade negative test cases
Tests from pyupgrade can be seen here:
https://github.com/asottile/pyupgrade/blob/main/tests/features/format_literals_test.py
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-10 20:21:04 -05:00
Charlie Marsh
f1a5e53f06
Enable isort-style required-imports enforcement ( #1762 )
...
In isort, this is called `add-imports`, but I prefer the declarative
name.
The idea is that by adding the following to your `pyproject.toml`, you
can ensure that the import is included in all files:
```toml
[tool.ruff.isort]
required-imports = ["from __future__ import annotations"]
```
I mostly reverse-engineered isort's logic for making decisions, though I
made some slight tweaks that I think are preferable. A few comments:
- Like isort, we don't enforce this on empty files (like empty
`__init__.py`).
- Like isort, we require that the import is at the top-level.
- isort will skip any docstrings, and any comments on the first three
lines (I think, based on testing). Ruff places the import after the last
docstring or comment in the file preamble (that is: after the last
docstring or comment that comes before the _first_ non-docstring and
non-comment).
Resolves #1700 .
2023-01-10 18:12:57 -05:00
Charlie Marsh
1e94e0221f
Disable doctests ( #1772 )
...
We don't have any doctests, but `cargo test --all` spends more than half
the time on doctests? A little confusing, but this brings the test time
from > 4s to < 2s on my machine.
2023-01-10 15:10:16 -05:00
Martin Fischer
543865c96b
Generate RuleCode::origin() via macro ( #1770 )
2023-01-10 13:20:43 -05:00
Maksudul Haque
b8e3f0bc13
[flake8-bandit] Add Rule for S508 (snmp insecure version) & S509 (snmp weak cryptography) ( #1771 )
...
ref: https://github.com/charliermarsh/ruff/issues/1646
Co-authored-by: messense <messense@icloud.com >
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-10 13:13:54 -05:00
Charlie Marsh
643cedb200
Move CONTRIBUTING.md to top-level ( #1768 )
2023-01-10 07:38:12 -05:00
Charlie Marsh
91620c378a
Disable release builds on CI ( #1761 )
2023-01-10 07:33:03 -05:00
Harutaka Kawamura
b732135795
Do not autofix PT004 and PT005 ( #1763 )
...
As @edgarrmondragon commented in
https://github.com/charliermarsh/ruff/pull/1740#issuecomment-1376230550 ,
just renaming fixture doesn't work.
2023-01-10 07:24:16 -05:00
messense
9384a081f9
Implement flake8-simplify SIM112 ( #1764 )
...
Ref #998
2023-01-10 07:24:01 -05:00
Charlie Marsh
edab268d50
Bump version to 0.0.217
2023-01-09 23:26:22 -05:00
Charlie Marsh
e4fad70a57
Update documentation to match latest terminology ( #1760 )
...
Closes #1759 .
2023-01-09 21:10:47 -05:00
Charlie Marsh
1a09fff991
Update rule-generation scripts to match latest conventions ( #1758 )
...
Resolves #1755 .
2023-01-09 19:55:46 -05:00
Charlie Marsh
b85105d2ec
Add a helper for any-like operations ( #1757 )
2023-01-09 19:34:33 -05:00
Charlie Marsh
f7ac28a935
Omit sys.version_info and sys.platform checks from ternary rule ( #1756 )
...
Resolves #1753 .
2023-01-09 19:22:34 -05:00
Charlie Marsh
9532f342a6
Enable project-specific typing module re-exports ( #1754 )
...
Resolves #1744 .
2023-01-09 18:17:50 -05:00
Mohamed Daahir
0ee37aa0aa
Cache build artifacts using Swatinem/rust-cache@v1 ( #1750 )
...
This GitHub Action caches build artifacts in addition to dependencies
which halves the CI duration time.
Resolves #1752 .
2023-01-09 15:35:32 -05:00
Charlie Marsh
8a26c8b4e0
Fix wasm builds
2023-01-09 12:58:07 -05:00
Charlie Marsh
2cb59b0f45
Use dedicated warnings for flake8-to-ruff ( #1748 )
2023-01-09 12:48:06 -05:00
Charlie Marsh
2729f3d207
Add support for defining extra builtins ( #1747 )
...
Resolves #1745 .
2023-01-09 12:24:28 -05:00
Charlie Marsh
59155ce9f6
Rename checks and plugins to rules ( #1739 )
2023-01-09 01:39:51 -05:00
Charlie Marsh
caf6c65de7
Bump version to 0.0.216
2023-01-09 01:14:28 -05:00
Matt Oberle
147d594b38
Add isort.force-sort-within-sections setting ( #1635 )
...
This commit is a first attempt at addressing issue #1003 .
The default `isort` behavior is `force-sort-within-sections = false`,
which places `from X import Y` statements after `import X` statements.
When `force-sort-within-sections = true` all imports are sorted by
module name.
When module names are equivalent, the `import` statement comes before
the `from` statement.
2023-01-09 01:06:48 -05:00
Charlie Marsh
f18078a1eb
Allow unused arguments for empty methods with docstrings ( #1742 )
...
Resolves #1741 .
2023-01-09 00:34:07 -05:00
Harutaka Kawamura
fe4eb13601
Autofix PT004, PT005, PT024, and PT025 ( #1740 )
2023-01-08 22:41:00 -05:00
Charlie Marsh
161ab05533
Rename more local usages of check to diagnostic ( #1738 )
2023-01-08 18:10:08 -05:00
Charlie Marsh
2c537e24cc
Move violation structs out of registry.rs ( #1728 )
2023-01-08 17:54:20 -05:00
Charlie Marsh
0fe349b5f8
Rename CheckCategory to RuleOrigin ( #1726 )
2023-01-08 17:50:18 -05:00
Charlie Marsh
09dc3c7225
Rename Check to Diagnostic ( #1725 )
...
Along with:
- `CheckKind` -> `DiagnosticKind`
- `CheckCode` -> `RuleCode`
- `CheckCodePrefix` -> `RuleCodePrefix`
2023-01-08 17:46:20 -05:00
Harutaka Kawamura
498134b7ee
Audit unittest assert methods ( #1736 )
...
I ran the following code in Python 3.10 to automatically generate a list
of enums.
```python
import unittest
print(
",\n".join(
sorted(
m.removeprefix("assert") if m != "assert_" else "Underscore"
for m in dir(unittest.TestCase)
if m.startswith("assert")
)
)
)
```
2023-01-08 16:21:34 -05:00
Charlie Marsh
0152814a00
Bump version to 0.0.215
2023-01-07 22:17:29 -05:00
Harutaka Kawamura
0b3fab256b
Remove assertNotContains ( #1729 )
...
`unittest.TestCase` doens't have a method named `assertNotContains`.
2023-01-07 22:15:48 -05:00
Chammika Mannakkara
212ce4d331
buf-fix: flake8_simplify SIM212 ( #1732 )
...
bug-fix in #1717
Use the correct `IfExprWithTwistedArms` struct.
2023-01-07 22:03:48 -05:00
Charlie Marsh
491b1e4968
Move RUFF_CACHE_DIR to Clap's env support ( #1733 )
2023-01-07 22:01:27 -05:00
Charlie Marsh
8b01b53d89
Move RUFF_CACHE_DIR to Clap's env support ( #1733 )
2023-01-07 22:01:20 -05:00
messense
f9a5867d3e
Add RUFF_FORMAT environment variable support ( #1731 )
...
Resolves #1716
2023-01-07 21:54:19 -05:00
Harutaka Kawamura
4149627f19
Add more unittest assert methods to PT009 ( #1730 )
2023-01-07 21:52:48 -05:00
Charlie Marsh
7d24146df7
Implement --isolated CLI flag ( #1727 )
...
Closes #1724 .
2023-01-07 18:43:58 -05:00
Charlie Marsh
1c6ef3666c
Treat failures to fix TypedDict conversions as debug logs ( #1723 )
...
This also allows us to flag the error, even if we can't fix it.
Closes #1212 .
2023-01-07 17:51:45 -05:00
Charlie Marsh
16d933fcf5
Respect isort:skip action comment ( #1722 )
...
Resolves : #1718 .
2023-01-07 17:30:18 -05:00
Charlie Marsh
a9cc56b2ac
Add ComparableExpr hierarchy for comparing expressions ( #1721 )
2023-01-07 17:29:21 -05:00
Charlie Marsh
4de6c26ff9
Automatically remove duplicate dictionary keys ( #1710 )
...
For now, to be safe, we're only removing keys with duplicate _values_.
See: #1647 .
2023-01-07 16:16:42 -05:00
Charlie Marsh
98856e05d6
Fix clippy errors
2023-01-07 15:49:59 -05:00
Charlie Marsh
edf46c06d0
Bump version to 0.0.214
2023-01-07 15:34:45 -05:00
Chammika Mannakkara
9cfce61f36
flake8_simplify : SIM210, SIM211, SIM212 ( #1717 )
2023-01-07 15:32:34 -05:00
Charlie Marsh
bdb9a4d1a7
Update CONTRIBUTING.md to point to violations.rs ( #1720 )
2023-01-07 15:20:21 -05:00
Martin Fischer
82e0c0ced6
structs 9/9: Run cargo test and cargo insta accept
2023-01-07 15:14:58 -05:00
Martin Fischer
6a723b50c7
structs 8/9: Run cargo fix and cargo fmt
2023-01-07 15:14:58 -05:00
Martin Fischer
6208eb7bbf
structs 7/9: Manually fix errors introduced in the previous commit
2023-01-07 15:14:58 -05:00
Martin Fischer
43db446dfa
structs 6/9: Automatically change CheckKind::* to violations::*
...
The changes in this commit were generated by running:
for f in $(find src -name '*.rs'); do sed -Ei 's/use crate::registry::.*;/\0use crate::violations;/g' $f; done
for f in $(find src -name '*.rs'); do sed -Ei 's/CheckKind::([A-Z])/violations::\1/g' $f; done
git checkout src/registry.rs src/lib.rs src/lib_wasm.rs src/violations.rs
cargo +nightly fmt
2023-01-07 15:14:58 -05:00
Martin Fischer
3c8fdbf107
structs 5/9: Make Check::new call into() on the passed kind
2023-01-07 15:14:58 -05:00
Martin Fischer
54fb47ea6a
structs 4/9: Implement define_rule_mapping!
2023-01-07 15:14:58 -05:00
Martin Fischer
efadfeda96
structs 3/9: Manually implement autofix_formatter for conditional autofixes
2023-01-07 15:14:58 -05:00
Martin Fischer
90198f7563
structs 2/9: Generate violations.rs from registry.rs
...
# The changes of this commit were generated using the following code:
# (followed by cargo +nightly fmt)
import re
import subprocess
import io
indent = ' ' * 4
def split_words(s):
return re.split(r'\b', s)
def checkkind_match_arms(f, strip_some=False):
bodies = {}
while (line := next(f).rstrip()) != indent * 2 + '}':
if line.lstrip().startswith('//'):
continue
if line.strip() == '':
continue
parts = line.split('=>', maxsplit=1)
if parts[0].strip() == '_':
break
left, body = parts
left = left.strip()
body = body.strip()
if body == '{':
body = ''
while (line := next(f).rstrip()) != indent * 3 + '}':
body += line + '\n'
else:
body = body.rstrip(',')
kind = split_words(left)[3]
if strip_some:
body = re.sub('\)$', '', re.sub(r'Some\(', '', body, 1).rstrip(), 1)
if ('(' in left and not '(..)' in left) or '{' in left:
body = (
'let '
+ left.replace('CheckKind::', '').replace('CheckCode::', '')
+ ' = self;\n'
+ body
)
bodies[kind] = body
return bodies
with open('src/registry.rs') as f:
orig_registry_code = f.read()
# simplify the parsing of multiline match arms
registry_code = subprocess.check_output(
['rustfmt', '+nightly', '--config', 'force_multiline_blocks=true'],
encoding='utf-8',
input=orig_registry_code,
)
f = io.StringIO(registry_code)
# 1. Parse the CheckCode enum
while next(f).strip() != 'pub enum CheckCode {':
pass
checkcode_lines = []
while (line := next(f).strip().rstrip(',')) != '}':
checkcode_lines.append(line)
# 2. Parse the CheckKind enum
while next(f).strip() != 'pub enum CheckKind {':
pass
struct_defs = {}
while (line := next(f).strip()) != '}':
if line.startswith('//'):
continue
line = line.rstrip(',')
line = re.sub(r'{', '{ pub ', line)
line = re.sub(r'\(', '(pub ', line)
line = re.sub(',', ', pub', line)
kind = split_words(line)[1]
struct_defs[kind] = 'pub struct ' + line + (';' * (line[-1] != '}'))
# 3. parse the kind() impl for CheckKind
while next(f).rstrip() != " pub fn kind(&self) -> CheckKind {":
pass
assert next(f).strip() == 'match self {'
placeholders = checkkind_match_arms(f)
# 4. parse the CheckKind -> CheckCode mapping
while next(f).strip() != "pub fn code(&self) -> &'static CheckCode {":
pass
assert next(f).strip() == 'match self {'
kind2code = {}
while (line := next(f).strip().rstrip(',')) != '}':
if line.startswith('//'):
continue
parts = re.split(r'\b', line)
kind2code[parts[3]] = parts[-2]
code2kind = {code: kind for kind, code in kind2code.items()}
# 5. parse the body() impl for CheckKind
while next(f).rstrip() != " pub fn body(&self) -> String {":
pass
assert next(f).strip() == 'match self {'
bodies = checkkind_match_arms(f)
# 6. find fixable
always_fixable = []
sometimes_fixable = []
while next(f).strip() != "// Always-fixable checks.":
pass
while (line := next(f).strip()) != '// Conditionally-fixable checks.':
always_fixable.append(split_words(line)[3])
while (line := next(f).strip()) != '// Non-fixable checks.':
sometimes_fixable.append(split_words(line)[3])
# 7. find autofix message
while next(f).rstrip() != indent + "pub fn commit(&self) -> Option<String> {":
pass
assert next(f).strip() == 'match self {'
autofix_msg = checkkind_match_arms(f, strip_some=True)
reg = '''\
macro_rules! define_rule_mapping {
($($code:ident => $mod:ident::$name:ident,)+) => {
// TODO: implement
};
}
define_rule_mapping!(
'''
for line in checkcode_lines:
if line.startswith('//'):
reg += indent + line + '\n'
continue
code = line
reg += indent + code + ' => violations::' + code2kind[code] + ',\n'
reg += ');\n\n'
with open('src/registry.rs', 'w') as f:
marker = '#[derive'
f.write(orig_registry_code.replace(marker, reg + marker, 1))
out = '''\
use itertools::Itertools;
use crate::define_violation;
use crate::flake8_debugger::types::DebuggerUsingType;
use crate::flake8_pytest_style::types::{ParametrizeNameType, ParametrizeValuesType, ParametrizeValuesRowType};
use crate::flake8_quotes::settings::Quote;
use crate::flake8_tidy_imports::settings::Strictness;
use crate::pyupgrade::types::Primitive;
use crate::registry::{
Branch, DeferralKeyword, EqCmpop, IsCmpop, LiteralType, MockReference, UnusedCodes,
};
use crate::violation::{AlwaysAutofixableViolation, Violation};
'''
for line in checkcode_lines:
if line.startswith('//'):
out += '\n' + line + '\n\n'
continue
code = line
kind = code2kind[code]
out += 'define_violation!(' + struct_defs[kind] + ');\n'
if kind in always_fixable:
out += f'impl AlwaysAutofixableViolation for {kind} {{\n'
else:
out += f'impl Violation for {kind} {{\n'
out += 'fn message(&self) -> String {'
out += bodies[kind]
out += '}'
if kind in always_fixable:
out += 'fn autofix_title(&self) -> String {'
out += autofix_msg[kind]
out += '}'
elif kind in sometimes_fixable:
out += 'fn autofix_title_formatter(&self) -> Option<fn(&Self) -> String> {'
out += 'todo!()'
out += '}'
out += 'fn placeholder() -> Self {'
out += placeholders[code].replace('CheckKind::', '')
out += '}'
out += '}\n\n'
with open('src/violations.rs', 'w') as f:
f.write(out)
with open('src/lib.rs', 'r') as f:
mod = f.read()
with open('src/lib.rs', 'w') as f:
marker = 'mod violation;'
f.write(mod.replace(marker, marker + '\nmod violations;'))
2023-01-07 15:14:58 -05:00
Martin Fischer
15084dff9d
structs 1/9: Manually preprocess registry.rs
2023-01-07 15:14:58 -05:00
Martin Fischer
eea1379a74
structs 0/9: Introduce Violation trait
...
For every available rule registry.rs currently defines:
1. A CheckCode variant to identify the rule.
2. A CheckKind variant to represent violations of the rule.
3. A mapping from the CheckCode variant to a placeholder CheckKind instance.
4. A mapping from the CheckKind variant to CheckCode.
5. A mapping from the CheckKind to a string description.
6. A mapping from the CheckKind to a boolean indicating if autofix is available.
7. A mapping from the CheckKind to a string describing the autofix if available.
Since registry.rs defines all of this for every single rule and
ruff has hundreds of rules, this results in the lines specific to
a particular rule to be hundreds of lines apart, making the code
cumbersome to read and edit.
This commit introduces a new Violation trait so that the rule-specific
details of the above steps 5.-7. can be defined next to the rule
implementation. The idea is that once all CheckCode/CheckKind variants
have been converted to this new approach then the steps 1.-4. in
registry.rs could simply be generated via a declarative macro, e.g:
define_rule_mapping!(
E501 => pycodestyle::LineTooLong,
...
);
(where `pycodestyle::LineTooLong` would be a struct that implements the
new Violation trait).
The define_rule_mapping! macro would then take care of generating the
CheckCode and CheckKind enums, as well as all of the implementations for
the previously mentioned mappings, by simply calling the methods of the
new Violation trait.
There is another nice benefit from this approach: We want to introduce
more thorough documentation for rules and we want the documentation of a
rule to be defined close by the implementation (so that it's easier to
check if they match and that they're less likely to become out of sync).
Since these new Violation structs can be defined close by the
implementation of a rule we can also use them as an anchor point for the
documentation of a rule by simply adding the documentation in the form
of a Rust doc comment to the struct.
2023-01-07 15:14:58 -05:00
Charlie Marsh
3e80c0d43e
Fix clippy errors
2023-01-07 12:53:36 -05:00
Harutaka Kawamura
76a366e05a
Trim trailing whitespace when extracting isort directives ( #1715 )
2023-01-07 12:39:31 -05:00
Harutaka Kawamura
07f72990a9
Implement autofix for PT009 ( #1713 )
2023-01-07 12:28:25 -05:00
messense
402feffe85
Implement flake8-simplify SIM103 ( #1712 )
...
Ref #998
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-07 07:33:24 -05:00
Harutaka Kawamura
5cdd7ccdb8
Use text in comment token ( #1714 )
...
https://github.com/RustPython/RustPython/pull/4426 has been merged. We
can simplify code using text in comment tokens.
2023-01-07 07:29:04 -05:00
Charlie Marsh
f1c3ebfe0f
Bump version to 0.0.213
2023-01-07 00:30:56 -05:00
Charlie Marsh
c7e4e41a7a
Revert "Include list of fixed files in stderr output ( #1701 )" ( #1711 )
...
This reverts commit 53ed52dc59 .
I want to get some feedback on this before I send it out.
2023-01-07 00:30:25 -05:00
Charlie Marsh
311a823a4a
Increase blackd wait time ( #1709 )
...
Resolves #1511 .
2023-01-06 23:08:25 -05:00
Harutaka Kawamura
8c836aeecf
Add more backticks to flake8-pytest-style error messages ( #1707 )
2023-01-06 22:55:24 -05:00
Charlie Marsh
3abd205f94
Lazily compute ranges for class and function bindings ( #1708 )
...
This has a fairly significant performance impact (~320ms to ~307ms on
the CPython benchmark).
2023-01-06 22:55:13 -05:00
Charlie Marsh
0527fb9335
Automatically remove unused variables ( #1683 )
...
Closes #1460 .
2023-01-06 22:06:04 -05:00
Harutaka Kawamura
d5256f89b6
Use trim_end when checking line continutation ( #1706 )
...
Just a minor optimization.
Signed-off-by: harupy <hkawamura0130@gmail.com >
2023-01-06 21:59:35 -05:00
Charlie Marsh
3f84746d66
Remove add_check methods ( #1705 )
2023-01-06 21:58:21 -05:00
Anders Kaseorg
c39f687fca
Switch SourceCodeGenerator.buffer from Vec<u8> to String ( #1702 )
...
This is the real issue underneath the `unsafe`/`unwrap` quandry in
#1677 .
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-06 20:26:23 -05:00
Anders Kaseorg
dd35e724dd
Forbid unsafe code ( #1704 )
...
We can reverse this later if it really becomes necessary, but I expect
safe Rust to be sufficient for all our needs.
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-06 20:25:59 -05:00
Anders Kaseorg
43599a9e78
Remove redundant #![allow()] from main_native ( #1703 )
...
`main_native.rs` is a module of `main.rs`, so the `#![allow()]`s in the
latter apply to the former automatically.
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-06 20:25:46 -05:00
Charlie Marsh
53ed52dc59
Include list of fixed files in stderr output ( #1701 )
...
This PR adds the list of fixed files to Ruff's output (send to `stderr`,
and omitted for `--silent` and `--quiet` settings):

Closes #1667 .
2023-01-06 19:51:11 -05:00
Charlie Marsh
24999019e0
Include error location in GitHub Action diagnostic messages ( #1696 )
...
This ensures that if you look at the GitHub Actions _logs_, you see the
entire message, including the location:

The downside is that the location gets repeated inline:

See: #1693 .
2023-01-06 15:58:16 -05:00
Charlie Marsh
12d2526edb
Require explicit opt-in for GitHub and Gitlab formats ( #1697 )
2023-01-06 15:57:56 -05:00
Charlie Marsh
81b812d94c
Delete unreferenced snapshot
2023-01-06 15:56:47 -05:00
Maksudul Haque
9409b49ea2
[flake8-bandit] Add Rule for S501 (request call with verify=False) ( #1695 )
...
ref: https://github.com/charliermarsh/ruff/issues/1646
2023-01-06 11:44:19 -05:00
Chammika Mannakkara
1392170dbf
Simplify SIM201, SIM202, SIM208 ( #1666 )
...
Flake8 simplify #998
SIM201, SIM202 and SIM208 is done here with fixes.
Note: SIM203 == E713
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-06 10:47:48 -05:00
messense
0a940b3cb4
Implement flake8-simplify SIM109 ( #1687 )
...
Ref #998
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-06 10:29:49 -05:00
Maksudul Haque
6aba43a9b0
[flake8-bandit] Add Rule for S113 (requests call without timeout) ( #1692 )
...
ref: https://github.com/charliermarsh/ruff/issues/1646
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-06 10:26:08 -05:00
Charlie Marsh
8a3a6a901a
Avoiding flagging elif statements as potential ternaries ( #1694 )
2023-01-06 10:20:45 -05:00
Charlie Marsh
18a301a214
Add specialized conversions for RefEquality ( #1689 )
2023-01-06 10:02:17 -05:00
Harutaka Kawamura
53157bc634
Remove TODO comment ( #1691 )
2023-01-06 10:02:07 -05:00
messense
76a9dc61f0
Implement flake8-simplify SIM108 ( #1684 )
...
Ref #998
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-06 08:28:51 -05:00
Maksudul Haque
16d7e13c72
Update CONTRIBUTING.md location on README.md ( #1688 )
2023-01-06 08:05:24 -05:00
Charlie Marsh
5ed58ae595
Add requested context to issue template ( #1679 )
2023-01-06 07:29:08 -05:00
Charlie Marsh
cecd4b166c
Don't mark D205 as fixable in more-lines case ( #1682 )
...
Closes #1672 .
2023-01-05 23:20:14 -05:00
Charlie Marsh
4ddcdd02d6
Tweak badge logo ( #1681 )
2023-01-05 23:07:21 -05:00
messense
43575da537
Replace toml with toml_edit ( #1680 )
...
The `toml` crate doesn't support TOML 1.0, but `toml_edit` does. While
there is a plan to [migrate `toml` to be on
`toml_edit`](https://github.com/toml-rs/toml/issues/340 ), it's not ready
yet and it's very easy to switch back to `toml` when it's ready.
2023-01-05 22:08:23 -05:00
Charlie Marsh
fe67a0d239
Implement From conversion for style detector-to-generator ( #1678 )
2023-01-05 21:47:48 -05:00
Charlie Marsh
8caa73df6a
Remove Result from SourceCodeGenerator signature ( #1677 )
...
We populate this buffer ourselves, so I believe it's fine for us to use
an unchecked UTF-8 cast here. It _dramatically_ simplifies so much
downstream code.
2023-01-05 21:41:26 -05:00
Charlie Marsh
ee4cae97d5
Bump version to 0.0.212
2023-01-05 21:25:42 -05:00
Anders Kaseorg
2e3787adff
Remove an unneeded .to_string() in tokenize_files_to_codes_mapping ( #1676 )
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-05 20:56:11 -05:00
Anders Kaseorg
81b211d1b7
Simplify Option<String> → Option<&str> conversion using as_deref ( #1675 )
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-05 20:55:59 -05:00
Anders Kaseorg
1ad72261f1
Replace &String with &str in AnnotatedImport::ImportFrom ( #1674 )
...
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2023-01-05 20:55:46 -05:00
Charlie Marsh
914287d31b
Fix format and lint errors
2023-01-05 20:30:01 -05:00
Charlie Marsh
75bb6ad456
Implement duplicate isinstance detection (SIM101) ( #1673 )
...
See: #998 .
2023-01-05 20:21:40 -05:00
Charlie Marsh
04111da3f3
Improve Pandas call and attribute detection ( #1671 )
...
This PR adds some guardrails to avoid common false positives in our
`pandas-vet` rules. Specifically, we now avoid triggering `pandas-vet`
rules if the target of the call or attribute (i.e., the `x` in
`x.stack(...)`) is unbound, or bound to something that couldn't be a
DataFrame (like an import that _isn't_ `pandas`, or a class definition).
This lets us avoid common false positives like `np.stack(...)`.
Resolves #1659 .
2023-01-05 19:30:54 -05:00
Charlie Marsh
2464cf6fe9
Fix some &String, &Option, and &Vec usages ( #1670 )
2023-01-05 18:56:03 -05:00
Charlie Marsh
d34e6c02a1
Allow overhang in Google-style docstring arguments ( #1668 )
...
Resolves #1662 .
2023-01-05 14:36:19 -05:00
Diego Palacios
e6611c4830
Fix flake8-import-conventions configuration examples ( #1660 )
2023-01-05 13:37:25 -05:00
Maksudul Haque
2d23b1ae69
[flake8-bandit] Add Rule for S506 (unsafe use of yaml load) ( #1664 )
...
See: https://github.com/charliermarsh/ruff/issues/1646 .
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-05 13:35:01 -05:00
Charlie Marsh
5eb03d5e09
Avoid false-positives for yields with non-identical references ( #1665 )
...
Resolves #1663 .
2023-01-05 12:14:15 -05:00
Maksudul Haque
9f8ef1737e
[flake8-bandit] Add Rule for S324 (Insecure hash functions in hashlib) ( #1661 )
...
ref: https://github.com/charliermarsh/ruff/issues/1646
2023-01-05 11:45:47 -05:00
messense
1991d618a3
Add proc-macro to derive CheckCodePrefix ( #1656 )
...
IMO a derive macro is a natural way to generate new code, and it reduces
the chance of merge conflicts.
2023-01-05 11:39:16 -05:00
Martin Fischer
2045b739a9
Stop highlighting --help output in README as shell ( #1655 )
...
This PR is meant to address the following obviously unintended GitHub
rendering:

2023-01-05 09:46:49 -05:00
Martin Fischer
53e3dd8548
Add ignore-overlong-task-comments setting
...
Imagine a .py file containing the following comment:
# TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
# do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Since `git grep` only matches individual lines `git grep TODO` would
only output the first line of the comment, cutting off potentially
important information. (git grep currently doesn't support multiline
grepping). Projects using such a workflow therefore probably format
the comment in a single line instead:
# TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
This commit introduces a setting to accomdate this workflow by making
the line-length checks (`E501`) optionally ignore overlong lines
if they start with a recognized task tag.
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-04 23:54:50 -05:00
Martin Fischer
78c9056173
Add pycodestyle::settings
...
This step is split up into a separate commit so
that the following commit has a cleaner diff.
2023-01-04 23:54:50 -05:00
Martin Fischer
8d56e412ef
Add task-tags setting
...
Programmers often leave comments to themselves and others such as:
# TODO: Use a faster algorithm?
The keywords used to prefix such comments are just a convention and vary
from project to project. Other common keywords include FIXME and HACK.
The keywords in use for the codebase are of interest to ruff because
ruff does also lint comments. For example the ERA lint detects
commented-out code but ignores comments starting with such a keyword.
Previously the ERA lint simply hardcoded the regular expression
TODO|FIXME|XXX to achieve that. This commit introduces a new `task-tags`
setting to make this configurable (and to allow other comment lints to
recognize the same set of keywords).
The term "task tags" has probably been popularized by the Eclipse
IDE.[1] For Python there has been the proposal PEP 350[2], which
referred to such keywords as "codetags". That proposal however has been
rejected. We are choosing the term "task tags" over "code tags" because
the former is more descriptive: a task tag describes a task.
While according to the PEP 350 such keywords are also sometimes used for
non-tasks e.g. NOBUG to describe a well-known problem that will never be
addressed due to design problems or domain limitations, such keywords
are so rare that we are neglecting them here in favor of more
descriptive terminology. The vast majority of such keywords does
describe tasks, so naming the setting "task-tags" is apt.
[1]: https://www.eclipse.org/pdt/help/html/task_tags.htm
[2]: https://peps.python.org/pep-0350/
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com >
2023-01-04 23:54:50 -05:00
Charlie Marsh
3400be18a6
Revert "Add task-tags & ignore-overlong-task-comments settings ( #1550 )"
...
This reverts commit ca48492137 .
2023-01-04 23:54:50 -05:00
Charlie Marsh
7b59cd2d32
Bump version to 0.0.211
2023-01-04 23:13:04 -05:00
Charlie Marsh
b8ed4d402a
Implement SIM110 and SIM111 (conversion to any and all) ( #1653 )
2023-01-04 23:08:12 -05:00
messense
46dcf3c4c0
Implement flake8-simplify SIM107 ( #1650 )
2023-01-04 23:02:25 -05:00
Charlie Marsh
ef7777703b
Run generation steps
2023-01-04 22:05:04 -05:00
messense
6a1edeb694
Cancel outdated in-progress workflow automatically ( #1652 )
2023-01-04 22:03:26 -05:00
Charlie Marsh
fb8024a6ac
Implement nested with detection (SIM117) ( #1651 )
2023-01-04 21:22:25 -05:00
Edgar R. M
2f71bdfbfc
Implement flake8-bandit rule S108 ( #1644 )
2023-01-04 21:11:13 -05:00
Charlie Marsh
30d6688c26
Implement nested-if detection ( #1649 )
2023-01-04 20:55:01 -05:00
Charlie Marsh
9041423b92
Move external licenses to separate directory ( #1648 )
2023-01-04 20:07:51 -05:00
Charlie Marsh
c91c435dc9
Fix URL in pyproject.toml
2023-01-04 19:23:40 -05:00
Charlie Marsh
5cb162bd7b
Add missing McCabe comment
2023-01-04 19:16:36 -05:00
Charlie Marsh
7339d7eccf
Implement builtin import removal ( #1645 )
2023-01-04 19:10:16 -05:00
Charlie Marsh
2ff816f108
DRY up unused import removal code ( #1643 )
2023-01-04 19:03:52 -05:00
Charlie Marsh
980d10b952
Add Ruff badge to README ( #1642 )
2023-01-04 17:27:01 -05:00
Charlie Marsh
6c5db1008d
Add badge JSON ( #1641 )
2023-01-04 17:24:27 -05:00
Martin Fischer
ca48492137
Add task-tags & ignore-overlong-task-comments settings ( #1550 )
2023-01-04 17:10:21 -05:00
Charlie Marsh
7c23701b62
Note a few more incompatibilities ( #1639 )
2023-01-04 16:05:15 -05:00
Charlie Marsh
8da2c4815a
Tweak Yoda condition message ( #1638 )
2023-01-04 15:58:01 -05:00
Charlie Marsh
34fec8cbd0
Rename flake8-bandit rules from plugins to checks ( #1637 )
2023-01-04 15:49:05 -05:00
Edgar R. M
1817f8752b
Implement flake8-bandit rule S103 ( #1636 )
2023-01-04 15:47:38 -05:00
Colin Delahunty
8b8e6e44ea
Adding my company to the "used in" category of the Readme. ( #1631 )
2023-01-04 12:31:18 -05:00
Harutaka Kawamura
12166584c4
Minor fixes for SIM105 ( #1633 )
2023-01-04 11:01:06 -05:00
Charlie Marsh
9ede902328
Run generate-all
2023-01-04 10:46:24 -05:00
messense
0df28bdd4e
Implement flake8-simplify SIM105 rule ( #1621 )
2023-01-04 08:10:59 -05:00
Charlie Marsh
8b07f9517a
Implement SIM220 and SIM221 ( #1630 )
2023-01-04 08:07:00 -05:00
Harutaka Kawamura
0a0e1926f2
Check SIM118 in comprehension ( #1627 )
2023-01-04 07:05:13 -05:00
Charlie Marsh
4473c7e905
Update stale references in CONTRIBUTING.md
2023-01-03 23:44:10 -05:00
Charlie Marsh
20930b3675
Add some more users to the README ( #1623 )
2023-01-03 23:06:08 -05:00
Colin Delahunty
fb1a638a96
Implement yield-to-yield from conversion ( #1544 )
2023-01-03 22:56:52 -05:00
Edgar R. M
16964409a8
Implement missing fixes for PT006 ( #1622 )
2023-01-03 22:52:51 -05:00
Charlie Marsh
aacfc9ee0b
Bump version to 0.0.210
2023-01-03 21:46:08 -05:00
Charlie Marsh
bd14f92898
Avoid byte-string conversions ( #1618 )
2023-01-03 21:45:14 -05:00
Charlie Marsh
cc116b0192
Treat convention as setting ignore, rather than select ( #1611 )
2023-01-03 21:27:53 -05:00
Charlie Marsh
0d27c0be27
Treat .pyi files as __future__ annotations-enabled ( #1616 )
2023-01-03 21:27:26 -05:00
Edgar R. M
60359c6adf
Fix leftover whitespace when removing pass for PIE790 ( #1612 )
2023-01-03 20:44:59 -05:00
Charlie Marsh
77692e4b5f
Associate inline comments with parenthesized ImportFrom statements ( #1609 )
2023-01-03 20:02:12 -05:00
Charlie Marsh
731f3a74a9
Fix *arg and **kwarg handling for Google docstrings ( #1608 )
2023-01-03 18:17:42 -05:00
Matt Oberle
03275c9c98
Add isort.order-by-type boolean setting ( #1607 )
2023-01-03 18:07:44 -05:00
Harutaka Kawamura
8d99e317b8
Implement autofix for PT022 ( #1604 )
2023-01-03 13:36:28 -05:00
Maksudul Haque
d4d67e3014
Do not Change Quotation Style for PT006 Autofix ( #1600 )
2023-01-03 10:16:49 -05:00
Charlie Marsh
e9a236f740
Bump version to 0.0.209
2023-01-03 08:27:28 -05:00
Ran Benita
ebb31dc29b
Fix PT006 autofix of parametrize name strings like ' first, , second ' ( #1591 )
2023-01-03 08:12:09 -05:00
Charlie Marsh
b9e92affb1
Avoid silently dropping code generator errors ( #1598 )
2023-01-03 08:11:18 -05:00
Charlie Marsh
68fbd0f029
Preserve style when generating flake8-simplify messages ( #1599 )
2023-01-03 08:05:55 -05:00
Charlie Marsh
8d01efb571
Avoid hard unwrap in PT checks ( #1597 )
2023-01-03 07:39:52 -05:00
Pedram Navid
da5a25b421
Add autofix for SIM300 ( #1588 )
2023-01-03 07:19:04 -05:00
Charlie Marsh
bfdab4ac94
Add flake8-pytest-style settings to hash ( #1595 )
2023-01-03 07:12:33 -05:00
jvstme
d1389894a4
Fix several typos in README ( #1590 )
2023-01-03 07:06:43 -05:00
Charlie Marsh
8b277138de
Bump version to 0.0.208
2023-01-02 23:19:03 -05:00
Charlie Marsh
e0fe34c523
Implement and-false and or-true rules ( #1586 )
2023-01-02 23:10:42 -05:00
Charlie Marsh
995fee5ddd
Increment flake8-pie implementation count
2023-01-02 22:47:05 -05:00
Charlie Marsh
99906c16db
Prefer GitHub icon on mobile ( #1585 )
2023-01-02 22:46:23 -05:00
Charlie Marsh
b6cb35414e
Swap accent color for playground ( #1584 )
2023-01-02 22:44:09 -05:00
Harutaka Kawamura
b351221049
Mark FStringMissingPlaceholders as fixable ( #1582 )
2023-01-02 22:41:40 -05:00
Charlie Marsh
afb6f55b8d
Add a link to GitHub from the playground ( #1583 )
2023-01-02 22:40:38 -05:00
Harutaka Kawamura
03a8ece954
Implement autofix for F541 ( #1577 )
2023-01-02 22:28:32 -05:00
Charlie Marsh
8aeec35bfb
Implement dupe-class-field-definitions ( #1581 )
2023-01-02 22:26:01 -05:00
Charlie Marsh
93259acb31
Implement unnecessary-pass-statement ( #1580 )
2023-01-02 22:15:24 -05:00
Charlie Marsh
ca7fe686d5
Add scripts to generate plugin and check boilerplate ( #1579 )
2023-01-02 22:10:31 -05:00
Charlie Marsh
5dd9e99a4b
Add flake8-pie plugin with prefer_list_builtin ( #1578 )
2023-01-02 21:47:38 -05:00
Charlie Marsh
8f0270acfe
Remove registry_gen.rs at root
2023-01-02 21:31:19 -05:00
Charlie Marsh
7ce38840a2
Re-run registry_gen.rs generation
2023-01-02 21:29:53 -05:00
Charlie Marsh
8ab8217ca5
Fix destination for registry_gen.rs
2023-01-02 21:29:08 -05:00
Charlie Marsh
5d3ff69053
Add comment annotations to plugin match
2023-01-02 20:49:30 -05:00
Charlie Marsh
726399b2b3
Move Ruff checks to the end of each list
2023-01-02 20:44:27 -05:00
Charlie Marsh
8329237f19
Warn user when D203 and D211 are enabled ( #1576 )
2023-01-02 19:54:55 -05:00
Oliver Margetts
cd5882c66d
Remove need for vendored format/cformat code ( #1573 )
2023-01-02 19:37:31 -05:00
Charlie Marsh
0c05488740
Automatically set baseline D codes based on convention ( #1574 )
2023-01-02 19:08:56 -05:00
Charlie Marsh
1425b21d93
Avoid invalid trailing comma fixes for mock rewrites ( #1570 )
2023-01-02 18:03:43 -05:00
Charlie Marsh
e5a59f41b0
Remove extend- from docstring configuration examples ( #1571 )
2023-01-02 17:53:41 -05:00
Charlie Marsh
8647bec3cb
Rename checks.rs to registry.rs ( #1566 )
2023-01-02 17:26:51 -05:00
Charlie Marsh
14042800c2
Remove common-path dependency ( #1565 )
2023-01-02 17:23:29 -05:00
Charlie Marsh
21986e89fd
Always check directly-passed-in files ( #1564 )
2023-01-02 16:49:44 -05:00
Edgar R. M
c4014ef2d3
Implement flake8-pytest-style ( #1506 )
2023-01-02 16:34:17 -05:00
Charlie Marsh
9ffd20707f
Avoid PEP 604 rewrites for runtime annotations ( #1563 )
2023-01-02 16:33:52 -05:00
Charlie Marsh
6d5aa344a1
Avoid merging import from statements with inline comments ( #1562 )
2023-01-02 16:24:41 -05:00
Colin Delahunty
e9be5fc7be
Add typo linter ( #1553 )
2023-01-02 15:57:59 -05:00
Charlie Marsh
f74050e5b1
Bump version to 0.0.207
2023-01-02 14:39:32 -05:00
Martin Fischer
90b2d85c85
Fix __init__.py being private ( #1556 )
...
Previously visibility::module_visibility() returned Private
for any module name starting with an underscore, resulting in
__init__.py being categorized as private, which in turn resulted
in D104 (Missing docstring in public package) never being reported
for __init__.py files.
2023-01-02 14:39:23 -05:00
Charlie Marsh
ccf848705d
Detect unpacking assignments in eradicate ( #1559 )
2023-01-02 14:05:58 -05:00
Charlie Marsh
3b535fcc74
Add explicit new-rule recommendation in CONTRIBUTING.md ( #1558 )
2023-01-02 13:50:11 -05:00
Víctor
06321fd240
Add usage clarification to README ( #1557 )
2023-01-02 13:40:16 -05:00
Martin Fischer
cdae2f0e67
Fix typing::match_annotated_subscript matching ExprKind::Call ( #1554 )
2023-01-02 12:13:45 -05:00
Martin Fischer
f52691a90a
Print warning when running debug builds without --no-cache ( #1549 )
2023-01-02 12:12:04 -05:00
Pedram Navid
07e47bef4b
Add flake8-simplify SIM300 check for Yoda Conditions ( #1539 )
2023-01-01 18:37:40 -05:00
Anders Kaseorg
86b61806a5
Correct UP027 message to “generator expression” ( #1540 )
2023-01-01 18:30:58 -05:00
Charlie Marsh
31ce37dd8e
Avoid PD false positives on some non-DataFrame expressions ( #1538 )
2023-01-01 17:05:57 -05:00
Charlie Marsh
2cf6d05586
Avoid triggering PD errors on method calls ( #1537 )
2023-01-01 17:00:17 -05:00
Colin Delahunty
65c34c56d6
Implement list-to-tuple comprehension unpacking ( #1534 )
2023-01-01 16:53:26 -05:00
Charlie Marsh
2315db7d13
Bump version to 0.0.206
2023-01-01 16:39:29 -05:00
Charlie Marsh
f1a183c171
Rewrite mock.mock attribute accesses ( #1533 )
2023-01-01 13:14:09 -05:00
Harutaka Kawamura
509c6d5ec7
Add visit_format_spec to avoid false positives for F541 in f-string format specifier ( #1528 )
2023-01-01 13:03:32 -05:00
Maksudul Haque
6695988b59
Do not Change Quotation Style for SIM118 Autofix ( #1529 )
2023-01-01 12:53:46 -05:00
Harutaka Kawamura
e3867b172d
Simplify unused snapshot check ( #1525 )
2023-01-01 02:43:07 -05:00
Harutaka Kawamura
4b8e30f350
Fix Name node range in NamedExpr node ( #1526 )
2023-01-01 02:41:49 -05:00
Charlie Marsh
8fd0d8e9d8
Bump pyupgrade implementation count
2022-12-31 21:25:34 -05:00
Colin Delahunty
70895a8f1e
Pyupgrade: import mock to from unittest import mock ( #1488 )
2022-12-31 21:25:06 -05:00
Charlie Marsh
f2c9f94f73
Avoid some false positives for ends-in-period checks ( #1521 )
2022-12-31 18:38:22 -05:00
Charlie Marsh
605c6069e2
Ignore property assignments in RET504 ( #1520 )
2022-12-31 18:04:13 -05:00
Charlie Marsh
92c2981b6d
Add dark mode variant for benchmark image ( #1519 )
2022-12-31 17:47:32 -05:00
Colin Delahunty
4ad8db3d61
Pyupgrade: Turn errors into OSError ( #1434 )
2022-12-31 16:36:05 -05:00
Charlie Marsh
0e8c237167
Bump version to 0.0.205
2022-12-31 13:44:39 -05:00
Harutaka Kawamura
960c5e2006
Use more precise error ranges for names ( #1513 )
2022-12-31 13:42:39 -05:00
Charlie Marsh
9ba17fbf92
Avoid flagging nested f-strings ( #1516 )
2022-12-31 13:41:21 -05:00
Charlie Marsh
bfdf972a5d
Add code kind to Quick Fix action
2022-12-31 10:26:47 -05:00
Charlie Marsh
0c215365ae
Bump version to 0.0.204
2022-12-31 08:20:09 -05:00
Maksudul Haque
815284f890
Check for Unsupported Files and Display Errors and Warnings ( #1509 )
2022-12-31 08:12:55 -05:00
Charlie Marsh
6880338a9a
Restore pyproject.toml
2022-12-31 08:06:08 -05:00
Charlie Marsh
68b749c67d
Remove foo directory
2022-12-31 08:05:04 -05:00
Reiner Gerecke
c0fc55b812
Generate source code with detected line ending ( #1487 )
2022-12-31 08:02:29 -05:00
Reiner Gerecke
ba9cf70917
Adjust test_path helper to detect round-trip autofix issues ( #1501 )
2022-12-31 08:02:13 -05:00
Harutaka Kawamura
f73dfbbfd3
Fix E722 and F707 ranges ( #1508 )
2022-12-31 07:58:46 -05:00
Reiner Gerecke
62c273cd22
Include fix commit message when showing violations together with source ( #1505 )
2022-12-31 07:54:41 -05:00
Harutaka Kawamura
938ad9a39e
Fix N818 range ( #1503 )
2022-12-31 07:43:03 -05:00
Harutaka Kawamura
14248cb8cb
Improve PLW0120 range ( #1500 )
2022-12-31 07:42:49 -05:00
Harutaka Kawamura
3a280039e1
Improve F811 range for function and class definitions ( #1499 )
2022-12-31 07:42:18 -05:00
Harutaka Kawamura
4e9e58bdc0
Improve T20X ranges ( #1502 )
2022-12-31 07:41:53 -05:00
Harutaka Kawamura
926b5494ad
Remove unused snapshots ( #1497 )
2022-12-31 07:40:38 -05:00
Reiner Gerecke
6717b48ca5
Fix detection of changed imports in isort plugin ( #1504 )
2022-12-31 07:37:27 -05:00
Harutaka Kawamura
f7bb5bc858
Remove F831 ( #1495 )
2022-12-30 23:57:51 -05:00
Harutaka Kawamura
3e23fd1487
Stop overriding locations for expressions within f-strings ( #1494 )
2022-12-30 23:43:59 -05:00
Charlie Marsh
01c74e0629
Add a "fix message" to every autofix-able check ( #1489 )
2022-12-30 23:16:03 -05:00
Charlie Marsh
1e3cf87f67
Escape strings when formatting check messages ( #1493 )
2022-12-30 22:11:01 -05:00
Charlie Marsh
248447e139
Trim CLI help during generation ( #1492 )
2022-12-30 22:03:58 -05:00
Charlie Marsh
95f139583a
Modify pyproject.toml to meet schema compliance
2022-12-30 15:51:35 -05:00
Charlie Marsh
74903f23d6
Bump version to 0.0.203
2022-12-30 15:33:30 -05:00
Charlie Marsh
3ee20a70d3
Remove lingering ruff_options.ts references
2022-12-30 15:33:09 -05:00
Charlie Marsh
4c2fbb7ac0
Remove hidden autoformat command ( #1486 )
2022-12-30 15:32:05 -05:00
Charlie Marsh
7a66f98590
Move some argument validation into Clap ( #1485 )
2022-12-30 15:29:41 -05:00
Charlie Marsh
a2bf3916f3
Make clean a standalone command
2022-12-30 15:20:18 -05:00
Reiner Gerecke
c9aa7b9308
Generate the README's --help output automatically via cargo +nightly dev generate-all ( #1483 )
2022-12-30 15:06:32 -05:00
Charlie Marsh
d880ca6cc6
Add a command to clear the Ruff cache ( #1484 )
2022-12-30 13:52:16 -05:00
Reiner Gerecke
080f99b908
Detect line endings and use them during code generation ( #1482 )
2022-12-30 12:59:40 -05:00
Charlie Marsh
a7dc491ff1
Fix clippy
2022-12-30 12:34:43 -05:00
Charlie Marsh
cdc8f8c91a
Remove support for ur prefixes ( #1481 )
2022-12-30 11:21:05 -05:00
Colin Delahunty
138c46e793
Simplified code for unicode fix ( #1475 )
2022-12-30 11:18:52 -05:00
Charlie Marsh
a86c57a832
Support multi-line noqa directives for 'import from' ( #1479 )
2022-12-30 11:16:50 -05:00
Charlie Marsh
818582fe8a
Bump version to 0.0.202
2022-12-30 08:16:32 -05:00
Charlie Marsh
90574c1088
Set editor background on top-level component ( #1478 )
2022-12-30 07:55:54 -05:00
Charlie Marsh
3061a35e7c
Use more precise ranges for class and function checks ( #1476 )
2022-12-30 07:39:20 -05:00
Martin Fischer
87681697ae
Improve CLI help for --select ( #1471 )
2022-12-30 07:16:44 -05:00
Martin Fischer
e9ec2a7b36
Add use test_case::test_case; to CONTRIBUTING.md
...
I previously tried adding the #[test_case()] attribute macro and got
confused because the Rust compilation suddenly failed with:
error[E0658]: use of unstable library feature 'custom_test_frameworks': custom test frameworks are an unstable feature
which is a quite confusing error message. The solution is to just add
`use test_case::test_case;`, so this commit adds that line to the
example in CONTRIBUTING.md to spare others this source of confusion.
2022-12-30 07:13:48 -05:00
Martin Fischer
b0bb75dc1c
Add --select to command suggested in CONTRIBUTING.md
...
By default only E* and F* lints are enabled. I previously followed the
CONTRIBUTING.md instructions to implement a TID* lint and was confused
why my lint wasn't being run.
2022-12-30 07:13:48 -05:00
Martin Fischer
ebca5c2df8
Make banned-api config setting optional ( #1465 )
2022-12-30 07:09:56 -05:00
Charlie Marsh
16b10c42f0
Fix lint issues
2022-12-29 23:12:28 -05:00
Charlie Marsh
4a6e5d1549
Bump version to 0.0.201
2022-12-29 23:01:35 -05:00
Charlie Marsh
b078050732
Implicit flake8-implicit-str-concat ( #1463 )
2022-12-29 23:00:55 -05:00
Charlie Marsh
5f796b39b4
Run cargo fmt
2022-12-29 22:25:14 -05:00
Martin Fischer
9d34da23bd
Implement TID251 (banning modules & module members) ( #1436 )
2022-12-29 22:11:12 -05:00
Charlie Marsh
bde12c3bb3
Restore quick fixes for playground
2022-12-29 20:16:19 -05:00
Colin Delahunty
f735660801
Removed unicode literals ( #1448 )
2022-12-29 20:11:33 -05:00
Charlie Marsh
34cd22dfc1
Copy URL but don't update the hash ( #1458 )
2022-12-29 19:46:50 -05:00
Charlie Marsh
9fafe16a55
Re-add GitHub badge to the bottom of the page
2022-12-29 19:38:33 -05:00
Charlie Marsh
e9a4cb1c1d
Remove generated TypeScript options ( #1456 )
2022-12-29 19:37:49 -05:00
Charlie Marsh
9db825c731
Use trailingComma: 'all' ( #1457 )
2022-12-29 19:36:51 -05:00
Charlie Marsh
2c7464604a
Implement dark mode ( #1455 )
2022-12-29 19:33:46 -05:00
Charlie Marsh
cd2099f772
Move default options into WASM interface ( #1453 )
2022-12-29 18:06:57 -05:00
Adam Turner
091d36cd30
Add Sphinx to user list ( #1451 )
2022-12-29 18:06:09 -05:00
Mathieu Kniewallner
02f156c6cb
docs(README): add missing flake8-simplify ( #1449 )
2022-12-29 17:02:26 -05:00
Charlie Marsh
9f7350961e
Rename config to settings in the playground ( #1450 )
2022-12-29 16:59:38 -05:00
Charlie Marsh
118a93260a
Bump version to 0.0.200
2022-12-29 13:31:23 -05:00
Charlie Marsh
1c16255884
Include docstrings for settings enum members ( #1446 )
2022-12-29 13:15:44 -05:00
Charlie Marsh
16c4552946
Update snapshots
2022-12-29 13:13:43 -05:00
Charlie Marsh
0ba3989b3d
Make update check enablement cofnigurable ( #1445 )
2022-12-29 13:06:22 -05:00
Charlie Marsh
3435e15cba
Avoid caching diffs ( #1441 )
2022-12-29 12:51:58 -05:00
Maksudul Haque
781bbbc286
[pygrep-hooks] Adds Check for Blanket # noqa ( #1440 )
2022-12-29 12:43:16 -05:00
Charlie Marsh
acf0b82f19
Re-style the Ruff playground ( #1438 )
2022-12-29 11:47:27 -05:00
Charlie Marsh
057414ddd4
Bump version to 0.0.199
2022-12-28 20:58:43 -05:00
Charlie Marsh
ca94e9aa26
Warn the user when max iteration count is reached ( #1433 )
2022-12-28 20:56:43 -05:00
Charlie Marsh
797b5bd261
Split into lint and lint-and-fix methods ( #1432 )
2022-12-28 20:14:33 -05:00
Charlie Marsh
a64f62f439
Revert setup.py change
2022-12-28 19:34:20 -05:00
Charlie Marsh
058ee8e6bf
Add a --diff flag to dry-run autofixes ( #1431 )
2022-12-28 19:21:29 -05:00
Charlie Marsh
39fc1f0c1b
Add a note on autofix settings
2022-12-28 17:26:38 -05:00
Colin Delahunty
34842b4c4b
PyUpgrade: Replace pipes with capture_output=True ( #1415 )
2022-12-28 16:53:35 -05:00
Charlie Marsh
dfa6fa8f83
Check in updated snapshots
2022-12-28 16:42:55 -05:00
Colin Delahunty
6131c819ed
Rewrite xml.etree.cElementTree to xml.etree.ElementTree ( #1426 )
2022-12-28 16:30:36 -05:00
Hannes Käufler
79ba420faa
Extract duplicated logic into method ( #1428 )
2022-12-28 16:10:53 -05:00
Charlie Marsh
d16ba890ae
Turn off wasm-pack tests ( #1427 )
2022-12-28 12:55:25 -05:00
Charlie Marsh
6b6851bf1f
Update JSON schema
2022-12-28 12:27:01 -05:00
Charlie Marsh
056718ce75
Remove stray Plugins doc
2022-12-28 12:24:48 -05:00
Charlie Marsh
4521fdf021
Only test --lib for wasm-pack
2022-12-28 10:28:40 -05:00
Maksudul Haque
8e479628f2
Add Support for GitLab CI Code Quality Report Format ( #1424 )
2022-12-28 10:10:43 -05:00
Charlie Marsh
2a11c4b1f1
Try increasing wasm-bindgen timeout
2022-12-28 07:39:23 -05:00
Anders Kaseorg
a8cde5a936
Check for keyword arguments before the last star argument ( #1420 )
2022-12-27 23:20:03 -05:00
Charlie Marsh
1822b57ed5
Remove 'static
2022-12-27 21:57:32 -05:00
Charlie Marsh
c679570041
Bump version to 0.0.198
2022-12-27 21:39:53 -05:00
Charlie Marsh
edcb3a7217
Support --select ALL to enable all error codes ( #1418 )
2022-12-27 21:38:26 -05:00
Charlie Marsh
6e43dc7270
Add nbQA support to the docs ( #1417 )
2022-12-27 21:24:07 -05:00
Charlie Marsh
570d0864f2
Add rule to detect keyword arguments before starred arguments ( #1416 )
2022-12-27 21:17:22 -05:00
Charlie Marsh
d22e96916c
Automatically detect and respect indentation and quotation code style ( #1413 )
2022-12-27 19:45:50 -05:00
Charlie Marsh
043d31dcdf
Bump version to 0.0.197
2022-12-27 17:05:15 -05:00
Charlie Marsh
1392e4cced
Default to double quotes in code_gen.rs ( #1412 )
2022-12-27 16:17:49 -05:00
Charlie Marsh
59ee89a091
Fix it_converts_docstring_conventions test
2022-12-27 15:41:29 -05:00
Charlie Marsh
6a7c3728ee
Set convention in flake8-to-ruff ( #1410 )
2022-12-27 13:51:24 -05:00
Charlie Marsh
0a60eb0aca
Fix invalid reference to ruff_options.rs ( #1409 )
2022-12-27 12:12:28 -05:00
Charlie Marsh
3e96803033
Bump version to 0.0.196
2022-12-27 12:02:02 -05:00
Colin Delahunty
c59035139c
Pyupgrade: converts universal_newlines to text in subprocess.run ( #1403 )
2022-12-27 12:01:27 -05:00
Charlie Marsh
7632d7eda7
Allow specification of explicit docstring convention ( #1408 )
2022-12-27 11:50:28 -05:00
Charlie Marsh
b4dbe62da0
Add cargo +nightly dev generate-all ( #1404 )
2022-12-27 10:07:18 -05:00
Harutaka Kawamura
9106d5338b
Replace make_tokenize with make_tokenizer_located ( #1405 )
2022-12-27 10:07:03 -05:00
Reiner Gerecke
534d8d049c
Support isort's force-single-line option ( #1366 )
2022-12-27 08:51:32 -05:00
Charlie Marsh
e692c4a2cc
Tweak secret detection for playground releases ( #1402 )
2022-12-27 08:41:53 -05:00
Reiner Gerecke
e0b39fa63e
Implement pyupgrade check for io.open alias ( #1399 )
2022-12-27 07:47:40 -05:00
Charlie Marsh
320a48977b
Tweak README again
2022-12-26 21:17:18 -05:00
Charlie Marsh
0d05aaeb6e
Add monorepo note
2022-12-26 21:00:14 -05:00
Charlie Marsh
1e4b1533ad
Bump version to 0.0.195
2022-12-26 20:41:39 -05:00
Charlie Marsh
df4f5358f9
Bump pyupgrade implementation count
2022-12-26 19:56:12 -05:00
Colin Delahunty
58c383401c
Replace typing.Text with str ( #1391 )
2022-12-26 19:55:41 -05:00
Charlie Marsh
018b9a2977
Only run playground release in main repo ( #1396 )
2022-12-26 19:45:04 -05:00
Charlie Marsh
658cb87ddd
Enable Quick Fix in the playground ( #1395 )
2022-12-26 19:25:50 -05:00
Charlie Marsh
0d35087bc6
Choose a more interesting example snippet ( #1394 )
2022-12-26 15:19:17 -05:00
Charlie Marsh
b721125af9
Add badge to playground ( #1393 )
2022-12-26 15:13:55 -05:00
Charlie Marsh
20d6b21d77
Add ESLint, Prettier, and TypeScript checks ( #1384 )
2022-12-26 15:08:22 -05:00
Charlie Marsh
1a27992f47
Enable preview deployments for playground ( #1383 )
2022-12-26 14:52:13 -05:00
Charlie Marsh
89cebe1ce2
Update name of Playground job
2022-12-26 12:10:22 -05:00
Reiner Gerecke
bdb1505262
Web playground with WASM ( #1279 )
2022-12-26 12:09:17 -05:00
Charlie Marsh
8c018e8261
Add settings validation to lib.rs
2022-12-26 10:12:07 -05:00
Colin Delahunty
debd909b2c
Magic Trailing Commas in isort ( #1363 )
2022-12-26 09:40:02 -05:00
Reiner Gerecke
fa54538bd1
Only re-associate inline comments during normalization when necessary ( #1380 )
2022-12-26 07:52:13 -05:00
Reiner Gerecke
939f738a71
Update rust python to handle files with BOM ( #1379 )
2022-12-26 07:03:13 -05:00
Charlie Marsh
b0f30bef8f
Add support for ruff.toml ( #1378 )
2022-12-25 21:55:07 -05:00
Charlie Marsh
28c45eb2a3
Remove required versions from pyproject.toml
2022-12-25 20:21:01 -05:00
Charlie Marsh
4dc45912e8
Run cargo dev commands
2022-12-25 20:12:12 -05:00
Charlie Marsh
5ef8bff341
Bump version to 0.0.194
2022-12-25 19:54:45 -05:00
Charlie Marsh
2ab8f77223
Update command-line help text
2022-12-25 19:54:14 -05:00
Charlie Marsh
8b72f55a09
Add --required-version ( #1376 )
2022-12-25 19:53:50 -05:00
Charlie Marsh
19121219fb
Avoid double-extending past the end when showing source ( #1377 )
2022-12-25 19:52:42 -05:00
Charlie Marsh
d9355c989a
Add a --fix-only command-line and pyproject.toml option ( #1375 )
2022-12-25 18:49:56 -05:00
Charlie Marsh
ec80d1cd85
Respect natural ordering for imports ( #1374 )
2022-12-25 18:11:41 -05:00
Charlie Marsh
9bb470c7d4
Ignore unused arguments for @overload stubs ( #1373 )
2022-12-25 17:22:31 -05:00
Harutaka Kawamura
dca3fcd8d1
Improve excepthandler_name_range ( #1368 )
2022-12-25 00:12:12 -05:00
Harutaka Kawamura
10f75c9620
Fix F841 (UnusedVariable) range in except handler ( #1367 )
2022-12-24 22:55:55 -05:00
Charlie Marsh
cc2110449c
Run cargo dev commands
2022-12-24 15:06:12 -05:00
Charlie Marsh
f6ca49e05f
Bump version to 0.0.193
2022-12-24 14:56:26 -05:00
Charlie Marsh
9a7331b2e2
Annotate RUF100 messages with unmatched, disabled, and unknown codes ( #1365 )
2022-12-24 14:55:55 -05:00
Edgar R. M
4888afd423
Generate JSON schema for Ruff options ( #1329 )
2022-12-24 14:10:22 -05:00
Sawbez
0dc523b081
Add autofix for W605 [InvalidEscapeSequence] ( #1361 )
2022-12-24 13:46:28 -05:00
Harutaka Kawamura
63772e335d
Fix B025 location ( #1360 )
2022-12-24 12:22:11 -05:00
Reiner Gerecke
7f4ff1e38f
Fix false-positive in RET504 when referencing globals ( #1358 )
2022-12-24 12:02:57 -05:00
Reiner Gerecke
32ebc1d227
Don't trigger E721 when comparing with None ( #1356 )
2022-12-24 04:45:40 -05:00
Sawbez
4ded155dc0
Add autofix for W292 [NoNewLineAtEndOfFile] ( #1354 )
2022-12-23 23:14:17 -05:00
Harutaka Kawamura
201e1250de
Update RustPython to use the correct BinOp location ( #1355 )
2022-12-23 22:58:39 -05:00
Reiner Gerecke
102b049a32
Add cache-dir to command-line and pyproject.toml ( #1351 )
2022-12-23 22:58:29 -05:00
Charlie Marsh
74f49eda64
Bump compatibility to 3.11 ( #1352 )
2022-12-23 12:12:11 -05:00
Reiner Gerecke
9da3e2cca1
Implement "native literals" check from pyupgrade ( #1350 )
2022-12-23 11:40:32 -05:00
Charlie Marsh
e290050821
Avoid enabling all EM checks at once ( #1349 )
2022-12-23 08:25:07 -05:00
Charlie Marsh
bc9ed0a4ef
Tweak LSP docs
2022-12-22 22:16:32 -05:00
Charlie Marsh
20b9b44973
Link to ruff-lsp docs
2022-12-22 21:53:11 -05:00
Charlie Marsh
6e5a553235
Update Neovim instructions
2022-12-22 21:52:30 -05:00
Charlie Marsh
2a08a63f17
Add a link to the PyCharm plugin ( #1345 )
2022-12-22 21:50:24 -05:00
Colin Delahunty
d4290e6721
Update CONTRIBUTING.md ( #1344 )
2022-12-22 21:04:19 -05:00
Charlie Marsh
51bda28a7d
Bump version to 0.0.192
2022-12-22 17:31:31 -05:00
Reiner Gerecke
cc26051b7a
Implement "datetime.UTC alias" check from pyupgrade ( #1341 )
2022-12-22 17:21:36 -05:00
Charlie Marsh
3ac5a9aa31
Respect --force-exclude for files passed via stdin ( #1342 )
2022-12-22 16:40:15 -05:00
Charlie Marsh
451047c30d
Exclude directly-passed files nested in excluded subdirectories
2022-12-22 15:08:11 -05:00
Charlie Marsh
6907df489b
Extend false-positive list for flake8-boolean-trap ( #1338 )
2022-12-22 10:56:04 -05:00
Charlie Marsh
970f882b03
Set force-exclude for pre-commit in README ( #1337 )
2022-12-22 10:51:20 -05:00
Charlie Marsh
3eff9a2860
Allow unittest methods in flake8-boolean-trap ( #1333 )
2022-12-22 08:40:22 -05:00
Charlie Marsh
a4a24a0ef3
Add some more repositories to the user list ( #1328 )
2022-12-21 22:16:47 -05:00
Charlie Marsh
48e3c046b0
Fix integration tests
2022-12-21 21:25:37 -05:00
Charlie Marsh
03e4f5be8a
Bump version to 0.0.191
2022-12-21 21:16:21 -05:00
Charlie Marsh
99657b7d92
Implement E401 ("multiple imports on one line") ( #1326 )
2022-12-21 21:15:57 -05:00
Charlie Marsh
40377aa1fc
Move number of errors to the bottom of the output summary ( #1325 )
2022-12-21 21:04:26 -05:00
Charlie Marsh
2a37017e8c
Add src to Settings hash
2022-12-21 21:01:20 -05:00
Charlie Marsh
ff66d08cef
Run generate-options
2022-12-21 20:58:14 -05:00
Charlie Marsh
dad8035eef
Support shell expansion in src field ( #1324 )
2022-12-21 20:57:20 -05:00
Charlie Marsh
bf5fec342c
Support shell expansion in extend paths ( #1323 )
2022-12-21 20:46:38 -05:00
Charlie Marsh
66a6c81ebf
Infer package roots when running via stdin ( #1321 )
2022-12-21 20:30:10 -05:00
Charlie Marsh
5c70f5044b
Improve debug logging in flake8-to-ruff ( #1320 )
2022-12-21 20:05:48 -05:00
Charlie Marsh
953d141ab2
Support code redirects in flake8-to-ruff ( #1318 )
2022-12-21 19:31:20 -05:00
Charlie Marsh
07dba46039
Extract line length from pyproject.toml Black section ( #1317 )
2022-12-21 19:05:18 -05:00
Ran Benita
3b02da9d7b
Fix false positive DTZ001 on datetime(2000, 1, 1, 0, 0, 0, 0, utc) ( #1308 )
2022-12-21 19:03:36 -05:00
Charlie Marsh
20234c6156
Bump version to 0.0.190
2022-12-21 16:01:48 -05:00
Charlie Marsh
de767cc026
Avoid used-prior-global-declaration false-positives in f-strings ( #1314 )
2022-12-21 14:34:09 -05:00
Charlie Marsh
ce1663d302
Allow overriding cache location via RUFF_CACHE_DIR ( #1312 )
2022-12-21 14:24:10 -05:00
Charlie Marsh
f40e4bcd14
Avoid flagging RUF100 as a RUF100 violation ( #1305 )
2022-12-20 17:40:10 -05:00
Charlie Marsh
e7d40d435f
Avoid F821 false positives for Mypy extensions ( #1304 )
2022-12-20 16:29:33 -05:00
Charlie Marsh
ef8fe31c0c
Bump version to 0.0.189
2022-12-20 13:26:17 -05:00
Charlie Marsh
226f682c99
Avoid DTZ007 false-positives for non-string arguments ( #1300 )
2022-12-20 13:20:53 -05:00
Hannes Käufler
468ffd29fb
[Stylistic/non-functional] Use an r# format string to make json easier to read ( #1299 )
2022-12-20 12:55:21 -05:00
Charlie Marsh
a61126ab23
Run generate-options
2022-12-19 23:19:05 -05:00
Charlie Marsh
54c7c25861
Revert test changes to setup.py
2022-12-19 20:09:47 -05:00
Charlie Marsh
eff7700d92
Add --force-exclude setting to force exclusions with pre-commit ( #1295 )
2022-12-19 20:08:59 -05:00
Charlie Marsh
8934f6938d
Avoid RET504 errors for intermediary function calls ( #1294 )
2022-12-19 19:48:09 -05:00
Charlie Marsh
8f0fc3033a
Update Arg section checking to match latest pydocstyle ( #1293 )
2022-12-19 16:39:42 -05:00
Charlie Marsh
4107bc828d
Bump version to 0.0.188
2022-12-19 12:18:06 -05:00
Charlie Marsh
706d28cabc
Rename PDV checks to PD ( #1288 )
2022-12-19 00:20:28 -05:00
Charlie Marsh
4da2264722
Avoid T201 errors for print(..., file=fp)-like calls ( #1287 )
2022-12-19 00:10:07 -05:00
Charlie Marsh
bf88c815aa
Move flake8-debugger tests into flake8-debugger subdirectory ( #1286 )
2022-12-18 22:06:42 -05:00
Yasu_umi
8a4831dd5b
Implement flake8-datetimez ( #1270 )
2022-12-18 22:06:06 -05:00
Charlie Marsh
b5ab492a70
Bump version to 0.0.187
2022-12-18 20:09:02 -05:00
Charlie Marsh
1fc09ebd5c
Fix inverted E501 condition ( #1285 )
2022-12-18 20:08:30 -05:00
Charlie Marsh
6cf047976c
Bump pygrep-hooks tally in README
2022-12-18 18:05:32 -05:00
Reiner Gerecke
87465daacc
pygrep-hooks - deprecated use of logging.warn & no blanket type ignore ( #1275 )
2022-12-18 18:04:21 -05:00
Chris Brendel
a52bed7101
Use --stdin-filename when resolving configuration files ( #1281 )
2022-12-18 17:51:55 -05:00
Anders Kaseorg
20ac823778
generate-check-code-prefix: Run rustfmt automatically; only write if changed ( #1282 )
2022-12-18 17:46:23 -05:00
Charlie Marsh
1028ed3565
Bump version to 0.0.186
2022-12-18 14:30:30 -05:00
Anders Kaseorg
98897db6ac
Add packaging status badge from repology ( #1276 )
2022-12-18 14:27:29 -05:00
Honkertonken
5ce4262112
Readme : Fix incorrect exmaple. ( #1277 )
2022-12-18 12:04:48 -05:00
Charlie Marsh
6b2359384d
Print redirect warnings exactly once per code ( #1280 )
2022-12-18 12:03:49 -05:00
Harutaka Kawamura
d3443d7c19
Update RustPython to use correct Tuple location ( #1278 )
2022-12-18 08:53:57 -05:00
Anders Kaseorg
04b1e1de6f
README: Add missing backtick ( #1274 )
2022-12-18 00:29:33 -05:00
Anders Kaseorg
c93c85300f
Repair corrupted PDV007, PDV009 messages ( #1273 )
2022-12-18 00:29:12 -05:00
Charlie Marsh
73ed6f8654
Touch-up README
2022-12-17 21:38:45 -05:00
Charlie Marsh
eb183645f3
Add ruff-lsp to README ( #1272 )
...
Add ruff-lsp to README
2022-12-17 21:37:11 -05:00
Charlie Marsh
ef17aa93da
Add ruff-lsp to README ( #1272 )
2022-12-17 21:37:00 -05:00
Charlie Marsh
f366b0147f
Add ruff-lsp to README ( #1272 )
2022-12-17 21:35:44 -05:00
Charlie Marsh
fc88fa35ff
Add instructions for Sublime Text installation ( #1271 )
2022-12-17 16:22:50 -05:00
Charlie Marsh
a2806eb8ef
Bump version to 0.0.185
2022-12-16 23:47:56 -05:00
Charlie Marsh
89d919eac5
Re-remove W605_1.py from Black compatibility test
2022-12-16 23:17:27 -05:00
Charlie Marsh
5ad77fbc8d
Move checkers into their own module ( #1268 )
2022-12-16 22:55:47 -05:00
Charlie Marsh
9cb18a481b
Separate line-based checker from noqa enforcement ( #1267 )
2022-12-16 22:49:27 -05:00
Charlie Marsh
2393e270ed
Change a few more methods to take AsRef<Path>
2022-12-16 21:38:52 -05:00
Charlie Marsh
f36e6035c8
Change a few methods to take AsRef<Path>
2022-12-16 21:28:19 -05:00
Charlie Marsh
ecf0dd05d6
Auto-detect same-package imports ( #1266 )
2022-12-16 21:19:11 -05:00
Charlie Marsh
5f67ee93f7
Replace cache bool with an enum
2022-12-16 15:45:30 -05:00
Charlie Marsh
1e19142d0e
Bump version to 0.0.184
2022-12-16 14:36:25 -05:00
Charlie Marsh
6a95dade6d
Actually check-in snapshots for #1265
2022-12-16 14:36:00 -05:00
Charlie Marsh
d6e765877e
Enable autofix for __init__ method with missing None-return ( #1265 )
2022-12-16 14:28:56 -05:00
Charlie Marsh
e4d36bae57
Replace ignore_noqa and autofix booleans with enums ( #1264 )
2022-12-16 14:01:25 -05:00
Harutaka Kawamura
e3531276a7
Fix F501 (line-too-long) start location ( #1262 )
2022-12-16 11:29:47 -05:00
Charlie Marsh
634553f188
Add ignore-variadic-names options to flake8-unused-arguments ( #1261 )
2022-12-16 00:22:38 -05:00
Edgar R. M
4ff0b75045
test: Fix flake8-errmsg snapshots ( #1260 )
2022-12-15 23:53:15 -05:00
Charlie Marsh
481d668511
Add flake8-errmsg to README
2022-12-15 23:16:38 -05:00
Charlie Marsh
a9f56ee76e
Bump version to 0.0.183
2022-12-15 23:15:12 -05:00
Charlie Marsh
b4bfa87104
Avoid removing partially-unused imports ( #1259 )
2022-12-15 23:13:58 -05:00
Charlie Marsh
b9f42bf5e5
Remove extraneous test file
2022-12-15 23:12:19 -05:00
Edgar R. M
8281d414ca
Implement flake8-errmsg ( #1258 )
2022-12-15 23:10:59 -05:00
Charlie Marsh
7e45a9f2e2
Avoid generating invalid statements when deleting from multi-statement lines ( #1253 )
2022-12-15 22:17:31 -05:00
Reiner Gerecke
a000cd4a09
Test to prevent continious reformatting when used together with black ( #1206 )
2022-12-15 15:26:41 -05:00
Martin Lehoux
d8b4b92733
Implement U016: Remove six compatibility code ( #1013 )
2022-12-15 14:16:58 -05:00
Edgar R. M
27de342e75
Implement pandas-vet ( #1235 )
2022-12-15 14:01:01 -05:00
Charlie Marsh
d805067683
Avoid fixing E711 and E712 issues that would cause F632 ( #1248 )
2022-12-15 12:08:31 -05:00
Charlie Marsh
1ea2e93f8e
Bump version to 0.0.182
2022-12-14 22:57:22 -05:00
Charlie Marsh
dc180dc277
Negate ignore_names condition
2022-12-14 22:50:26 -05:00
Charlie Marsh
6be910ae07
Use more precise ranges for function and class checks ( #1247 )
2022-12-14 22:40:00 -05:00
Charlie Marsh
ba85eb846c
Run cargo fmt
2022-12-14 21:52:44 -05:00
Charlie Marsh
d067efe265
Treat extend-* configuration options as "always extended" ( #1245 )
2022-12-14 20:22:40 -05:00
Charlie Marsh
549ea2f85f
Ignore any pyproject.toml without a [tool.ruff] section ( #1243 )
2022-12-14 19:35:52 -05:00
Charlie Marsh
d814ebd21f
Bump version to 0.0.181
2022-12-14 17:35:36 -05:00
Charlie Marsh
3f272b6cf8
Enable opt-out of .gitignore checks via respect-gitignore flag ( #1242 )
2022-12-14 16:54:23 -05:00
Charlie Marsh
76891a8c07
Always check zero-depth CLI paths ( #1241 )
2022-12-14 16:32:02 -05:00
Charlie Marsh
e389201b5f
Add new .gitignore behavior to BREAKING_CHANGES.md ( #1240 )
2022-12-14 16:04:06 -05:00
Charlie Marsh
4b2020d03a
Automatically ignore files specified in .gitignore ( #1234 )
2022-12-14 15:58:40 -05:00
Charlie Marsh
0aa356c96c
Avoid converting expression to statement in invald contexts ( #1239 )
2022-12-14 13:57:25 -05:00
Charlie Marsh
630b4b627d
Apply fix to all errors in E711 and E712 autofix ( #1238 )
2022-12-14 13:29:56 -05:00
Charlie Marsh
854cd14842
Bump version to 0.0.180
2022-12-14 13:21:10 -05:00
Chris Brendel
6b93c8403f
Apply CLI options even when no pyproject.toml is found ( #1232 )
2022-12-13 22:55:04 -05:00
Charlie Marsh
765d21c7b0
Bump version to 0.0.179
2022-12-13 10:17:16 -05:00
Charlie Marsh
a58b9b5063
Upgrade RustPython to support parenthesized context managers ( #1228 )
2022-12-13 10:16:43 -05:00
Charlie Marsh
f3e11a30cb
Bump version to 0.0.178
2022-12-12 22:06:04 -05:00
Charlie Marsh
2f3b5367ff
Add a note on extends to README
2022-12-12 21:36:39 -05:00
Charlie Marsh
92bc417e4e
Add support for glob patterns in src ( #1225 )
2022-12-12 21:35:03 -05:00
Charlie Marsh
9853b0728b
Enable configuration files to "extend" other configuration files ( #1219 )
2022-12-12 20:28:22 -05:00
Charlie Marsh
77709dcc41
Remove underscore from extend_exclude
2022-12-12 16:34:16 -05:00
Charlie Marsh
b0cb5fc7ef
Document current behavior around pyproject.toml discovery ( #1213 )
2022-12-12 11:49:21 -05:00
Charlie Marsh
d6f51e55dd
Remove extraneous test_project
2022-12-12 10:53:12 -05:00
Charlie Marsh
4bb6b4851a
Rename p to path
2022-12-12 10:51:24 -05:00
Charlie Marsh
54c5ded938
Move settings path discovery into its own function
2022-12-12 10:50:08 -05:00
Charlie Marsh
0157fedab5
Move Python file resolution into resolver.rs ( #1211 )
2022-12-12 10:43:50 -05:00
Charlie Marsh
cd69610741
Use --config everywhere if provided ( #1210 )
2022-12-12 10:28:00 -05:00
Charlie Marsh
a3d06d0005
Move more commands into commands.rs ( #1209 )
2022-12-12 10:22:47 -05:00
Charlie Marsh
ac6fa1dc88
Simplify some logic around configuration detection ( #1197 )
2022-12-12 10:15:05 -05:00
Charlie Marsh
73794fc299
Resolve hierarchical settings and Python files in a single filesystem pass ( #1205 )
2022-12-12 10:13:52 -05:00
Charlie Marsh
0adc9ed259
Support hierarchical settings for nested directories ( #1190 )
2022-12-12 10:12:23 -05:00
Charlie Marsh
19e9eb1af8
Bump version to 0.0.177
2022-12-11 22:38:52 -05:00
Anders Kaseorg
e57044800c
Fix quotes in SIM118 error message ( #1204 )
2022-12-11 22:30:39 -05:00
Charlie Marsh
ae8ff7cb7f
Add notes around python-lsp-ruff ( #1202 )
2022-12-11 17:36:20 -05:00
Charlie Marsh
c05914f222
Avoid inserting extra newlines for comment-delimited import blocks ( #1201 )
2022-12-11 17:13:09 -05:00
Charlie Marsh
24179655b8
Fix 'a test' reference
2022-12-11 13:31:14 -05:00
Charlie Marsh
d27b419e68
Run cargo dev generate-options
2022-12-11 10:34:52 -05:00
Charlie Marsh
9fc7a32a24
Sort list in README
2022-12-11 10:25:27 -05:00
Charlie Marsh
9161b866b5
Bump version to 0.0.176
2022-12-11 10:19:50 -05:00
Reiner Gerecke
38141a6f14
Check for outdated auto-generated files in CI ( #1192 )
2022-12-11 10:18:57 -05:00
Charlie Marsh
aa5402fc0e
Add flake8-simplify to flake8-to-ruff
2022-12-11 10:10:46 -05:00
Charlie Marsh
99f077aa4e
Add missing hash in README comment
2022-12-11 10:05:32 -05:00
Reiner Gerecke
7f25d1ec70
Implement SIM118 (key in dict) of flake8-simplify ( #1195 )
2022-12-11 10:05:11 -05:00
Charlie Marsh
360b033e04
Avoid F821 false positive on annotated global ( #1196 )
2022-12-11 10:04:06 -05:00
Reiner Gerecke
247dcc9f9c
Mark C413 as fixable ( #1191 )
2022-12-11 09:07:51 -05:00
Charlie Marsh
c86e52193c
Bump version to 0.0.175
2022-12-10 21:23:19 -05:00
Harutaka Kawamura
efdc4e801d
Upgrade RustPython to fix end location of implicitly concatenated strings ( #1187 )
2022-12-10 19:16:01 -05:00
Charlie Marsh
f8f2eeed35
Enable --no-show-source for consistency ( #1189 )
2022-12-10 19:09:49 -05:00
Charlie Marsh
8fa414b67e
Move configuration-CLI resolution into dedicated methods ( #1188 )
2022-12-10 19:07:38 -05:00
Charlie Marsh
484d7a30bd
Add TODO around nested globals
2022-12-10 17:44:08 -05:00
Charlie Marsh
fb681c614a
Move string formatting checks to plugins ( #1185 )
2022-12-10 16:43:21 -05:00
Reiner Gerecke
06ed125771
Add autofix for F504 and F522 ( #1184 )
2022-12-10 16:33:09 -05:00
Charlie Marsh
74668915b0
Remove serialization format from Settings struct ( #1183 )
2022-12-10 13:38:59 -05:00
Charlie Marsh
6da3de25ba
Add jupyter_server to README ( #1182 )
2022-12-10 12:10:27 -05:00
Charlie Marsh
63b3e00c97
Bump version to 0.0.174
2022-12-10 12:08:48 -05:00
Charlie Marsh
39440aa274
Create function and lambda scopes eagerly ( #1181 )
2022-12-10 12:08:33 -05:00
Charlie Marsh
add96d3dc5
Implement E0117 (nonlocal-without-binding) ( #1180 )
2022-12-10 11:41:57 -05:00
Charlie Marsh
6f8e0224d0
Implement W0602 (global-variable-not-assigned) ( #1179 )
2022-12-10 11:33:24 -05:00
Charlie Marsh
b8bbafd85b
Flag global usages prior to global declarations ( #1178 )
2022-12-10 11:19:24 -05:00
Charlie Marsh
40b54d3e8c
Ignore imports in class scopes ( #1176 )
2022-12-10 10:23:33 -05:00
Charlie Marsh
2b44941d63
Add pacman instructions to README ( #1175 )
2022-12-10 10:00:01 -05:00
Charlie Marsh
257bd7f1d7
Bump version to 0.0.173
2022-12-09 23:23:12 -05:00
Charlie Marsh
5728dceef0
Add note around redefinitions
2022-12-09 23:18:51 -05:00
Charlie Marsh
6739602806
Mark redefined-but-unused imports as unused regardless of scope ( #1173 )
2022-12-09 23:17:33 -05:00
Charlie Marsh
305326f7d7
Remove some string clones from docstring helpers ( #1172 )
2022-12-09 22:30:34 -05:00
Charlie Marsh
69866f5461
Extract docstring exactly once ( #1171 )
2022-12-09 22:21:16 -05:00
Charlie Marsh
41ca29c4f4
Add TODO in redefined_by_function
2022-12-09 21:19:57 -05:00
Charlie Marsh
b35a804f9d
Bump version to 0.0.172
2022-12-09 17:47:34 -05:00
Charlie Marsh
e594ed6528
Implement D301 (backslash checks) ( #1169 )
2022-12-09 17:44:18 -05:00
Charlie Marsh
197645d90d
Always use raw docstrings for pydocstyle rules ( #1167 )
2022-12-09 17:31:04 -05:00
Charlie Marsh
26d3ff5a3a
Add pyflakes test suite for annotations ( #1166 )
2022-12-09 16:28:07 -05:00
Charlie Marsh
0dacf61153
Implement F842 (UnusedAnnotation) ( #1165 )
2022-12-09 12:42:03 -05:00
Charlie Marsh
a6251360b7
Avoid RET false-positives for usages in f-strings ( #1163 )
2022-12-09 12:28:09 -05:00
Charlie Marsh
2965e2561d
Clarify combination of combine-as-imports and force-wrap-aliases ( #1162 )
2022-12-09 12:20:15 -05:00
Charlie Marsh
a19050b8a4
Update README.md
2022-12-08 23:39:01 -05:00
Charlie Marsh
dfd6225d85
Bump version to 0.0.171
2022-12-08 23:18:48 -05:00
Charlie Marsh
a0a6327fae
Only allowlist noqa et al at the start of a comment ( #1157 )
2022-12-08 23:10:36 -05:00
Charlie Marsh
db815a565f
Run release job on release: published event ( #1156 )
2022-12-08 23:05:28 -05:00
Charlie Marsh
3bacdafd1c
Improve some __all__ handling cases ( #1155 )
2022-12-08 23:03:23 -05:00
Charlie Marsh
6403e3630d
Fix flaky unused import test
2022-12-08 22:51:13 -05:00
Charlie Marsh
229eab6f42
Improve some behavior around global handling ( #1154 )
2022-12-08 22:47:19 -05:00
Charlie Marsh
e33582fb0e
Add pyflakes import test suite ( #1151 )
2022-12-08 22:23:37 -05:00
Charlie Marsh
aaeab0ecf1
Implement F811 (RedefinedWhileUnused) ( #1137 )
2022-12-08 21:31:08 -05:00
Charlie Marsh
f9a16d9c44
Fix GitHub link
2022-12-08 20:54:54 -05:00
Charlie Marsh
2aa884eb9b
Re-implement the entire test_undefined_names.py test suite ( #1150 )
2022-12-08 20:53:01 -05:00
Charlie Marsh
84fa64d98c
Move bindings to an arena ( #1147 )
2022-12-08 19:48:00 -05:00
Charlie Marsh
c1b1ac069e
Include else block in break detection ( #1143 )
2022-12-08 11:53:31 -05:00
Charlie Marsh
a710e35ebc
Bump version to 0.0.170
2022-12-08 11:36:24 -05:00
Charlie Marsh
49df43bb78
Use single newlines in .pyi import sorting ( #1142 )
2022-12-08 11:34:41 -05:00
Charlie Marsh
e338d9acbe
Remove 'consider' language from check messages ( #1135 )
2022-12-07 20:10:36 -05:00
Charlie Marsh
5c8655f479
Bump ruff_macros to 0.0.169
2022-12-07 19:10:16 -05:00
Charlie Marsh
60987888a2
Re-increase max iterations to 100
2022-12-07 19:10:03 -05:00
Charlie Marsh
a81581c781
Bump ruff_macros to 0.0.168
2022-12-07 19:08:18 -05:00
Charlie Marsh
3152dd7a8e
Don't prompt users to --fix if they ran with --fix ( #1133 )
2022-12-07 19:07:51 -05:00
Charlie Marsh
528416f07a
Rename I252 to TID252; add redirects for all renamed codes ( #1129 )
2022-12-07 15:12:22 -05:00
Charlie Marsh
4405a6a903
Bump version to 0.0.168
2022-12-07 13:18:40 -05:00
Charlie Marsh
35fa2a3c32
Convert more BTree usages to Fx ( #1112 )
2022-12-07 12:21:12 -05:00
Charlie Marsh
bb67fbb73a
Implement unused argument detection (ARG) ( #1126 )
...
Detect unused arguments
2022-12-07 12:15:41 -05:00
Charlie Marsh
d698c6123e
Bump version to 0.0.167
2022-12-07 10:37:31 -05:00
Charlie Marsh
9579faffa8
Avoid flagging bare exception issues when exception is re-raised ( #1124 )
2022-12-07 10:37:08 -05:00
Phillip Verheyden
9c6e8c7644
Auto-generate the rules table of contents ( #1121 )
2022-12-07 10:03:42 -05:00
Charlie Marsh
7abecd4f0e
Implement B905 ( #1122 )
2022-12-07 10:01:24 -05:00
Phillip Verheyden
b8ff209af8
Encode prefixes in README headings not just in TOC ( #1109 )
2022-12-07 09:24:49 -05:00
Jeong YunWon
c5451cd8ad
Reduce indents ( #1116 )
2022-12-07 09:20:33 -05:00
Jonathan Plasse
92b9ab3010
Add aiter() and anext() to BUILTINS ( #1118 )
2022-12-07 09:20:06 -05:00
Edgar R. M
f2ac8c4ec2
Add flake8-import-conventions to TOC in readme ( #1114 )
2022-12-06 21:27:04 -05:00
Charlie Marsh
80e2f0c92e
Bump version to 0.0.166
2022-12-06 16:06:19 -05:00
Edgar R. M
ea550abd3c
Implement flake8-import-conventions ( #1098 )
2022-12-06 16:01:17 -05:00
Charlie Marsh
5c26777e4c
Avoid flagging ANN errors in @overload implementations ( #1110 )
2022-12-06 12:46:38 -05:00
Laurent Baillet
6eb6b6eede
Update readme in order to match pylint prefixes ( #1105 )
2022-12-06 08:59:45 -05:00
Charlie Marsh
f1d3e3698a
Bump version to 0.0.165
2022-12-06 00:03:30 -05:00
Charlie Marsh
080411bc89
Re-create ruff snapshots
2022-12-06 00:03:14 -05:00
Charlie Marsh
f2ad915224
Bump version to 0.0.164
2022-12-05 23:37:22 -05:00
Charlie Marsh
71543eeabc
Rename rules mod to ruff ( #1104 )
2022-12-05 23:35:36 -05:00
Charlie Marsh
44025f1c92
Improve F841's Flake8 parity for unpacking assignments ( #1103 )
2022-12-05 23:34:40 -05:00
Charlie Marsh
971bf6d232
Run cargo fmt
2022-12-05 23:01:47 -05:00
Charlie Marsh
0acc47386a
Use pyproject.toml parent as project root when explicitly provided ( #1101 )
2022-12-05 23:00:59 -05:00
Reiner Gerecke
982ac6b0ad
Auto-generate options in README from field attributes ( #1015 )
2022-12-05 22:34:40 -05:00
Charlie Marsh
541440f7a8
Re-support F841 detection for single context managers ( #1099 )
2022-12-05 22:09:45 -05:00
Charlie Marsh
66dde46e03
Track nested imports without column number detection ( #1097 )
2022-12-05 21:16:44 -05:00
Charlie Marsh
1339e2a002
Bump version to 0.0.163
2022-12-05 20:45:24 -05:00
Charlie Marsh
38ad10f60d
Treat nested classes and functions as "standard" siblings ( #1095 )
2022-12-05 20:45:12 -05:00
Charlie Marsh
88e78c5cde
Add missing D415 fixture
2022-12-05 20:42:21 -05:00
Charlie Marsh
436aeed20a
Implement autofix for D400 and D415 ( #1094 )
2022-12-05 20:24:56 -05:00
Charlie Marsh
b94169a8bb
Don't autofix D210 by introducing a syntax error ( #1093 )
2022-12-05 19:13:22 -05:00
Charlie Marsh
995994be3e
Bump version to 0.0.162
2022-12-05 19:07:44 -05:00
Charlie Marsh
f001305b2e
Only autofix D205 by deleting blank lines ( #1091 )
2022-12-05 19:01:32 -05:00
Charlie Marsh
e88093541f
Avoid wrapping import-star statements ( #1089 )
2022-12-05 18:39:16 -05:00
Charlie Marsh
da41a495f1
Remove extraneous plugin creation script
2022-12-05 18:31:19 -05:00
Charlie Marsh
55b7ec8f85
Ignore newline enforcement when imports break indentation boundaries ( #1085 )
2022-12-05 18:02:41 -05:00
Charlie Marsh
4b41ae3f53
Bump version to 0.0.161
2022-12-05 17:02:05 -05:00
Charlie Marsh
f944e1e1cf
Add action comments to README.md ( #1082 )
2022-12-05 16:56:28 -05:00
Charlie Marsh
4fbc1082de
Support isort: split directive ( #1081 )
2022-12-05 16:48:10 -05:00
Charlie Marsh
cf2e887e38
Tweak summary message to include total error counts ( #1067 )
2022-12-05 16:12:12 -05:00
Charlie Marsh
ee994e8c07
Import compatibility with isort newline-insertion behavior ( #1078 )
2022-12-05 16:07:07 -05:00
Charlie Marsh
c69c4fd655
Support isort: skip_file directive ( #1075 )
2022-12-05 15:02:01 -05:00
Charlie Marsh
e01e45ca35
Remove extraneous test file
2022-12-05 14:58:54 -05:00
Charlie Marsh
4be74785fe
Support unterminated isort: off directives ( #1074 )
2022-12-05 14:54:47 -05:00
Charlie Marsh
40b7c64f7d
Bump version to 0.0.160
2022-12-05 12:56:38 -05:00
Jonathan Plasse
a76c5d1226
Add allowed-confusable settings ( #1059 )
2022-12-05 12:53:55 -05:00
Charlie Marsh
5aeddeb825
Include pyproject.toml path in error message ( #1068 )
2022-12-05 12:04:50 -05:00
Charlie Marsh
5f8294aea4
Preserve star imports when re-formatting import blocks ( #1066 )
2022-12-05 11:48:38 -05:00
Charlie Marsh
e07d3f6313
Fix clippy
2022-12-05 11:47:42 -05:00
Charlie Marsh
1d1662cb9c
Bump version to 0.0.159
2022-12-05 11:22:02 -05:00
Charlie Marsh
55ce7bd0df
Migrate invalid_literal_comparisons fix to token-based logic ( #1065 )
2022-12-05 11:16:59 -05:00
Charlie Marsh
e695f6eb25
Avoid false-positive on PLR1701 for multi-type isinstance calls ( #1063 )
2022-12-05 10:07:05 -05:00
messense
fb2c457a9b
Upgrade to notify 5.0.0 ( #1048 )
2022-12-05 09:58:42 -05:00
Jeong YunWon
523cf62eda
Style fixes ( #1049 )
2022-12-05 09:57:48 -05:00
Charlie Marsh
7024ad7cc7
Bump version to 0.0.158
2022-12-04 21:22:24 -05:00
Charlie Marsh
871ac511ae
Add an option to force one-member-per-line for aliased import-froms ( #1047 )
2022-12-04 21:22:00 -05:00
Charlie Marsh
0685af8a4f
Update RustPython ( #1045 )
2022-12-04 20:09:28 -05:00
Charlie Marsh
5e9a8fcf53
Bump version to 0.0.157
2022-12-04 14:46:46 -05:00
Charlie Marsh
76439235af
Remove unused imports in __init__.py files by default ( #1042 )
2022-12-04 14:45:54 -05:00
Charlie Marsh
0c9c6a1c1c
Remove extraneous test file
2022-12-04 13:59:55 -05:00
Charlie Marsh
46a99243cd
Fix D205 autofix by detecting summary line ( #1041 )
2022-12-04 13:56:51 -05:00
Charlie Marsh
d06dc4c72d
Bump version to 0.0.156
2022-12-04 10:22:09 -05:00
Jonathan Plasse
8f6b2fb32b
Extend and rename RUF004 to PLR1722 ( #1036 )
2022-12-04 10:20:12 -05:00
Charlie Marsh
1d61db5b62
Allow import builtins under T100 ( #1037 )
2022-12-04 10:13:17 -05:00
Charlie Marsh
e15c0c68cb
Fix PLW0120 snapshot
2022-12-04 10:10:00 -05:00
Harutaka Kawamura
abb2adc4d8
Implement useless-import-alias ( #1025 )
2022-12-04 09:48:56 -05:00
Harutaka Kawamura
e070166409
Implement useless-else-on-loop ( #1031 )
2022-12-04 09:22:04 -05:00
Jonathan Plasse
0ae6890094
Fix Table of Contents ( #1030 )
2022-12-04 09:14:09 -05:00
Harutaka Kawamura
21cace0973
Fix PLR0402 ( #1024 )
2022-12-04 09:13:47 -05:00
Jakub Kuczys
4994b72ba2
Fix README header links in isort config section ( #1033 )
2022-12-04 09:12:25 -05:00
Anders Kaseorg
dbb1a6e44b
Remove sloppy match_name_or_attr helper ( #1027 )
2022-12-04 09:12:03 -05:00
Charlie Marsh
4b0c3e3bc9
Bump version to 0.0.155
2022-12-04 00:12:00 -05:00
Charlie Marsh
ddae3586d5
Add support for combine-as-imports import formatting ( #1022 )
2022-12-04 00:11:48 -05:00
Charlie Marsh
97684b7215
Mark MisplacedComparisonConstant as fixable
2022-12-04 00:11:19 -05:00
Harutaka Kawamura
20e6ff112a
Implement misplaced-comparison-constant ( #1023 )
2022-12-04 00:10:07 -05:00
Charlie Marsh
6cb84d29f0
Rename M001 to RUF100 ( #1021 )
2022-12-03 22:51:05 -05:00
Charlie Marsh
d069054792
Rename RUF101 fixtures
2022-12-03 22:47:16 -05:00
Charlie Marsh
c659cb86d9
Rename RUF101 to RUF004 ( #1020 )
2022-12-03 22:46:13 -05:00
Charlie Marsh
8a3f29497b
Add backwards compatible redirect map for U-to-UP rename ( #1019 )
2022-12-03 22:43:00 -05:00
Harutaka Kawamura
58e7baedd0
Implement consider-using-from-import ( #1018 )
2022-12-03 22:36:43 -05:00
Charlie Marsh
00eff2b09a
Rename pyupgrade rules from UXXX to UPXXX ( #957 )
2022-12-03 22:35:42 -05:00
Charlie Marsh
b6b509811d
Bump version to 0.0.154
2022-12-03 20:14:38 -05:00
Charlie Marsh
87bdda3cfa
Make some flake8-return rules auto-fixable ( #1017 )
2022-12-03 20:13:17 -05:00
Charlie Marsh
291727a27d
Implement flake8-return plugin ( #1016 )
2022-12-03 20:12:11 -05:00
Charlie Marsh
e66b786229
Bump version to 0.0.153
2022-12-03 17:05:39 -05:00
Harutaka Kawamura
e05e1cdf76
Implement consider-merging-isinstance ( #1009 )
2022-12-03 16:51:53 -05:00
Harutaka Kawamura
f92cc7a159
Fix clippy errors on main ( #1010 )
2022-12-03 10:02:36 -05:00
Harutaka Kawamura
ebd2181946
Implement unnecessary-direct-lambda-call ( #1008 )
2022-12-03 09:59:04 -05:00
Harutaka Kawamura
3efa1a03f2
Fix match_like_matches_macro in src/pylint/plugins.rs ( #1007 )
2022-12-03 00:21:32 -05:00
Harutaka Kawamura
115e85b47d
Rename PLE0206 to PLR0206 ( #1006 )
2022-12-03 00:14:46 -05:00
Harutaka Kawamura
31a3314ebd
Implement PLE0206 ( #1005 )
2022-12-03 00:04:43 -05:00
Charlie Marsh
bf33025ea9
Support whole-file noqa exclusions ( #1001 )
2022-12-02 23:56:56 -05:00
Charlie Marsh
1a33ee3fc4
Bump version to 0.0.152
2022-12-02 13:23:00 -05:00
Charlie Marsh
4722885910
Avoid recursing on nested deferred annotations ( #1000 )
...
Parse nested deferred annotations
2022-12-02 13:22:39 -05:00
Jonathan Plasse
117fcb6936
Add no-eval rule from pygrep-hooks ( #994 )
2022-12-02 12:59:06 -05:00
Charlie Marsh
1a24d78f67
Bump version to 0.0.151
2022-12-01 22:31:44 -05:00
Charlie Marsh
4a4082cf0e
Track type definitions and annotations separately ( #992 )
2022-12-01 22:31:20 -05:00
Charlie Marsh
18b9fbd71e
Improve docstring checks with empty trailing lines ( #991 )
2022-12-01 20:15:44 -05:00
Charlie Marsh
d699bb7b86
Bump version to 0.0.150
2022-12-01 16:31:18 -05:00
Charlie Marsh
46f5053c73
Include fixes in JSON API output ( #988 )
2022-12-01 16:30:56 -05:00
Charlie Marsh
af40e64d6c
Remove Patch abstraction from Fix ( #987 )
2022-12-01 16:04:42 -05:00
Charlie Marsh
2e89cd8802
Split test fixtures up by plugin ( #985 )
2022-12-01 13:33:33 -05:00
Charlie Marsh
1085b547b6
Convert Err(anyhow(...)) to bail ( #984 )
2022-12-01 13:33:06 -05:00
Charlie Marsh
9e5df82578
Remove trailing punctuation from error messages ( #983 )
2022-12-01 12:25:37 -05:00
Charlie Marsh
6fe478cb43
Add Conda installation instructions ( #982 )
2022-12-01 12:19:39 -05:00
Charlie Marsh
c06a1f6da9
Force format --text in tests
2022-12-01 10:51:11 -05:00
Edgar R. M
6f48ac6c0b
Add GitHub output format ( #975 )
2022-12-01 10:22:11 -05:00
Edgar R. M
9e1ba916f0
Send logs to stderr ( #977 )
2022-12-01 10:19:32 -05:00
Charlie Marsh
f6b0a606d6
Implement await-outside-async / E1142 ( #972 )
2022-11-30 11:38:03 -05:00
Charlie Marsh
c8e72dfb9e
Narrow keyword in yield-outside-function ( #971 )
2022-11-30 10:03:40 -05:00
Charlie Marsh
6fa0f21227
Bump version to 0.0.149
2022-11-30 00:51:36 -05:00
messense
f5466fe720
Add JUnit xml output format ( #968 )
2022-11-30 00:47:41 -05:00
Charlie Marsh
a0202e8eb2
Add Pylint parity to FAQ ( #969 )
2022-11-29 23:51:27 -05:00
Charlie Marsh
30ff4de9a3
Bump version to 0.0.148
2022-11-29 22:50:30 -05:00
Charlie Marsh
897b0f06ef
Fix clippy
2022-11-29 22:50:20 -05:00
Charlie Marsh
2fe22a223b
Bump version to 0.0.147
2022-11-29 20:17:58 -05:00
Charlie Marsh
e762dec677
Add one more note to README
2022-11-29 20:17:46 -05:00
Charlie Marsh
19baa50003
Remove extraneous key in pyproject.toml
2022-11-29 20:13:28 -05:00
Charlie Marsh
ab0df03a05
Fix pyproject tests to include pyupgrade
2022-11-29 20:11:16 -05:00
Charlie Marsh
808b348c5f
Add W to pycodestyle list in README
2022-11-29 20:09:07 -05:00
Charlie Marsh
e55daa89e6
Uses dashes for README options ( #966 )
2022-11-29 20:08:03 -05:00
Charlie Marsh
b8e7d86696
Add pyupgrade's --keep-runtime-typing option ( #965 )
2022-11-29 20:05:32 -05:00
Charlie Marsh
ced7868559
Add format setting to pyproject.toml ( #964 )
2022-11-29 19:22:23 -05:00
Ramazan Elsunakev
7c344e8e4c
feat: use more precise ranges for imports ( #958 )
2022-11-29 19:01:39 -05:00
Hayden
ca38c7ac48
Grouped format implementation ( #954 )
2022-11-29 18:45:16 -05:00
Guillaume Andreu Sabater
602291c0c2
README: fixed conf section typo ( #959 )
2022-11-29 09:27:02 -05:00
Charlie Marsh
d4cf376e9b
Fix failing pyproject test
2022-11-29 00:00:43 -05:00
Charlie Marsh
0e6a38e6d8
Bump version to 0.0.146
2022-11-28 22:27:41 -05:00
Charlie Marsh
058fd8748d
Re-generate check code prefix and rules table
2022-11-28 22:26:32 -05:00
Charlie Marsh
e8247e3ed9
Run cargo fmt
2022-11-28 22:25:09 -05:00
Charlie Marsh
ea73c717be
Remove pre-commit note in README.md ( #956 )
2022-11-28 22:18:59 -05:00
Charlie Marsh
427e0c3158
Allow preservation of external check codes ( #955 )
2022-11-28 22:16:17 -05:00
Charlie Marsh
dca994d05f
Bump version to 0.0.145
2022-11-28 20:57:58 -05:00
Charlie Marsh
9944246f98
Rewrite type annotations on Python 3.7 when __future__ enabled ( #953 )
2022-11-28 20:57:38 -05:00
Charlie Marsh
82b0b7941a
Implement eradicate ( #947 )
2022-11-28 20:54:33 -05:00
Charlie Marsh
72453695d6
Bump version to 0.0.144
2022-11-28 20:11:08 -05:00
Charlie Marsh
1617d715f2
Allow long lines that consist of only a URL ( #952 )
2022-11-28 20:10:21 -05:00
pwoolvett
c4a7344791
fix(flake8_boolean_trap): add allowlist for dict methods ( #943 )
2022-11-28 16:17:01 -05:00
Charlie Marsh
ea9acda732
Bump version to 0.0.143
2022-11-28 15:42:25 -05:00
Anders Kaseorg
6c8021e970
Fix clippy::manual_let_else (pedantic) ( #939 )
2022-11-28 09:52:59 -05:00
Charlie Marsh
61b6ad46ea
Allow @override methods to be undocumented ( #941 )
2022-11-28 09:52:12 -05:00
Anders Kaseorg
041d8108e6
Don’t require files with --explain or --generate-shell-completion ( #937 )
2022-11-28 00:40:20 -05:00
Charlie Marsh
e2c4a098de
Bump version to 0.0.142
2022-11-28 00:19:27 -05:00
Charlie Marsh
e865f58426
Add all plugin options to README reference ( #936 )
2022-11-28 00:19:14 -05:00
messense
23b4e16b1d
Add shell completions support ( #935 )
2022-11-27 23:59:36 -05:00
Charlie Marsh
ae2ac905dc
Document all top-level configuration options ( #934 )
2022-11-27 23:50:24 -05:00
Charlie Marsh
55619b321a
Run cargo fmt
2022-11-27 22:58:42 -05:00
Harutaka Kawamura
6f31b002f8
Do not enforce line length limit for comments ending with a URL ( #920 )
2022-11-27 22:36:17 -05:00
Charlie Marsh
1a79965aa0
Allow varargs and kwargs to be prefixed with stars ( #933 )
2022-11-27 22:08:27 -05:00
Charlie Marsh
16da183f8e
Add some user testimonials ( #932 )
2022-11-27 21:55:01 -05:00
Charlie Marsh
3f689917cb
Use alternative TOML format for per-file-ignores in README ( #931 )
2022-11-27 21:38:43 -05:00
Charlie Marsh
a4a215e8a3
Add Homebrew installation to README ( #930 )
2022-11-27 21:37:34 -05:00
Charlie Marsh
aa1c884910
Tweak Flake8 parity in README
2022-11-27 21:34:47 -05:00
Oliver Margetts
7fb55c6d99
F50x implementation ( #919 )
2022-11-27 21:30:55 -05:00
Charlie Marsh
04ea523ad8
Track aliased import-from members ( #929 )
2022-11-27 17:27:27 -05:00
Charlie Marsh
9897f81cf3
Bump version to 0.0.141
2022-11-26 16:33:08 -05:00
Charlie Marsh
1a2559b001
Avoid flagging redundant open modes when open is rebound ( #918 )
2022-11-26 16:24:41 -05:00
Denis Gavrilyuk
721a1e9443
Add flake8-debugger ( #909 )
2022-11-26 16:21:03 -05:00
Charlie Marsh
f38bba18ee
Fix clippy warnings
2022-11-26 15:56:33 -05:00
Charlie Marsh
14cf36f922
Bump version to 0.0.140
2022-11-26 15:05:46 -05:00
Charlie Marsh
d28e026525
Preserve existing noqa codes in --add-noqa ( #913 )
2022-11-26 14:42:19 -05:00
Jonathan Plasse
d19a8aa54d
Auto-generate CheckCodePrefix::fixables() ( #916 )
2022-11-26 14:10:30 -05:00
Charlie Marsh
f299940452
Respect noqa comments in U009 ( #917 )
2022-11-26 14:03:18 -05:00
Charlie Marsh
e1ab7163ac
Respect f-string locations in B023 check ( #914 )
2022-11-26 10:31:23 -05:00
Jonathan Plasse
9edc479c6c
Fix F821 false positive ( #911 )
2022-11-26 10:12:07 -05:00
Charlie Marsh
560558b814
Bump version to 0.0.139
2022-11-25 18:38:26 -05:00
Andri Bergsson
bef601b994
Add keyword argument handling for redundant open modes. ( #906 )
2022-11-25 18:38:05 -05:00
Charlie Marsh
7445d00b88
Implement B023 (function uses loop variable) ( #907 )
2022-11-25 18:29:54 -05:00
Charlie Marsh
7c78d4e103
Use docstring comment for CheckCode
2022-11-25 13:15:43 -05:00
Oliver Margetts
8b14f1b8cc
Implement F522-F525 ( #899 )
2022-11-25 13:14:31 -05:00
Xuan (Sean) Hu
5a6b51e623
Minor changes in README. ( #903 )
2022-11-25 09:49:16 -05:00
Charlie Marsh
0b60242fb7
Bump version to 0.0.138
2022-11-25 00:05:41 -05:00
Charlie Marsh
65b77feeb8
Bump LibCST version
2022-11-25 00:05:03 -05:00
Charlie Marsh
04b9c0a31d
Fix cargo clippy
2022-11-24 23:40:43 -05:00
Harutaka Kawamura
49dc8231be
Fix typo ( #902 )
2022-11-24 23:38:45 -05:00
Charlie Marsh
92ca114882
Move some main.rs subcommands to a new module ( #901 )
2022-11-24 22:43:43 -05:00
Charlie Marsh
553bc7443a
Remove UserConfiguration struct ( #900 )
2022-11-24 22:39:07 -05:00
CelebrateVC
a3af6c1ea5
Implement GlobSet optimization for file path exclusions ( #883 )
2022-11-24 22:31:55 -05:00
Charlie Marsh
b50016fe89
Regenerate README.md
2022-11-24 18:10:07 -05:00
Oliver Margetts
2cf2805848
Implement F521 ( #898 )
2022-11-24 18:09:36 -05:00
Harutaka Kawamura
33fbef7700
Implement B904 ( #892 )
2022-11-24 09:49:57 -05:00
Charlie Marsh
68668a584b
Bump version to 0.0.137
2022-11-23 20:28:45 -05:00
Charlie Marsh
6cd8655d29
Treat withitem variables as bindings ( #897 )
2022-11-23 20:28:37 -05:00
Charlie Marsh
72a9bd3cfb
Revert "Upload wheels back to GitHub Releases ( #884 )"
...
This reverts commit bd08fc359d .
2022-11-23 20:27:33 -05:00
Charlie Marsh
58aac21a36
Bump version to 0.0.136
2022-11-23 17:41:17 -05:00
Charlie Marsh
77e0be3464
Visit iter prior to target in comprehensions ( #895 )
2022-11-23 10:13:21 -05:00
Charlie Marsh
bd08fc359d
Upload wheels back to GitHub Releases ( #884 )
2022-11-23 00:06:36 -05:00
Harutaka Kawamura
19ad6ab4f5
Add --explain ( #887 )
2022-11-23 00:06:25 -05:00
Charlie Marsh
4b2df99e78
Set rust-version in Cargo.toml ( #886 )
2022-11-22 23:33:39 -05:00
Charlie Marsh
66975876b2
Bump version to 0.0.135
2022-11-22 19:21:53 -05:00
Charlie Marsh
7316b120ba
Log errors in add_noqa and autoformat calls ( #881 )
2022-11-22 19:21:36 -05:00
Charlie Marsh
fec887e481
Apply a limit to the number of fix iterations ( #882 )
2022-11-22 19:21:31 -05:00
Charlie Marsh
bdd32c0850
Enforce most pedantic lints on CI ( #878 )
2022-11-22 18:55:57 -05:00
Charlie Marsh
10dcd5fd0a
Remove unused imports
2022-11-22 18:45:24 -05:00
Charlie Marsh
b922e6ecc8
Fix clippy::unnecessary_wraps (pedantic) ( #880 )
...
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
2022-11-22 18:25:30 -05:00
Charlie Marsh
f59799e0c4
Remove lingering empty lines
2022-11-22 17:54:24 -05:00
Charlie Marsh
814ddeb7ea
Remove always-inline ( #879 )
2022-11-22 17:13:25 -05:00
Charlie Marsh
9315b9f459
Remove Mode from various internal checkers ( #877 )
2022-11-22 16:57:47 -05:00
Charlie Marsh
113b5a10bf
Return Vec<Check> from check_tokens ( #876 )
2022-11-22 16:43:32 -05:00
Charlie Marsh
fe77fb70a1
Apply autofixes iteratively until code is stabilized ( #875 )
2022-11-22 16:37:52 -05:00
Charlie Marsh
c3f6170503
Update README with list of projects ( #874 )
2022-11-22 14:28:02 -05:00
Anders Kaseorg
a46160f0e2
Fix clippy::unreadable_literal (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#unreadable_literal
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
9a66cf2ffb
Fix clippy::uninlined_format_args (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
3205473612
Ignore clippy::struct_excessive_bools (pedantic)
...
“consider using a state machine or refactoring bools into two-variant
enums”
https://rust-lang.github.io/rust-clippy/master/index.html#struct_excessive_bools
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
0bb8b14ae1
Fix clippy::single_match_else (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
9cf4621071
Fix clippy::redundant_else (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
bbc9ed1b21
Fix clippy::redundant_closure_for_method_calls (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
517ca2604a
Fix clippy::needless_pass_by_value (pedantic)
...
“this argument is passed by value, but not consumed in the function
body”
https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
348ff509c0
Fix clippy::mut_mut (pedantic)
...
“this expression mutably borrows a mutable reference. Consider
reborrowing”
https://rust-lang.github.io/rust-clippy/master/index.html#mut_mut
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
fb545551f8
Fix clippy::match_bool (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
3b33a431d6
Fix clippy::map_unwrap_or (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
bc95690725
Fix clippy::manual_string_new (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#manual_string_new
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
9dc788d089
Fix clippy::let_underscore_drop (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#let_underscore_drop
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
15f63494a7
Fix clippy::items_after_statements (pedantic)
...
“adding items after statements is confusing, since items exist from
the start of the scope”
https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
68668c20e8
Fix clippy::if_not_else (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
9462335371
Fix clippy::from_iter_instead_of_collect (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
3dd6522b4f
Fix clippy::explicit_iter_loop (pedantic)
...
“it is more concise to loop over references to containers instead of
using explicit iteration methods”
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
6b935121a7
Fix clippy::explicit_deref_methods (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_deref_methods
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
8d9d9b3204
Fix clippy::documentation_markdown (pedantic)
...
https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
0a506eff34
Fix clippy::cloned_instead_of_copied (pedantic)
...
“used `cloned` where `copied` could be used instead”
https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
7c7489c1dd
Ignore clippy::cast_possible_truncation (pedantic)
...
“casting `usize` to `u8` may truncate the value”
https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
ae90eccb7f
Fix clippy::cast_lossless (pedantic)
...
“casting `bool` to `u8` is more cleanly stated with `u8::from(_)`”
https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
Signed-off-by: Anders Kaseorg <andersk@mit.edu >
2022-11-21 23:22:28 -05:00
Anders Kaseorg
7a61edbe46
Fix clippy::default-trait-access (pedantic) ( #867 )
2022-11-21 21:00:38 -05:00
Charlie Marsh
59615486d8
Bump version to 0.0.134
2022-11-21 16:15:23 -05:00
Andri Bergsson
ce116a80ad
Automatically remove redundant open modes #640 ( #843 )
2022-11-21 16:06:41 -05:00
Anders Kaseorg
731fba9006
Ignore clippy::unreadable-literal (pedantic) for CONFUSABLES ( #864 )
2022-11-21 16:00:05 -05:00
Anders Kaseorg
9bcf194fdc
Ignore clippy::match-same-arms (pedantic) in a few places ( #863 )
2022-11-21 15:59:58 -05:00
Anders Kaseorg
58949b564e
Fix clippy::trivially-copy-pass-by-ref (pedantic) ( #862 )
2022-11-21 15:59:51 -05:00
Anders Kaseorg
6b9e57fb78
Fix clippy::sort-unstable (pedantic) ( #861 )
2022-11-21 15:59:41 -05:00
Anders Kaseorg
cb119401a7
Fix clippy::inefficient-to-string (pedantic) ( #860 )
2022-11-21 15:59:35 -05:00
Charlie Marsh
0b9188011b
Bump version to 0.0.133
2022-11-21 13:39:37 -05:00
Anders Kaseorg
b657d912d9
Propagate errors from glob::Pattern::new ( #858 )
2022-11-21 13:39:19 -05:00
Charlie Marsh
1559671093
Target isort code in README.md
2022-11-21 13:38:01 -05:00
Charlie Marsh
70a53bf12b
Add unit tests for complexity check ( #859 )
2022-11-21 13:31:17 -05:00
Charlie Marsh
cd1e07f37c
Avoid incrementing McCabe complexity for class methods ( #857 )
2022-11-21 13:30:36 -05:00
Charlie Marsh
7bd6db62d9
Sort relative imports by parent level descending ( #856 )
2022-11-21 13:30:24 -05:00
Charlie Marsh
f8b49f308d
Upgrade RustPython ( #855 )
2022-11-21 13:20:03 -05:00
Charlie Marsh
b1f9c7b6bd
Update default complexity in README.md
2022-11-21 13:19:55 -05:00
Keming
0867d2ded9
Make it visible under light theme ( #854 )
2022-11-21 10:18:21 -05:00
messense
3f597a3b30
Upgrade maturin to 0.14 ( #846 )
2022-11-21 10:00:14 -05:00
Charlie Marsh
6733aad216
Avoid attempting to fix PEP 604 violations with deferred annotations ( #845 )
2022-11-20 21:41:54 -05:00
Harutaka Kawamura
89980ad651
Implement autofix for B013 ( #824 )
2022-11-20 18:49:07 -05:00
Charlie Marsh
38f896502a
Bump version to 0.0.132
2022-11-20 18:10:13 -05:00
Jonathan Plasse
7cab541343
Add convert exit() to sys.exit() rule ( #816 )
2022-11-20 18:09:40 -05:00
Charlie Marsh
1a3d2ead41
Support PEP 562 ( #841 )
2022-11-20 17:55:57 -05:00
Jonathan Plasse
f96c64b40d
Fix N804 class method with positional only args ( #836 )
2022-11-20 15:48:09 -05:00
Charlie Marsh
0791869451
Add RUF to list of fixable defaults ( #838 )
2022-11-20 15:40:14 -05:00
Charlie Marsh
965918744b
Replace FNV with rustc-hash ( #837 )
2022-11-20 15:38:31 -05:00
Charlie Marsh
6b4aedb366
Bump version to 0.0.131
2022-11-20 13:40:58 -05:00
Charlie Marsh
8123e3e94e
Remove extraneous Python file
2022-11-20 13:39:55 -05:00
Charlie Marsh
9f9a545c51
Improve cache performance by removing cacache dependency ( #833 )
2022-11-20 13:36:33 -05:00
Charlie Marsh
5bf8219db3
Make main.rs robust to cache initialization failures ( #831 )
2022-11-20 11:05:17 -05:00
Charlie Marsh
529513bf02
Add CACHEDIR.TAG to .ruff_cache ( #830 )
2022-11-20 10:53:31 -05:00
Charlie Marsh
124782771f
Bump version to 0.0.130
2022-11-20 10:37:19 -05:00
Charlie Marsh
98cab5cdba
Add class names to NamedTuple and TypedDict rules ( #829 )
2022-11-20 10:29:47 -05:00
Martin Lehoux
40f38c94a5
Implement U014: Convert NamedTuple function to class ( #819 )
2022-11-20 10:26:15 -05:00
Harutaka Kawamura
7839204bf7
Implement autofix for B010 ( #823 )
2022-11-20 10:14:29 -05:00
Jonathan Plasse
e63ea704f0
Adjust U011 start location ( #828 )
2022-11-20 10:13:29 -05:00
Charlie Marsh
4be09b45ea
Bump version to 0.0.129
2022-11-19 19:52:40 -05:00
Harutaka Kawamura
13e8ed0a0a
Implement autofix for E731 ( #814 )
2022-11-19 19:51:41 -05:00
Anders Kaseorg
4161d4ae32
Exempt parameters with immutable annotations from B006 ( #821 )
2022-11-19 19:46:08 -05:00
Charlie Marsh
99f7854d8c
Mark nonlocal variables as used in parent scopes ( #822 )
2022-11-19 19:21:02 -05:00
Harutaka Kawamura
a580d1a858
Adjust UnusedNOQA start location ( #817 )
2022-11-19 09:30:02 -05:00
Martin Lehoux
86806a9e39
U013: Also convert typing.TypedDict ( #810 )
2022-11-19 09:29:05 -05:00
Charlie Marsh
89afc9db74
Bump version to 0.0.128
2022-11-18 18:50:03 -05:00
Charlie Marsh
0f34cdb7a3
Enable customization of autofixable error codes ( #811 )
2022-11-18 18:49:13 -05:00
Charlie Marsh
437b6f23b9
Remove warn_on checks ( #812 )
2022-11-18 18:48:24 -05:00
Charlie Marsh
0fe2b15676
Change NotInTest to NotIsTest
2022-11-18 18:23:40 -05:00
Harutaka Kawamura
e81efa5a3d
Implement a --show-source setting ( #698 )
2022-11-18 14:02:29 -05:00
Charlie Marsh
49559da54e
Bump version to 0.0.127
2022-11-18 13:31:22 -05:00
Jonathan Plasse
b74fd1fe13
Change error code of flake8-blind-except ( #808 )
2022-11-18 13:30:36 -05:00
Charlie Marsh
9c4d24a452
Add flake8-boolean-trap to README
2022-11-18 12:36:13 -05:00
pwoolvett
7a4449eacb
Add flake8-boolean-trap ( #790 )
2022-11-18 12:30:07 -05:00
Charlie Marsh
ee31fa6109
Reduce newlines in code gen ( #807 )
2022-11-18 12:27:56 -05:00
Harutaka Kawamura
6ffe767252
Implement autofix for E713 and E714 ( #804 )
2022-11-18 12:16:11 -05:00
Jonathan Plasse
2f894e3951
Add flake8-blind-except ( #805 )
2022-11-18 12:15:10 -05:00
Charlie Marsh
589d923c99
Misc. follow-ups to #716 ( #806 )
2022-11-18 12:14:41 -05:00
Martin Lehoux
c5722d8a4d
Implement U013: Unnecessary TypedDict syntactic form ( #716 )
2022-11-18 12:10:47 -05:00
Jonathan Plasse
c2d6307e9b
Add missing plugins in some sections of README.md ( #802 )
2022-11-18 09:28:33 -05:00
Edgar R. M
f44fada446
Implement C901 (mccabe) ( #765 )
2022-11-17 17:40:50 -05:00
Charlie Marsh
6a6f4651aa
Bump version to 0.0.126
2022-11-17 17:19:19 -05:00
Charlie Marsh
66ae4db6cd
Ignore globals when checking local variable names ( #800 )
2022-11-17 17:19:01 -05:00
Charlie Marsh
801c76037f
Except BaseException from N818 checks ( #798 )
2022-11-17 15:04:42 -05:00
Charlie Marsh
ab825eb28d
Fix D202 to remove line after docstring ( #797 )
2022-11-17 15:01:58 -05:00
Charlie Marsh
826ef7da67
Trigger N818 when parent ends in Error or Exception ( #796 )
2022-11-17 14:51:40 -05:00
Charlie Marsh
72f5393d3a
Add flake8-tidy-imports to cache key
2022-11-17 14:46:45 -05:00
Charlie Marsh
6602f7f489
Trim dedented sections for arg detection ( #793 )
2022-11-17 12:55:55 -05:00
Charlie Marsh
aafddae644
Bump version to 0.0.125
2022-11-17 12:07:05 -05:00
Charlie Marsh
749df87de0
Tweak presentation of null-ls and efm docs ( #791 )
2022-11-17 12:04:11 -05:00
Eddie Bergman
d67db33f22
docs(integrations): neovim null-ls integration ( #782 )
2022-11-17 11:55:08 -05:00
Charlie Marsh
f0a54716e5
Implement flake8-tidy-imports ( #789 )
2022-11-17 11:44:06 -05:00
Harutaka Kawamura
c59e1ff0b5
Implement auto-fix for E711 and E712 ( #784 )
2022-11-17 11:43:44 -05:00
Jonathan Plasse
ecf858cf16
Add the tools identifier in the TOC ( #779 )
2022-11-17 11:34:32 -05:00
Jonathan Plasse
8063aee006
Remove unnecessary abspath rule (U002) ( #781 )
2022-11-17 11:29:42 -05:00
Anders Kaseorg
f1fee5d240
Propagate exit code through Python __main__ wrapper ( #776 )
2022-11-16 16:16:58 -05:00
Anders Kaseorg
d3155560df
Fix find_and_parse_pyproject_toml test for #772 ( #774 )
2022-11-16 13:47:25 -05:00
Charlie Marsh
90bfc4ec4d
Bump version to 0.0.124
2022-11-16 12:25:24 -05:00
Charlie Marsh
b04a6a3f7c
Support arbitrary expression paths for class and static decorators ( #772 )
2022-11-16 12:24:46 -05:00
Charlie Marsh
8ec14e7ee2
Bump version to 0.0.123
2022-11-16 12:06:01 -05:00
Charlie Marsh
17c5cd7c42
Fix off-by-one in noqa map detection ( #771 )
...
Fix off-by-one in noqa
2022-11-16 12:00:10 -05:00
Charlie Marsh
7d8360a1de
Change all &Option<> to Option<&> ( #768 )
2022-11-16 09:40:01 -05:00
Harutaka Kawamura
910ee523dd
Fix E731 ( #766 )
2022-11-16 09:17:14 -05:00
Charlie Marsh
72e35a535e
Run cargo fmt
2022-11-16 09:15:22 -05:00
Charlie Marsh
b4e1563517
Avoid allocations for binding values ( #764 )
2022-11-16 08:55:35 -05:00
Charlie Marsh
5717cc97d7
Add references to Flake8 licenses
2022-11-15 23:07:41 -05:00
Charlie Marsh
2c89a19f76
Bump Ruff version to 0.0.122
2022-11-15 22:03:46 -05:00
Charlie Marsh
82fea36bb3
Preserve comments when sorting imports ( #749 )
2022-11-15 22:02:52 -05:00
Charlie Marsh
63d63e8c12
Increase retry counts in GitHub Actions workflows ( #763 )
2022-11-15 17:21:16 -05:00
Charlie Marsh
9d136de55a
Bump version to 0.0.121
2022-11-15 16:18:39 -05:00
Harutaka Kawamura
1821c07367
Implement B020 ( #753 )
2022-11-15 16:17:03 -05:00
Charlie Marsh
1fe90ef7f4
Only notify once for each app update ( #762 )
2022-11-15 16:14:10 -05:00
Charlie Marsh
b5cb9485f6
Move updater to its own module
2022-11-15 15:51:24 -05:00
Charlie Marsh
4d798512b1
Only print version checks on tty ( #761 )
2022-11-15 15:36:06 -05:00
Charlie Marsh
5f9815b103
Disable auto-updates in JSON mode ( #760 )
2022-11-15 15:29:10 -05:00
Charlie Marsh
0d3fac1bf9
Add --line-length command line argument ( #759 )
2022-11-15 12:23:38 -05:00
Charlie Marsh
ff0e5f5cb4
Preserve scopes when checking deferred strings ( #758 )
2022-11-15 12:19:22 -05:00
Charlie Marsh
374d57d822
Limit PEP 604 checks to Python 3.10+ ( #757 )
2022-11-15 11:52:12 -05:00
Edgar R. M
85b2a9920f
docs: Add flake8-bandit to ToC ( #750 )
2022-11-15 00:11:39 -05:00
Charlie Marsh
3c22913470
Bump version to 0.0.120
2022-11-14 22:53:36 -05:00
Charlie Marsh
ea03a59b72
De-alias Literal checks ( #748 )
2022-11-14 22:53:23 -05:00
Charlie Marsh
058a5276b0
Bump version to 0.0.119
2022-11-14 21:45:41 -05:00
Charlie Marsh
62d4096be3
Move bindings to FNV map ( #747 )
2022-11-14 21:42:57 -05:00
Charlie Marsh
8961da7b89
Add support for import alias tracking ( #746 )
2022-11-14 21:29:30 -05:00
Brett Cannon
58bcffbe2d
Add isort to the README's ToC ( #745 )
2022-11-14 18:51:39 -05:00
Charlie Marsh
f67727b13c
Improve performance of import matching code ( #744 )
2022-11-14 17:14:22 -05:00
Charlie Marsh
fea029ae35
Bump version to 0.0.118
2022-11-14 13:21:27 -05:00
Harutaka Kawamura
3e3c3c7421
Ignore namedtuple assignment in N806, N815, and N816 ( #735 )
2022-11-14 13:21:04 -05:00
Harutaka Kawamura
9047bf680d
Implement B024 and B027 ( #738 )
2022-11-14 13:12:23 -05:00
Charlie Marsh
d170388b7b
Allow second line as 'first line' for punctuation ( #741 )
2022-11-14 13:07:27 -05:00
Charlie Marsh
502d3316f9
Add flake8-bugbear settings to hash ( #739 )
2022-11-14 12:29:47 -05:00
Harutaka Kawamura
a8159f9893
Implement B022 ( #734 )
2022-11-14 09:24:05 -05:00
Charlie Marsh
71f727c380
Use FNV hasher in more places ( #732 )
2022-11-13 23:44:16 -05:00
Charlie Marsh
ce3c45a361
Make combine-as-imports the default import sorting behavior ( #731 )
2022-11-13 23:07:13 -05:00
Charlie Marsh
29ae6c159d
Add FastAPI to README ( #730 )
2022-11-13 22:27:35 -05:00
Charlie Marsh
1ae07b4c70
Allow explicit re-export of straight imports ( #729 )
2022-11-13 22:26:48 -05:00
Charlie Marsh
08ca8788a7
Bump version to 0.0.117
2022-11-13 16:10:29 -05:00
Charlie Marsh
8a97a76038
Make # noqa detection case-insensitive ( #728 )
2022-11-13 16:09:44 -05:00
Brett Cannon
d2d84cf5bf
Fix Markdown in README ( #727 )
2022-11-13 15:19:25 -05:00
Anders Kaseorg
450970e0e6
Restore clippy on all crates in the workspace ( #725 )
2022-11-13 15:18:57 -05:00
Charlie Marsh
34ecc69914
Don't mark re-exported symbols as unused ( #724 )
2022-11-13 14:31:43 -05:00
Charlie Marsh
a310aed128
Bump version to 0.0.116
2022-11-13 13:46:05 -05:00
Harutaka Kawamura
43cc8bc84e
Lint test code ( #721 )
2022-11-13 11:55:57 -05:00
Harutaka Kawamura
84bf36194b
Implement B012 ( #718 )
2022-11-13 11:55:33 -05:00
Harutaka Kawamura
e4d168bb4f
Implement B021 ( #719 )
2022-11-13 11:40:24 -05:00
Charlie Marsh
439642addf
Regenerate README
2022-11-13 10:55:14 -05:00
Charlie Marsh
f5b1f957e3
Improve some import tracking code ( #715 )
2022-11-13 00:10:13 -05:00
Charlie Marsh
8f99705795
Make some error messages more grammatically consistent
2022-11-12 16:57:23 -05:00
Charlie Marsh
9ec7e6bcd6
Add function name to B008 message
2022-11-12 16:53:13 -05:00
Charlie Marsh
695b06ba60
Bump version to 0.0.115
2022-11-12 16:46:26 -05:00
Charlie Marsh
3a2e6926d4
Include flake8-bugbear settings in flake8-to-ruff ( #712 )
2022-11-12 16:46:12 -05:00
Charlie Marsh
d16c3a1186
Use an FNVHashSet for settings.enabled ( #711 )
2022-11-12 16:36:56 -05:00
Charlie Marsh
53a2187f02
Run cargo fmt
2022-11-12 16:33:12 -05:00
Charlie Marsh
00b5d1059c
Validate that mutable and immutable defaults are imported ( #710 )
2022-11-12 16:32:21 -05:00
Charlie Marsh
b7acf76aaf
Track all import-from members ( #709 )
2022-11-12 16:10:43 -05:00
Charlie Marsh
8cfc0e5cf5
Use FnvHasher for unordered maps and sets ( #708 )
2022-11-12 16:09:34 -05:00
Edgar R. M
aa7681f9ad
Add extend-immutable-calls setting for B008 ( #706 )
2022-11-12 15:48:34 -05:00
Charlie Marsh
2493d48725
Add flake8-bandit to flake8-to-ruff ( #701 )
2022-11-12 12:08:15 -05:00
Edgar R. M
1b422a7f12
Add flake8-bandit ( #697 )
2022-11-12 12:04:49 -05:00
Charlie Marsh
da051624e4
Add backticks around functools.lru_cache
2022-11-12 11:56:23 -05:00
Charlie Marsh
da9ae6a42a
Bump version to 0.0.114
2022-11-12 11:55:18 -05:00
Martin Lehoux
afa59d78bb
feat: no unnecessary encode utf8 ( #686 )
2022-11-12 11:54:36 -05:00
Charlie Marsh
bbc38fea73
Avoid generating empty statement bodies ( #700 )
2022-11-12 11:39:09 -05:00
Chammika Mannakkara
6bcc11a90f
add fixes for __future__ import removal ( #682 )
2022-11-12 11:28:05 -05:00
Harutaka Kawamura
6f36e5dd25
Implement B019 ( #695 )
2022-11-12 11:14:03 -05:00
Anders Kaseorg
1d13752eb1
Remove static isort classifications for __main__, disutils ( #694 )
2022-11-12 09:13:38 -05:00
Anders Kaseorg
394af0dcff
Disable default features of chrono ( #696 )
2022-11-12 09:02:02 -05:00
Charlie Marsh
51cee471a0
Add test case for import-from wrapping
2022-11-11 23:46:19 -05:00
Charlie Marsh
8df3a5437a
Take indentation into account for import-from wrapping ( #693 )
2022-11-11 23:45:04 -05:00
Charlie Marsh
a21fe716f2
Bump version to 0.0.113
2022-11-11 22:42:02 -05:00
Charlie Marsh
558883299a
Default to isort's import sort logic ( #691 )
2022-11-11 22:41:39 -05:00
Charlie Marsh
048a13c795
Add a separate local folder category for imports ( #690 )
2022-11-11 22:12:48 -05:00
Anders Kaseorg
5a8b7c1d20
Implement flake8-2020 (sys.version, sys.version_info misuse) ( #688 )
2022-11-11 20:39:37 -05:00
Charlie Marsh
f8932ec12b
Add some TODOs around import tracking
2022-11-11 19:07:40 -05:00
Charlie Marsh
2e7878ff48
Bump version to 0.0.112
2022-11-11 17:13:04 -05:00
Anders Kaseorg
5113ded22a
Add ruff.__main__ wrapper to allow invocation as ‘python -m ruff’ ( #687 )
2022-11-11 15:53:42 -05:00
Anders Kaseorg
bf7bf7aa17
Only scan checks once in check_lines ( #679 )
2022-11-11 13:34:23 -05:00
Charlie Marsh
560c00ff9d
Bump version to 0.0.111
2022-11-11 12:38:23 -05:00
Charlie Marsh
befe64a10e
Support isort: skip, isort: on, and isort: off ( #678 )
2022-11-11 12:38:01 -05:00
Charlie Marsh
4eccfdeb69
Fix lambda handling for B010 ( #685 )
2022-11-11 11:18:23 -05:00
Charlie Marsh
4123ba9851
Add backticks around setattr
2022-11-11 11:08:22 -05:00
Harutaka Kawamura
e727c24f79
Implement autofix for B009 ( #684 )
2022-11-11 11:06:47 -05:00
Harutaka Kawamura
bd3b40688f
Implement B010 ( #683 )
2022-11-11 10:26:37 -05:00
Charlie Marsh
b5549382a7
Clarify a few settings for isort behavior ( #676 )
2022-11-10 23:19:51 -05:00
Charlie Marsh
8cf745045f
Bump version to 0.0.110
2022-11-10 19:22:45 -05:00
Charlie Marsh
f6992cc98c
Add a test utility for running lint checks ( #672 )
2022-11-10 19:22:00 -05:00
Charlie Marsh
3cc74c0564
Implement import sorting ( #633 )
2022-11-10 19:05:56 -05:00
Charlie Marsh
887b9aa840
Rename some fixture files ( #671 )
2022-11-10 17:28:10 -05:00
Charlie Marsh
faf8556a5c
Limit Ropey to newlines and carriage returns ( #670 )
2022-11-10 17:25:30 -05:00
Harutaka Kawamura
1888f6d41b
Implement B009 ( #669 )
2022-11-10 13:52:20 -05:00
Charlie Marsh
9d8cd2d2fe
Bump version to 0.0.109
2022-11-10 10:54:27 -05:00
Harutaka Kawamura
05c19f0091
Implement B026 ( #668 )
2022-11-10 10:47:42 -05:00
Chammika Mannakkara
8213b64ad5
Fix unnecessary params in lru_cache ( #667 )
2022-11-10 10:45:12 -05:00
Chammika Mannakkara
ff0f5968fa
Detect unnecessary params in lru_cache ( #664 )
2022-11-09 10:02:48 -05:00
Charlie Marsh
6c17670aa5
Upgrade LibCST and other crates ( #663 )
2022-11-08 17:42:12 -05:00
Charlie Marsh
1347b7ebb6
Add notes to README on editor integrations ( #655 )
2022-11-08 16:12:42 -05:00
Reiner Gerecke
f40609f524
Implement autofix for C413 ( #661 )
2022-11-08 16:12:29 -05:00
Charlie Marsh
f572acab30
Bump version to 0.0.108
2022-11-08 13:20:35 -05:00
Charlie Marsh
1eb5f3ea75
Support allow_star_arg_any in flake8-to-ruff
2022-11-08 09:51:11 -05:00
Edgar R. M
24aa177912
Implement ANN401 ( #657 )
2022-11-08 09:49:44 -05:00
Reiner Gerecke
2ddc768412
Implement fix for C404 ( #656 )
2022-11-08 09:37:17 -05:00
Chammika Mannakkara
0f9508f549
Remove unnecessary __future__ imports ( #634 )
2022-11-07 22:26:57 -05:00
Charlie Marsh
7c3d387abd
Implement confusing unicode character detection for comments ( #653 )
2022-11-07 21:16:34 -05:00
Charlie Marsh
d600650214
Upgrade RustPython ( #652 )
2022-11-07 21:07:49 -05:00
Charlie Marsh
43383bb696
Bump version to 0.0.107
2022-11-07 16:39:03 -05:00
Charlie Marsh
ff83f356af
Fix failing flake8-to-ruff tests
2022-11-07 16:38:46 -05:00
Anders Kaseorg
89622425d4
Run annotations plugin if ANN204, ANN205, ANN206 are selected ( #649 )
2022-11-07 16:37:49 -05:00
Charlie Marsh
1aafe31c00
Avoid U009 violations when disabled ( #650 )
2022-11-07 16:36:39 -05:00
Charlie Marsh
16c5ac1e91
Bump version to 0.0.106
2022-11-07 15:32:54 -05:00
Charlie Marsh
da39cddccb
Include function and argument names in ANN checks ( #648 )
2022-11-07 15:27:03 -05:00
Charlie Marsh
de6435f41d
Add a flake8-to-ruff mention ( #644 )
2022-11-07 10:59:47 -05:00
Charlie Marsh
589ae48f8c
Update --help
2022-11-07 10:41:04 -05:00
Harutaka Kawamura
35cc3094b5
Implement B005 ( #643 )
2022-11-07 10:10:59 -05:00
Charlie Marsh
07c9fc55f6
Add fix option to pyproject.toml ( #639 )
2022-11-07 09:46:21 -05:00
Harutaka Kawamura
7773e9728b
Implement B004 ( #638 )
2022-11-07 09:25:09 -05:00
Charlie Marsh
8fc435bad9
Fix --ignore for ANN101 and ANN102 ( #637 )
2022-11-07 09:03:09 -05:00
Charlie Marsh
dd20b23576
Infer plugins based on per-file-ignores, ignores, etc. ( #632 )
2022-11-06 22:39:06 -05:00
Charlie Marsh
da8ee1df3e
Add TODO in flake8_annotations
2022-11-06 21:24:46 -05:00
Charlie Marsh
7f77ed0f86
Bump version to 0.0.105
2022-11-06 21:17:00 -05:00
Charlie Marsh
1b33cfb9cb
Respect project root in per-file ignores ( #631 )
2022-11-06 21:15:49 -05:00
Charlie Marsh
dbc64f1faa
Remove erroneous Literal entry from subscript list ( #630 )
2022-11-06 21:03:41 -05:00
Charlie Marsh
f4b5f0d259
Remove foo.py
2022-11-06 21:03:23 -05:00
Charlie Marsh
85b882fc54
Remove CheckLocator abstraction ( #627 )
2022-11-06 17:42:10 -05:00
Charlie Marsh
99d9aa61bf
Implement flake8-annotations ( #625 )
2022-11-06 17:25:49 -05:00
Charlie Marsh
050f34dd25
Bump version to 0.0.104
2022-11-06 15:31:10 -05:00
Charlie Marsh
1cd82d588b
Categorize functions in pep8-naming ( #624 )
2022-11-06 15:29:49 -05:00
Charlie Marsh
cea9e34942
Update CONTRIBUTING.md ( #623 )
2022-11-06 14:31:16 -05:00
Reiner Gerecke
1ede377402
Improve discoverability of dev commands ( #621 )
2022-11-06 14:25:59 -05:00
Reiner Gerecke
82eff641fb
Remove utf-8 encoding declaration ( #618 )
2022-11-06 14:23:06 -05:00
Charlie Marsh
eb1bc9f092
Allow underscore names in N803 ( #622 )
2022-11-06 14:19:02 -05:00
Reiner Gerecke
df88504dea
pyflakes F632 Autofix ( #612 )
2022-11-06 06:57:46 -05:00
Anders Kaseorg
b9ec3e9137
Correct source link in CONFUSABLES comment ( #617 )
2022-11-05 20:53:05 -04:00
Anders Kaseorg
b067b665ff
Fix B015 false positive on comparison deep inside expression statement ( #616 )
2022-11-05 20:13:22 -04:00
Charlie Marsh
22cfd03b13
Bump ruff_dev to v0.0.103
2022-11-05 19:53:27 -04:00
Charlie Marsh
3ae408a364
Only track noqa directives for multi-line strings ( #615 )
2022-11-05 19:53:13 -04:00
Anders Kaseorg
95073b1586
Fix “Code” misspelling ( #614 )
2022-11-05 19:28:52 -04:00
Charlie Marsh
3597a94818
Add a README link to each plugin ( #611 )
2022-11-05 16:18:27 -04:00
Charlie Marsh
2727e5f3b7
Remove some usages of Ruff internals in ruff_dev ( #610 )
2022-11-05 16:07:21 -04:00
Charlie Marsh
de53b567f5
Add a list of projects using Ruff ( #608 )
2022-11-05 16:03:10 -04:00
Charlie Marsh
21479a151d
Bump ruff_dev to v0.0.102
2022-11-05 16:00:24 -04:00
Charlie Marsh
d822458d97
Fix reference to src/checks_gen.rs
2022-11-05 15:59:51 -04:00
Charlie Marsh
6741ea9790
Create a separate dev crate for development scripts ( #607 )
2022-11-05 15:59:18 -04:00
Charlie Marsh
2e1799dd80
Automatically update README.md from generate_rules_table.rs ( #606 )
2022-11-05 15:33:47 -04:00
Reiner Gerecke
c48c7669a8
Remove rust version from CONTRIBUTING.md ( #605 )
2022-11-05 15:03:10 -04:00
Charlie Marsh
d5fbcd708d
Automatically write to src/checks_gen.rs ( #604 )
2022-11-05 14:30:18 -04:00
Charlie Marsh
b335a6a5ec
Bump version to 0.0.102
2022-11-05 14:13:02 -04:00
Charlie Marsh
f5cbee452a
Increase flake8-bugbear count to 15/32
2022-11-05 14:12:35 -04:00
Harutaka Kawamura
5d1ea4410a
Ignore ellipsis in B018 ( #598 )
2022-11-05 14:11:44 -04:00
Harutaka Kawamura
f27163d2c7
Remove needless return ( #597 )
2022-11-05 14:11:26 -04:00
Harutaka Kawamura
62c126f70e
Implement B003 ( #596 )
2022-11-05 14:08:02 -04:00
Harutaka Kawamura
8344d5151c
Implement B016 ( #595 )
2022-11-05 14:06:00 -04:00
Harutaka Kawamura
f7780eb720
Implement B008 ( #594 )
2022-11-05 14:05:04 -04:00
Charlie Marsh
c544d84b46
Rely on token locations for noqa map extraction ( #603 )
2022-11-05 10:51:19 -04:00
Charlie Marsh
fbdc075e5c
Change Ruff's error prefix to RUF ( #592 )
2022-11-04 23:13:50 -04:00
Charlie Marsh
d3472104d0
Bump flake8-bugbear count to 12/32
2022-11-04 14:49:14 -04:00
Charlie Marsh
0c8b981216
Bump version to 0.0.101
2022-11-04 14:46:48 -04:00
Charlie Marsh
0e3f08aa68
Split ambiguous unicode detection into string vs. docstring rules ( #590 )
2022-11-04 14:46:20 -04:00
Charlie Marsh
a75b1c85ee
Fix invalid escape handling for CRLF files ( #589 )
2022-11-04 14:26:39 -04:00
Harutaka Kawamura
726e6c68cf
Implement B015 ( #587 )
2022-11-04 13:47:52 -04:00
Charlie Marsh
34c91224d7
Bump version to 0.0.100
2022-11-04 12:10:17 -04:00
Charlie Marsh
50c4bbc52b
Implement ambiguous unicode character detection ( #578 )
2022-11-04 12:08:26 -04:00
Charlie Marsh
f0239de559
Use a shared Rope between AST checker and fixer ( #585 )
2022-11-04 12:05:46 -04:00
Charlie Marsh
2be632f3cc
Use a Rope to power fixer ( #584 )
2022-11-04 12:04:14 -04:00
Harutaka Kawamura
ec3fed5a61
Implement B018 ( #582 )
2022-11-04 10:53:30 -04:00
Charlie Marsh
1da44485d5
Confine subscript annotation checks to ExprContext::Load ( #583 )
2022-11-04 10:51:05 -04:00
Charlie Marsh
e5f30ff5a8
Use a rope to manage string slicing ( #576 )
2022-11-03 23:23:38 -04:00
Charlie Marsh
c92f5c14a3
Bump Rust version to 1.65.0 ( #575 )
2022-11-03 22:49:21 -04:00
Charlie Marsh
2f92399f4e
Add W to list of default flake8-to-ruff codes ( #574 )
2022-11-03 22:13:00 -04:00
Charlie Marsh
83dfb5fe8b
Infer Flake8 plugins from .flake8 config ( #573 )
2022-11-03 22:05:46 -04:00
Charlie Marsh
cc915371ca
Implement autofix for F901 ( #571 )
2022-11-03 11:58:54 -04:00
Charlie Marsh
5576db3d5a
Bump version to 0.0.99
2022-11-03 11:47:15 -04:00
Charlie Marsh
f26f38d023
Enable autofix for C406 ( #570 )
2022-11-03 11:27:46 -04:00
Charlie Marsh
578ec4d843
Implement autofix for C416 ( #568 )
2022-11-03 11:05:08 -04:00
Charlie Marsh
2f3bebe5a2
Enable autofix for dict(a=1)-like dictionaries ( #567 )
2022-11-03 10:42:54 -04:00
Charlie Marsh
22991e3e0e
Bump version to 0.0.98
2022-11-03 10:09:33 -04:00
Charlie Marsh
242bdf86b1
Use ::ruff to ensure ruff imports come first
2022-11-03 10:09:28 -04:00
Charlie Marsh
a3f7de2257
Make --quiet more aggressive ( #566 )
2022-11-03 10:08:15 -04:00
Charlie Marsh
9f9cbb5520
Improve pyproject.toml examples in README.md
2022-11-03 09:33:17 -04:00
Charlie Marsh
937c83d57f
Remove crates subdirectory ( #563 )
2022-11-03 09:19:54 -04:00
Charlie Marsh
e00bcd19f5
Bump version to 0.0.97
2022-11-02 22:38:43 -04:00
Charlie Marsh
4550581be2
Relax lowercase condition in N806 ( #562 )
2022-11-02 22:38:29 -04:00
Charlie Marsh
b42d77a4c6
Avoid autofixes for errors in f-strings ( #561 )
2022-11-02 22:31:57 -04:00
Charlie Marsh
e473df1fe9
Bump version to 0.0.96
2022-11-02 22:10:56 -04:00
Charlie Marsh
d448281b33
Add plugin properties to settings cache key ( #559 )
2022-11-02 22:10:01 -04:00
Charlie Marsh
94597fefc1
Change flake8-quotes default to double quotes ( #558 )
2022-11-02 22:03:54 -04:00
Charlie Marsh
add0bdeeb7
DRY up utilities in flake8_comprehensions/fixes.rs ( #556 )
2022-11-02 22:00:53 -04:00
Charlie Marsh
6a180b95d1
Implement autofix for dict and tuple comprehensions ( #555 )
2022-11-02 21:36:20 -04:00
Charlie Marsh
416c338237
Respect trailing whitespace in comprehension fixes ( #554 )
2022-11-02 21:08:17 -04:00
Charlie Marsh
9948be0145
Automatically fix a variety of comprehension rules ( #553 )
2022-11-02 20:39:35 -04:00
Charlie Marsh
f50ff61056
Expose autofix mode in public API ( #551 )
2022-11-02 09:44:46 -04:00
Charlie Marsh
017fec2bc5
Set override in actions-rs/toolchain@v1 ( #543 )
2022-11-02 09:36:22 -04:00