Skip to content

Instantly share code, notes, and snippets.

@hoel-bagard
Last active April 1, 2022 10:36
Show Gist options
  • Select an option

  • Save hoel-bagard/47600fa2e5079a4a6f768b18e102fdd6 to your computer and use it in GitHub Desktop.

Select an option

Save hoel-bagard/47600fa2e5079a4a6f768b18e102fdd6 to your computer and use it in GitHub Desktop.
Small explanation / remark on the setup.cfg config for flake8

What you (probably) already know

Setup environment

mkdir temp
cd temp
virtualenv venv
source venv/bin/activate
pip install flake8-docstrings

Create a config for flake8

echo "[flake8]" >> setup.cfg
echo "ignore=" >> setup.cfg
echo "    D100  # Missing docstring in public module" >> setup.cfg
echo "    D103  # Missing docstring in public function" >> setup.cfg

Create some python code

echo "def test(a):" >> my_file.py
echo "    print(a)" >> my_file.py

Test it

flake8 my_file.py

Everything works fine!

Experiment

echo "[flake8]" > setup.cfg
echo "ignore=" >> setup.cfg
echo "    D100  # Require docstring in public module, removed the D103 for public functions." >> setup.cfg
flake8 my_file.py

Everything still runs without any "warning". What happened ?
Shouldn't we get my_file.py:1:1: D103 Missing docstring in public function ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment