June 2, 2022

Removal of `no-self-use` from pylint 2.14.0

A really minor change in pylint 2.14.0 might be breaking your workflow, learn how to fix it!

Removal of `no-self-use` from pylint 2.14.0

As of version 2.14.0 (released 2022-06-01) of pylint, R0201 (no-self-use) has been moved to the pylint optional extensions. Personally,  R0201 has always annoyed me, so I'm quite glad to see it gone, but of course, since these are computers and computers come from Satan himself, there are of course some implications that come from this (no good deed can ever go un-punished). Now that R0201 has been moved to an optional checker, if you have your pylint disable statement set to ignore checking R0201 (which I have had to do in many projects) when running pylint, it will now just die and say “WHAT, OMG, R0201, IDK WHAT THAT EVEN IS, WHY ARE YOU TELLING ME NOT TO CHECK FOR IT, I CAN’T NOT CHECK FOR SOMETHING I DON’T HAVE!!!one!!1!!!eleven!!!11!1!!!!!!"

The end result of this is that if you are running pylint in a CI/CD pipeline, it might just be failing due to this small change. I ran across this exact scenario at work, so I figured I’d share here as well to make a quickly googlable analysis of this for others.

For example, if you have this in your code:

# pylint: disable=R0201

You'll see something like this in your pylint output:

my_python_file.py:1:0: E0012: Bad option value for disable. Don't recognize message R0201. (bad-option-value)

The TL;DR here is that you can now probably remove R0201 from your pylint disable statements / pylint config, which, in my opinion, is a Good Thing, as I have always felt that R0201 is way too opinionated and there are a lot of valid uses for it. Here are the release notes if you’re curious, as well as the Github issue discussing the removal of this checker:

Thanks for reading, and I hope this saves you some digging!