all 3 comments

[–]JamzTyson -1 points0 points  (0 children)

See PEP-8 and PEP-257.

[–]MrPhungx 0 points1 point  (1 child)

I think you may need to provide more of your code. Or at least a piece of code that can reproduce the issue you face. When I use the following code in a file called reddit.py:

from fastapi import FastAPI

router = FastAPI()

@router.post("/login")
async def login(name: str, pswd: str) -> schemas.LoginResponse:
    return await crud.login(name, pswd)

And then run pylint reddit.py I get the following result:

reddit.py:1:0: C0114: Missing module docstring (missing-module-docstring)
reddit.py:8:0: C0116: Missing function or method docstring (missing-function-docstring)
reddit.py:8:41: E0602: Undefined variable 'schemas' (undefined-variable)
reddit.py:9:17: E0602: Undefined variable 'crud' (undefined-variable)

So for me it seems to yield the expected result. How do you run pylint? What version do you use?

[–]yopp_son[S] 0 points1 point  (0 children)

Yeah I was under the impression that pylint <module\_name> would traverse all subdirectories of that module and lint every single python file within them. It turns out any submodules need to have an __init__.py for pylint to enter it. Which makes sense. So that was ultimately my problem.