PyLint's Code Quality Score
PyLint not only tells you, what code parts you could and should improve, but also returns a code score. You’ll learn more about the PyLints code score by watching this video.
00:00 The other thing you can see here is that at the end, Pylint will always print out a score for your code, which is, you know, some I guess arbitrary metric that goes from… I don’t actually know what the range is, but I think it goes up to 10. Or like, 10 is perfect, and like, -10 is the worst. Or, I don’t know, you know, it’s like some negative is bad and then the higher you go, the better it is.
00:22 And you can see here that now it’s actually a little bit better. It’s still negative, but we’re doing a little bit better because we fixed that one issue. Now, you know, with any of these metrics, I’d be careful because it’s very hard to put an accurate metric on any kind of code or program that gives you valid feedback.
00:40 People try that all the time, and I see that, you know, in development teams, someone comes in, like a manager comes in and they’re like, “Okay, we’re going to focus on code quality now!
00:49 We have this one metric and we want that to always go up!” And then, essentially, what happens is that people start optimizing for that metric. And you can still write programs that don’t actually have any value, have no business value whatsoever, but they have really great metrics.
01:05 So this is always to be taken with a grain of salt. But that said, it’s still a helpful metric because it’s like a little game, right? You want to make the numbers go up in this case.
01:14 So, I really like using linters, partly because of that gamification aspect I guess. Because, you know, you always have some number that you can make go up and kind of improve and make better, and that makes me feel good! Now, you know, you always want to keep in the back of your mind that this number is maybe not that meaningful after all, but still, like when you look at this here, this is all very valid and helpful feedback. And like, obviously, you know, to tell you the truth, I set this example up so that we would get some helpful feedback and actually have something to do.
Become a Member to join the conversation.