.. _too-many-public-methods:

too-many-public-methods / R0904
===============================

**Message emitted:**

``Too many public methods (%s/%s)``

**Description:**

*Used when class has too many public methods, try to reduce this to get a simpler (and so easier to use) class.*

**Problematic code:**

.. literalinclude:: /data/messages/t/too-many-public-methods/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/t/too-many-public-methods/good.py
   :language: python

**Configuration file:**

.. literalinclude:: /data/messages/t/too-many-public-methods/pylintrc
    :language: ini

**Additional details:**

Having too many public methods is an indication that you might not be respecting
the Single-responsibility principle (S of SOLID).

The class should have only one reason to change, but in the example the
spaceship has at least 4 persons that could ask for change to it
(laser manager, shield manager, missile manager, teleportation officer...).

**Related links:**

- `Single-responsibility principle <https://en.wikipedia.org/wiki/Single-responsibility_principle>`_


Created by the `design <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/design_analysis.py>`__ checker.