Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--recursive fail to parse folder with __init__.py at the root when using relative path #9210

Closed
CareF opened this issue Oct 31, 2023 · 1 comment · Fixed by #9211
Closed
Labels
Milestone

Comments

@CareF
Copy link
Contributor

CareF commented Oct 31, 2023

Bug description

# folder struct
./__init__.py
./a.py # same goes if a.py is in a subfolder

# __init__.py is empty

# a.py includes anything that may trigger an error report like:

def foo():
    unused = 1

Configuration

No response

Command used

pylint --recursive=y ./

Pylint output

None

Expected behavior

Should be like pylint a.py or pylint --recursive=y $(pwd)

************* Module testpy.a
a.py:1:0: C0114: Missing module docstring (missing-module-docstring)
a.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
a.py:1:0: C0104: Disallowed name "foo" (disallowed-name)
a.py:2:4: W0612: Unused variable 'unused' (unused-variable)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Pylint version

pylint 3.0.2
astroid 3.0.1
Python 3.11.6 (main, Oct  2 2023, 20:46:17) [Clang 14.0.0 (clang-1400.0.29.202)]

OS / Environment

MacOS

Additional dependencies

No response

@CareF CareF added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 31, 2023
@CareF
Copy link
Contributor Author

CareF commented Oct 31, 2023

I can track it to L146 at lint/expand_modules.py, where

        if has_init or is_namespace or is_directory:
            for subfilepath in modutils.get_module_files(
                os.path.dirname(filepath), ignore_list, list_all=is_namespace
            ):

filepath is __init__.py and os.path.dirname(filepath) is empty str when the bug is triggered, but some valid path when it is normal.

@CareF CareF changed the title --recursive fail to parse folder with __init__.py at the root --recursive fail to parse folder with __init__.py at the root when using relative path Oct 31, 2023
@Pierre-Sassoulas Pierre-Sassoulas added Bug 🪲 and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 31, 2023
@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.0.3 milestone Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants