Skip to content

False positive of WPS412 #3569

@milssky

Description

@milssky

What's wrong

If you add to __init__.py docstring and re-export, then the error WPS412 Found appears__init__.py `module with logic', which contradicts the documentation.

How to reproduce:

Make a project structure like this

├── package
│   ├── __init__.py
│   └── module.py
└──setup.cfg

Place in package/__init__.py some code

"""
Docstring for package.
"""

from package.module import make_foo as make_foo

For example, i put into package/module.py this code:

def make_foo():
    """foo func."""

setup.cfg

[flake8]
# flake8 configuration:
# https://flake8.pycqa.org/en/latest/user/configuration.html
# We use `flake8` together with `ruff`, so we only select rules that
# are not ported to `ruff`.
format = wemake
show-source = true
statistics = false
doctests = true

# Flake plugins:
max-line-length = 80
max-complexity = 6
max-imports = 20
max-name-length = 50

extend-exclude =
  venv,

# Only select errors that are not covered by `ruff`:
select = WPS, E99

How it should be

There should be no WPS412 violation triggered.

Flake8 version and plugins

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.13.2",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.14.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.4.0"
    },
    {
      "plugin": "wemake-python-styleguide",
      "version": "1.4.0"
    }
  ],
  "version": "7.3.0"
}

pip information

pip 25.0 from /Users/milssky/dev/python/flaky_jobs/venv/lib/python3.13/site-packages/pip (python 3.13)
attrs==25.4.0
flake8==7.3.0
mccabe==0.7.0
pycodestyle==2.14.0
pyflakes==3.4.0
Pygments==2.19.2
wemake-python-styleguide==1.4.0

OS information

macOS Tahoe 26.1, apple m3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions