PyCQA / pyflakes

A simple program which checks Python source files for errors
https://pypi.org/project/pyflakes
MIT License
1.38k stars 180 forks source link

Support for Code Climate reporting format #418

Open tribals opened 5 years ago

tribals commented 5 years ago

Would you plan to support reporting in Code Climate format?

This will allow usage of pyflakes as Code Climate engine, so many Python developers will be able to use it in their CI workflows.

It seems that the spec is not so complicated. If you agree with the need to support Code Climate reports, I'll implement it.

sigmavirus24 commented 5 years ago

Given that there are no command-line options that affect behaviour in this tool today, I suspect @bitglue will rule this out. I do think Flake8 would be able to easily implement this though and give you the Pyflakes output you want.

tribals commented 5 years ago

Did you mean that I should use flake8 instead?

If so, I disagree. I'm using pyflakes exactly why I don't use flake8. It is that flake8 combines multiple tools in one: it checks for style of code as well as errors that can be caught at static analysis. I don't want so. I'm using another tool for code formatting according to style with which many of my teammates agree (it is black, if you are interested). So, I need just static analyzer which is exactly what is pyflakes.

It is acceptable to introduce additional command line switch? If not, just close issue.

asottile commented 5 years ago

flake8 --select=F is basically "pyflakes but with features" if you're interested

tribals commented 5 years ago

Yes, I do. Thank you. I'll check this out.

bitglue commented 5 years ago

I'm not familiar with the code climate format, but if it's just a matter of the appropriate syntax for errors, it would also be relatively simple to implement a small Python script which invokes pyflakes as a module and then outputs the appropriately formatted errors. See the implementation of main() for a starting point, then replace the reporter with whatever you need.

If it helps people, it doesn't add any dependencies, and it's a small amount of code, I'm not opposed to including the implementation in pyflakes. I've tried to avoid any options that affect how or what gets checked, since if there are no false positives there should be nothing to configure. But an option to control the output formatting should be benign.

sigmavirus24 commented 5 years ago

Honestly, looking further into this, it seems like separate tools that import an API and use their own thing, e.g., https://github.com/codeclimate/codeclimate-eslint so I don't think this needs to live or be distributed with pyflakes

tribals commented 5 years ago

@bitglue This is exactly what I thought about last evening.