@@ -27,24 +27,33 @@ line-length = 130
2727target-version = " py39"
2828
2929[tool .ruff .lint ]
30- # TODO: Use extend-select instead to get base E and F rules that don't conflict with the formatter
31- select = [
30+ extend-select = [
3231 " FA" , # flake8-future-annotations
3332 " I" , # isort
3433 " PYI" , # flake8-pyi
3534 " UP" , # pyupgrade
35+ " W" , # pycodestyle Warning
3636]
3737ignore = [
3838 # ##
3939 # Rules we don't want or don't agree with
4040 # ##
4141
42+ # Used for direct, non-subclass type comparison, for example: `type(val) is str`
43+ # see https://github.com/astral-sh/ruff/issues/6465
44+ " E721" , # Do not compare types, use `isinstance()`
45+
4246 # Typeshed doesn't want complex or non-literal defaults, or long strings, for maintenance and testing reasons.
4347 # This doesn't affect us, let's have more complete stubs.
4448 " PYI011" ,
4549 " PYI014" ,
4650 " PYI053" ,
4751
52+ # TODO: Fixing these would change which symbols are even visible for Pylance.
53+ # Which may negatively affect users, especially if the symbol wasn't meant to be re-exported.
54+ # Manually evaluate each violation.
55+ " F401" ,
56+
4857 # TODO: Investigate and fix or configure
4958 " PYI001" ,
5059 " PYI002" ,
@@ -55,8 +64,18 @@ ignore = [
5564 " PYI051" , # Request for autofix: https://github.com/astral-sh/ruff/issues/14185
5665 " PYI052" ,
5766]
58-
5967[tool .ruff .lint .per-file-ignores ]
68+ "*.pyi" = [
69+ # ##
70+ # Rules that are out of the control of stub authors:
71+ # ##
72+ " E743" , # Ambiguous function name; stubs must follow implementation
73+ " F403" , # `from . import *` used; unable to detect undefined names
74+ # Stubs can sometimes re-export entire modules.
75+ # Issues with using a star-imported name will be caught by type-checkers.
76+ " F405" , # may be undefined, or defined from star imports
77+ ]
78+
6079# We keep docstrings in sklearn
6180"stubs/sklearn/**" = [" PYI021" ]
6281
0 commit comments