refurb icon indicating copy to clipboard operation
refurb copied to clipboard

Package as a Flake 8 Plugin

Open krid opened this issue 2 years ago • 6 comments

Refurb would make a lovely addition to the Flake 8 toolbox. We're already using that for our project, so it would be nice to add refurb in and get IDE integration and one-stop shopping.

krid avatar Sep 29 '22 19:09 krid

+1 You'd get a lot niceties with flake8 as well such as temporarily ignoring code via noqa (sometimes needed), robust configuration (eg codes to include, can be based on file path pattern, etc), nice integration with pre-commit, etc

ksdaftari avatar Sep 30 '22 11:09 ksdaftari

Thanks for the advice, I will look into what it takes to make this happen

dosisod avatar Oct 01 '22 05:10 dosisod

@ksdaftari , Refurb does support noqa comments (See the README), it also has some support for ignoring errors via a config file (though not to the extent of flake8), and also has pre-commit support.

Adding a flake8 plugin will be nice for adding support to IDEs and such, though there are lots of kinks that need to be worked out in Refurb before I can dedicate time to this. If someone else who has experience writing flake8 plugins is able to implement this I would be happy to review it!

dosisod avatar Oct 01 '22 05:10 dosisod

I've seen this done for other tools, like for black, in separate packages, and wonder if there is any advantage to that.

jdevera avatar Oct 03 '22 17:10 jdevera

FYI, it's fairly easy to make flake8 plugins. See https://github.com/henryiii/flake8-errmsg for a fairly simple (and Python 3.10 pattern matching :) ) example. You don't even need to depend on flake8. IIRC, I watch a video by mcoding that was really good in describing how to make a flake8 plugin.

henryiii avatar Oct 05 '22 02:10 henryiii

I've given this a go but experienced much slower runs than running refurb directly. You can try the branch from this PR #72 .

jdevera avatar Oct 15 '22 22:10 jdevera