Zeddicus414
fda93c6245
Add E722 bare-except documentation ( #2796 )
2023-02-12 16:51:32 +00:00
Charlie Marsh
099d5414f2
Allow non-verbose raise when cause is present ( #2816 )
...
The motivating issue here is of the following form:
```py
try:
raise Exception("We want to hide this error message")
except Exception:
try:
raise Exception("We want to show this")
except Exception as exc:
raise exc from None
```
However, I think we should avoid this if _any_ cause is present, since causes require a named exception.
Closes #2814 .
2023-02-12 16:48:13 +00:00
Charlie Marsh
9ddd5e4cfe
Allow private accesses on super calls ( #2815 )
2023-02-12 16:11:25 +00:00
Simon Brugman
1d4422f004
[flake8-comprehensions
] improve autofix for C401, C402 and C417 ( #2806 )
2023-02-12 16:03:37 +00:00
Simon Brugman
2dccb7611a
[flake8-comprehensions
] bugfix for C413 autofix ( #2804 )
2023-02-12 15:56:07 +00:00
Simon Brugman
0123425be1
[flake8-comprehensions
] autofix C414 and C417 + bugfix ( #2693 )
...
Closes https://github.com/charliermarsh/ruff/issues/2262 and closes https://github.com/charliermarsh/ruff/issues/2423
Fixes bug where some cases generated duplicated violations (see https://github.com/charliermarsh/ruff/pull/2732#issuecomment-1426397842 )
2023-02-12 05:20:42 +00:00
Charlie Marsh
c53f91d943
Remove public re-export of commands ( #2801 )
2023-02-12 04:59:35 +00:00
Charlie Marsh
4a12ebb9b1
Improve f-string-missing-placeholders documentation ( #2800 )
2023-02-12 04:58:24 +00:00
Martin Fischer
0e4d5eeea7
Implement config subcommand
...
The synopsis is as follows.
List all top-level config keys:
$ ruff config
allowed-confusables
builtins
cache-dir
... etc.
List all config keys in a specific section:
$ ruff config mccabe
max-complexity
Describe a specific config option:
$ ruff config mccabe.max-complexity
The maximum McCabe complexity to allow before triggering `C901` errors.
Default value: 10
Type: int
Example usage:
```toml
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 5
```
2023-02-11 23:43:09 -05:00
Martin Fischer
bbe44360e8
refactor: Move name out of OptionField & OptionGroup
2023-02-11 23:43:09 -05:00
Martin Fischer
37e80d98ab
refactor: Reorder members in ruff::settings::options_base
2023-02-11 23:43:09 -05:00
Charlie Marsh
306393063d
Refactor generator to use Astor-derived precedence levels ( #2798 )
2023-02-12 04:30:16 +00:00
Martin Fischer
f5a3c90288
Rename new ruff rule
output format to "pretty"
...
The new `ruff rule` output format introduced in
551b810aeb
doesn't print Markdown but
rather some rich text with escape sequences for colors and links,
it's actually the "text" format that prints Markdown, so naming the new
format "markdown" is very confusing. This commit therefore renames it to
"pretty".
This isn't a breaking change since there hasn't been a release yet.
2023-02-11 23:23:37 -05:00
Charlie Marsh
8289ede00f
Use output-stdout pattern for linter command ( #2794 )
2023-02-12 03:09:03 +00:00
Charlie Marsh
77e65c9ff5
Split commands.rs into separate files ( #2792 )
2023-02-12 02:58:13 +00:00
Charlie Marsh
418808895e
Add docs for f-string-missing-placeholders and unused-variable ( #2790 )
2023-02-12 02:48:36 +00:00
Nick Pope
551b810aeb
Add rendering of rule markdown for terminal output ( #2747 )
...
Add rendering of rule markdown for terminal output
This is achieved by making use of the `mdcat` crate.
See the following links for details:
- https://crates.io/crates/mdcat
- https://github.com/swsnr/mdcat
- https://docs.rs/mdcat/latest/mdcat/
2023-02-12 02:32:45 +00:00
Charlie Marsh
1b61d4e18b
Support unused variable removal in multi-assignment statements ( #2786 )
2023-02-12 00:53:11 +00:00
Charlie Marsh
752c0150e1
Improve unused-variable autofixes for with statements ( #2785 )
2023-02-12 00:38:14 +00:00
Charlie Marsh
81651a8479
Respect continuations in noqa
enforcement ( #2783 )
2023-02-11 23:29:37 +00:00
Charlie Marsh
86d0749ed7
Use consistent formatting for lint-failure messages ( #2782 )
2023-02-11 22:52:18 +00:00
Charlie Marsh
19fc410683
Remove raw string from hardcoded-sql-expression ( #2780 )
2023-02-11 20:05:57 +00:00
Charlie Marsh
5a70a573cd
Avoid treating deferred string annotations as required-at-runtime ( #2779 )
2023-02-11 15:00:08 -05:00
Charlie Marsh
74731a3456
Fix reference to ban-relative-imports setting ( #2776 )
2023-02-11 18:34:25 +00:00
Micha Reiser
863e39fe5f
perf: Use custom allocator ( #2768 )
...
This PR replaces the system allocator with a custom allocator to improve performance:
* Windows: mimalloc
* Unix: tikv-jemallocator
## Performance:
* Linux
* `cpython --no-cache`: 208.8ms -> 190.5ms
* `cpython`: 32.8ms -> 31ms
* Mac:
* `cpython --no-cache`: 436.3ms -> 380ms
* `cpython`: 40.9ms -> 39.6ms
* Windows:
* `cpython --no-cache`: 367ms -> 268ms
* `cpython`: 92.5ms -> 92.3ms
## Size
* Linux: +5MB from 13MB -> 18MB (I need to double check this)
* Mac: +0.7MB from 8.3MB-> 9MB
* Windows: -0.16MB from 8.29MB -> 8.13MB (that's unexpected)
2023-02-11 13:26:07 -05:00
Charlie Marsh
d0f9ee33ec
Remove erroneous print statements
2023-02-11 12:45:40 -05:00
Charlie Marsh
1cf3d880a7
Don't treat all future import accesses as non-runtime ( #2774 )
...
This was just an oversight and misunderstanding on my part. We had some helpful tests, but I misunderstood the "right" behavior so thought they were passing.
Closes #2761 .
2023-02-11 12:44:15 -05:00
Charlie Marsh
ffb4e89a98
Remove multiple-statements-on-one-line-def (E704) ( #2773 )
2023-02-11 12:34:21 -05:00
Charlie Marsh
43b7ee215c
Ignore colon-after-lambda in compound statement rules ( #2771 )
2023-02-11 12:22:53 -05:00
Michał Mrówka
77099dcd4d
implemented option lines-between-types for isort ( #2762 )
...
Fixes #2585
Add support for the isort option [lines_between_types](https://pycqa.github.io/isort/docs/configuration/options.html#lines-between-types )
2023-02-11 12:17:37 -05:00
Martin Fischer
70ff65154d
Rename function-is-too-complex to complex-structure
2023-02-11 12:05:17 -05:00
Martin Fischer
7db6a2d6d4
Rename rules containing PEP reference in name
2023-02-11 12:05:17 -05:00
Martin Fischer
42924c0d9a
Rename a bunch of pydocstyle rules
2023-02-11 12:05:17 -05:00
Martin Fischer
31d00936ee
Drop no- from no-unnecessary-* rule names
2023-02-11 12:05:17 -05:00
Martin Fischer
c3c5d9a852
Rename nested-if-statements to collapsible-if
2023-02-11 12:05:17 -05:00
Martin Fischer
7e5c19385c
Rename return-bool-condition-directly to needless-bool
2023-02-11 12:05:17 -05:00
Charlie Marsh
24faabf1f4
Bump version to 0.0.245
2023-02-10 22:15:27 -05:00
Charlie Marsh
9fd29e2c54
Mention default in relative-imports doc
2023-02-10 22:12:22 -05:00
Simon Brugman
e83ed0ecba
Implement autofix for relative imports (TID252) ( #2739 )
2023-02-10 22:05:47 -05:00
Charlie Marsh
dadbfea497
Flag private member accesses on calls et al ( #2753 )
2023-02-10 19:23:22 -05:00
Nick Pope
9f84c497f9
Adjust heading level in rule documentation ( #2749 )
2023-02-10 19:10:42 -05:00
Martin Fischer
0ec25d1514
Rename dynamically-typed-expression to any-type ( #2751 )
2023-02-10 19:02:31 -05:00
Charlie Marsh
6a87c99004
Use explicit fields for implicit-namespace-package
2023-02-10 18:09:30 -05:00
Charlie Marsh
c8f60c9588
Improve implicit-namespace-package documentation
2023-02-10 18:06:48 -05:00
Charlie Marsh
113610a8d4
Improve hardcoded-sql-expression documentation
2023-02-10 18:03:01 -05:00
Charlie Marsh
6376e5915e
Improve dynamically-typed-expression documentation
2023-02-10 17:55:26 -05:00
Charlie Marsh
3d8fb5be20
Rewrite documentation for yield-in-init ( #2748 )
2023-02-10 17:49:55 -05:00
Charlie Marsh
0040991778
Respect NO_COLOR flags in --show-source ( #2750 )
2023-02-10 17:27:40 -05:00
Charlie Marsh
6eb9268675
Allow named unicodes in bidirectional escape check ( #2710 )
2023-02-10 16:59:28 -05:00
Charlie Marsh
e5f5142e3e
Improve yield-in-init documentation
2023-02-10 16:47:44 -05:00