Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

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.