Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Making vulture a flake8 plugin #161

Closed
pykong opened this issue May 30, 2019 · 12 comments
Closed

Enhancement: Making vulture a flake8 plugin #161

pykong opened this issue May 30, 2019 · 12 comments

Comments

@pykong
Copy link

pykong commented May 30, 2019

I believe vulture would make a useful addition to the flake8 plugin ecosystem, as finding dead code as part of the usual lining process would be great.

information on flake8 plugin development:
https://flake8.pycqa.org/en/latest/plugin-development/

@RJ722
Copy link
Contributor

RJ722 commented May 30, 2019

Hi @pykong,

This seems like a really nice idea, Thanks!

Let's see what @jendrikseipp has to say about this and in the end if we decide to get on with it, I think that I would be up for development as I shall be available for a month or so during late August.

@jendrikseipp
Copy link
Owner

I agree, that's a nice idea! @RJ722, it would be great if you found the time to work on this! I think https://github.com/PyCQA/flake8-docstrings should serve as a good example.

@pykong
Copy link
Author

pykong commented May 31, 2019

@RJ722 @jendrikseipp Great to see your enthusiasm.
I am usually very short on time myself but you can count me in if you need help with the development.

Keep in mind vulture is vital for any serious python dev because it fulfils an important code quality check no other tool (AFAIK) provides.

@onlinejudge95
Copy link

@RJ722 Happy to look into the issue. I would be making contact for contextual info.

@jendrikseipp
Copy link
Owner

Perfect, please coordinate with @RJ722.

@RJ722
Copy link
Contributor

RJ722 commented Dec 26, 2019

Hi everyone, I tried taking a stab at it yesterday (Merry Christmas to you too! :D) - But, it turns out that because of the way flake8 plugin works, a new instance of the plugin class is created for every new file, and it receives the filename/AST of only that file - due to which it isn't directly possible to report code used across different files.

Off the top of my head, I can think of two possible workarounds:

  • For every file, parse it's parent directory and run Vulture on the whole directory. Store the directory path in a set shared across different instances. This might work well for most of the cases, but if there is a more complex hierarchy, this is bound to fail.
  • Ask users explicitly the paths they want to run Vulture on.

Did I miss something? Is there anything else we can do?

Also, I decided to call it fluture. Too punny?

@pykong
Copy link
Author

pykong commented Dec 26, 2019

@RJ722 Thanks for putting up the effort.
Regarding naming. I suggest to just call it it flake8-vulture.
This is simple and explicit, follows the naming scheme of other plugins (e.g. flake8-mypy) and does not hide the incorporation of vulture.

@RJ722
Copy link
Contributor

RJ722 commented Dec 26, 2019

@pykong I agree. thanks for your input!

@jendrikseipp
Copy link
Owner

Thanks for looking into this! Regarding the functionality, I think it's best to ask the flake8 devs how best to accumulate results over multiple files. Regarding the name, I agree that flake8-vulture sounds best.

@RJ722
Copy link
Contributor

RJ722 commented Dec 26, 2019

Thanks @jendrikseipp! I've opened https://gitlab.com/pycqa/flake8/issues/603

@pykong
Copy link
Author

pykong commented Dec 26, 2019

@RJ722 the maintainer of flake8 over there at GitLab does not seems to be too keen on flake8-vulture. Do not mind the heat he's given you. We all agreed on this thread that vulture would make a great addition to the flake8 ecosystem.

Now we have to see whether it can actually be made to work. Technically it seems flake8 does not offer the functionality we require to do so judged from aso's response on GitLab. That would be sad though.

@jendrikseipp
Copy link
Owner

I don't think it's worth fighting an uphill battle. If flake8 and vulture don't fit together, there's no need to try to work around that fact. I think our time is spent better on other usage issues like #160 and #164 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants