pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Add an option to check for misspellings in special functions

Open kunaltyagi opened this issue 6 years ago • 3 comments

Is your feature request related to a problem? Please describe

Currently, the errors in naming of special functions aren't checked. Normal functions act as interfaces and they are readily checked. But for special functions, it becomes hard to confirm that the code written will work and many times, the eyes gloss over things like number of underscores (too many or too few, hard to distinguish), spelling (should that be invert or inv, eq or equal or equals).

class abc:
    __init_(self):
        pass
    ___neg__(self):
        pass
    __inv__(self):
        pass

Describe the solution you'd like

Since the special functions are limited, testing for spellings (and offering the suggestions as a plugin) would be ideal.

kunaltyagi avatar Aug 02 '19 08:08 kunaltyagi

This sounds useful, thanks for the suggestion!

PCManticore avatar Aug 06 '19 14:08 PCManticore

Any tips on how to add this feature?

kunaltyagi avatar Aug 06 '19 14:08 kunaltyagi

I guess it's possible to use that if a function name start and ends with __ then it's one of the official dunder methods for python.

Pierre-Sassoulas avatar Jul 04 '22 13:07 Pierre-Sassoulas