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