shed doesn't reformat .pyi files
jakkdl opened this issue ยท 3 comments
jakkdl commented
autoflake.is_python_file
doesn't care about .pyi
as a file ending, but I don't see why that's the case. Running Black or isort manually they both reformat .pyi
, but shed uses autoflake's check and totally ignores them. I'm not sure if autoflake should fix it upstream, and/or if shed should reimplement is_python_file
itself (or take it from isort/black/etc if they have one).
auscompgeek commented
It seems odd that autoflake ignores .pyi files. Surely pyflakes and autoflake will run fine on type stubs.
Zac-HD commented
Black also has a separate .pyi formatting mode, but I think the other wrapped tools are mostly just fine to operate on .pyi stubs too. Supporting this would be a new feature:
- Add a new
is_pyi: bool = False
argument to theshed()
function - Add
.pyi
to the known extensions in_should_format()
, and definewriter
as a partial in this case , to passis_pyi
- Don't pass this further down to docstring formatting.
- If
is_pyi
, pass the corresponding argument toblack.Mode()
and don't refactor even if passedrefactor=True
- In our readme, add
pyi
to thetypes_or
list in our example pre-commit config