Skip to content

no-name-in-module does not respect patterns in ignored-modules #7578

@danmou

Description

@danmou

Bug description

ignored-modules is supposed to support Unix-style pattern matching, but this is only the case for the no-member check whereas the no-name-in-module check only checks for exact matches. I've already fixed the issue and I'll submit a PR in a moment.

Minimal example

.
├── a.py
└── foo
    ├── bar_pb2.py
    └── __init__.py

a.py:

"""a.py"""
from foo.bar_pb2 import Bar
Bar()

Command used

pylint a.py --ignored-modules='*_pb2'

Pylint output

************* Module a
a.py:2:0: E0611: No name 'Bar' in module 'foo.bar_pb2' (no-name-in-module)

Expected behavior

No error

Pylint version

pylint 2.15.3
astroid 2.12.10
Python 3.8.10 (default, Jun 22 2022, 20:18:18)
[GCC 9.4.0]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions