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

Consider pylint instead of flake8 #31

Open
Zearin opened this issue Apr 17, 2014 · 4 comments
Open

Consider pylint instead of flake8 #31

Zearin opened this issue Apr 17, 2014 · 4 comments

Comments

@Zearin
Copy link
Contributor

Zearin commented Apr 17, 2014

I think—and I could be wrong, but I’m pretty sure about this—pylint can do everything flake8 does, and more.

As usual for this sort of tool, it’s configurable on a user- and project-basis, and the checks it performs can be further refined on the command line. Multiple output formats exist, including configuration options for tailoring the existing outputs to your liking.

Plus, I just like tools with lint in their name better than tools with flake in their name.

(“Flakes?” Yuck! I’ll admit my code has lint, but I never want to hear that it has flakes! 👅)

@seanfisk
Copy link
Owner

I took a quick look at pylint's capabilites. From what is mentioned on their site, I'm impressed — I like very strict tools.

It doesn't look like pylint can do complexity checks. That's not a deal-breaker for me, but flake8 can do it (using the mccabe module).

I'd like to try out pylint on a few of my codebases and see how it works. I'll keep you posted.

@Zearin
Copy link
Contributor Author

Zearin commented Apr 18, 2014

I took a quick look at pylint's capabilites. From what is mentioned on their site, I'm impressed — I like very strict tools.

Yep!

I also like how pylint lets you do stuff like pylint --disable=C, which disables all Conventions. There are 5 categories in all:

* (C) convention, for programming standard violation
* (R) refactor, for bad code smell
* (W) warning, for python specific problems
* (E) error, for probable bugs in the code
* (F) fatal, if an error occurred which prevented pylint from doing
further processing.

It doesn't look like pylint can do complexity checks. That's not a deal-breaker for me, but flake8 can do it (using the mccabe module).

I don’t know what you mean by “complexity”. I just took a quick look at the mccabe module, but it doesn’t really say how it calculates the complexity—only that it should result in a score less than 10.

Pylint can alert for something that it calls “design”, which points out things like functions that accept too many arguments, classes with too many public attributes, and so on. To see these checks, do pylint --long-help, and look for the options under Design.

Oh! Guess what? I just did pip search pylint, and found the plugin pylint-mccabe! So, you can actually get the same analysis. Shame it’s not built-in—one of my favorite things about pylint is just how much is built-in by defualt—but at least it’s available.

I'd like to try out pylint on a few of my codebases and see how it works. I'll keep you posted.

Cool. I look forward to hearing from you!

@Zearin
Copy link
Contributor Author

Zearin commented Apr 18, 2014

P.S.: Also found the plugin git-pylint-commit-hook! I haven’t searched for pylint plugins in a while. Looks like there are some good ones.

You should search for yourself to see if there are any other goodies that appeal to you!

@seanfisk
Copy link
Owner

Nice! The metric that the mccabe metric measures is called cyclomatic complexity, which is basically the amount of possible branches in the code. But honestly, code that fails this test is likely to be ugly already and would have probably been refactored by your better-than-average software developer.

Heads up: I'm finishing up my thesis right now so I probably won't have time to try pylint for at least a week.

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

2 participants