-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Discussion: General ignore F821 within documentation #23508
Comments
For the time being, I would prefer that we disable Perhaps another to go about it is to create a list of "expected errors" (ones that we know we can safely ignore) and compare it against what |
My opinion is that we should be explicit in all the examples, and not make the users guess anything (and that includes the As this is not shared by the rest of the team, my next favorite option is at some point stop ignoring But surely ok to have Similar discussion in: #22900 |
I'm currently waiting for 2 PRs to be merged into flake8-rst. This however raises another issue as imports may occur in the middle of a block, although they are at the top of an subblock: .. code-block:: python
filename = 'something'
.. code-block:: python
import os # <--- raises E402
os.path.exists(filename) # <--- no longer raises F821 I think it might be best to require all pandas and numpy related stuff to be referred to from pd (np). I'm unsure what to do with imports from pandas unrelated stuff. |
I'm happy to ignore What we've been doing with |
With PR #23381
flake8_rst
will get merged allowing to have theflake8
checks being run on code inside*.rst
files withindoc/source
subfolder.In order to make the
./ci/code_shecks.sh
script used by travis working, I had to ignore allF821 undefined name
errors. @datapythonista and I had a brief discussion #23154 whether there should be raised an issue to fix all those errors ( @datapythonista ) or leaveF821
ignored, relying on documentation editors to design meaningful documentation without constrainingF821
issues to be fixed ( @FHaase ).Before I open an issue to fix all
F821
issues, I'd like to ask for a general opinion in respect of how the documentation would look like when the fixes are finished.Forcing
F821
issues to be fixed:"Pro" Examples
In these examples the documentation would benefit of not general ignoring
F821
issues:Finding typos within code:
Adding clearness to the code:
"Contra" Examples
These examples would have to manually ignoring
F821
issues by adding# noqa: F821
to the code what is beeing rendered in the documentation.Code with semantical clear variablenames
or
Intermediate explanations [a better example would be when s changed in block 1]
Current technical limitations
As
flake8_rst
callsflake8
with each of the.. code-blocks::
or.. ipython::
blocks individually, needing to define all variables in each block would complicate working with this directive.pep8 requires 2 blank lines between functions in top-level scope.
ipython
refuses to run properly with them. So [E302, E305] will become ignored as well.Possible compromise
Having a dedicated folder with code-snippets in
*.py
files which can be included via.. includeliteral::
(?) As they represent complete examples they would be checked viaflake8
and it's possible to run tests on them ensuring up to date examples even when apis change.The text was updated successfully, but these errors were encountered: