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

should we lint our documentation ? #1139

Closed
12rambau opened this issue Jan 27, 2023 · 8 comments · Fixed by #1150
Closed

should we lint our documentation ? #1139

12rambau opened this issue Jan 27, 2023 · 8 comments · Fixed by #1150

Comments

@12rambau
Copy link
Collaborator

It was suggested to me this morning by github, I didn't even know it existed. Do you think it would make sense to lint the documentation ?
https://github.com/PyCQA/doc8

I know that @choldgraf is more of a myst personn but there are still plenty of .rst files in our doc.

@choldgraf
Copy link
Collaborator

choldgraf commented Jan 27, 2023

In my opinion, linting is useful when it reduces the cognitive overhead of having to make semi-arbitrary decisions about style/structure, and when it helps avoid obvious problems in how code/text/etc is structured (not stylistic differences but obvious things that should happen but often don't). I don't have strong opinions about whether our rST documentation falls into this category, so I'll trust your / others judgment on whether this would be helpful for the project.

@drammock
Copy link
Collaborator

I've tried using doc8 locally through a vscode plugin and it's not great. Constant yellow underlines in my RST pages saying things like "unknown interpreted text role :func:". But maybe for a repo that's mostly not documenting code it would be OK? or maybe doc8 is great and just the vscode plugin is not good? I guess I'd suggest to run doc8 on our codebase and see what its results are; if they look like legitimate things that would be better if we fixed them, then great. If it's lots of false positives like "unknown interpreted text role :func:" then I'd say it's not worth it.

@choldgraf
Copy link
Collaborator

@drammock one thing I've found annoying with vscode is that it's extensions often rely on the system python (or whatever you specify) rather than a version of python that is attached to a project in a virtual env, so i always get a lot of errors about packages missing etc. Though maybe that wouldn't be an issue if we run doc8 in the dame environment as this package?

@drammock
Copy link
Collaborator

@drammock one thing I've found annoying with vscode is that it's extensions often rely on the system python (or whatever you specify) rather than a version of python that is attached to a project in a virtual env

Yeah, some extensions do that, I agree it's annoying. In the case of doc8 though I should retract what I said before. The extension had support for doc8 but was actually using rstcheck. When I switched it to use doc8 the false alarms went away.

I just tried running doc8 /opt/pydata-sphinx-theme/docs and here's a snippet of the (long) output:

/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.DataFrame.groupby.rst:2: D000 Title underline too short.
/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.DataFrame.groupby.rst:6: D005 No newline at end of file
/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.Series.array.rst:2: D000 Title underline too short.
/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.Series.array.rst:6: D005 No newline at end of file
/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.DataFrame.drop.rst:2: D000 Title underline too short.
/opt/pydata-sphinx-theme/docs/_build/html/_sources/examples/generated/pandas.DataFrame.drop.rst:6: D005 No newline at end of file
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/api.rst:2: D000 Explicit markup ends without a blank line; unexpected unindent.
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/index.rst:2: D000 Explicit markup ends without a blank line; unexpected unindent.
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/paragraph-markup.rst:260: D000 Unknown target name: "5".
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/paragraph-markup.rst:274: D000 Unknown target name: "nonexistent".
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/paragraph-markup.rst:303: D000 Unknown target name: "body elements".
/opt/pydata-sphinx-theme/docs/_build/html/_sources/demo/kitchen-sink/paragraph-markup.rst:315: D000 Unknown target name: "hyperlink reference without a target".
/opt/pydata-sphinx-theme/docs/_build/html/_sources/user_guide/install.rst:49: D000 Cannot analyze code. No Pygments lexer found for "none".

plus LOTS AND LOTS of D001 Line too long

@drammock
Copy link
Collaborator

Total files scanned = 136
Total files ignored = 0
Total accumulated errors = 1113
Detailed error counts:
    - doc8.checks.CheckCarriageReturn = 0
    - doc8.checks.CheckIndentationNoTab = 0
    - doc8.checks.CheckMaxLineLength = 1078
    - doc8.checks.CheckNewlineEndOfFile = 12
    - doc8.checks.CheckTrailingWhitespace = 0
    - doc8.checks.CheckValidity = 23

@choldgraf
Copy link
Collaborator

choldgraf commented Jan 27, 2023

Fwiw I am definitely not a fan of "max line length" errors for documentation. I much prefer to follow "1 sentence per line" because I think it makes it much easier to diff in the GitHub interface and helps avoid random line length overflows just because your doing minor edits in a paragraph. For one ref on this see:

https://sembr.org/

@drammock
Copy link
Collaborator

Fwiw I am definitely not a fan of "max line length" errors for documentation.

same, if we adopt doc8 let's disable D001

@12rambau
Copy link
Collaborator Author

I've already shown in other issues that I'm simply against any length limit (This is why we have wrappers in the first place and they work great). I was of course planning on silencing D001 ;-)

12rambau added a commit to 12rambau/pydata-sphinx-theme that referenced this issue Mar 2, 2023
* Fix extra whitespace in sidebars (pydata#1115)

* Fix extra whitespace in sidebars

* Searchbox

* Update src/pydata_sphinx_theme/__init__.py

Co-authored-by: Daniel McCloy <[email protected]>

* make test pass

* Fix template filter to remove empty files

* ABlog in template test

* Move clear search button to primary sidebar

* Move search clear button to top of article

Co-authored-by: Daniel McCloy <[email protected]>

* FIX: Use logo_url instead deprecated logo in theme (pydata#1094) (pydata#1097)

resolves pydata#1094

* ENH/MAINT: avoid overwriting the HtmlTranslator (pydata#1105)

Co-authored-by: Chris Holdgraf <[email protected]>
Fix pydata#143
Fix pydata#94

* fix: align sidebar sliding with the buttons (pydata#1123)

* fix: aline the sidebar sliding with the buttons

* build: force test to run on all platform
if one platform is failing we cannot see if it's platform related as the other were closed

* fix: use correct path for documentation logo

* MAINT: Improve font sizing (pydata#1129)

Fix pydata#1001

* MAINT: Refactor workflows to reduce test dependencies (pydata#1136)

* MAINT: update prerelease workflow (pydata#1140)

* ABlog: Updates for new HTML structure (pydata#1118)

* ABlog: Updates for new HTML structure

* Update templates for latest release

* Bump to dev0

* Standardize logo image behavior between Sphinx and this theme (pydata#1132)

Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Chris Holdgraf <[email protected]>
Co-authored-by: Chris Holdgraf <[email protected]>

* 0.13.0rc1

* Build(deps): Bump http-cache-semantics from 4.1.0 to 4.1.1 (pydata#1154)

* DOC: Use only shield.io for badges in README (pydata#1152)

* Copyright semicolon (pydata#1160)

* FIX: Flex behavior should shrink header items instead of brand (pydata#1158)

Co-authored-by: Chris Holdgraf <[email protected]>
Fixes pydata#1143

* STYLE: lint the documentation with Doc8 (pydata#1150)

Fix pydata#1139

* Add test for internationalization and translations (pydata#1138)

* FIX: Javascript incorrect check for variable (pydata#1166)

* MAINT: update pypi classifiers (pydata#1153)

Fix pydata#1106

* remove emoji from landing page (pydata#1151)

* add fa icons instead of emoji

* remove fix for emojis

* use markup for readme emojis

* use pst-color-primary instead of sd-text-primary

* make our semantic colors available as classes

* try again

---------

Co-authored-by: Daniel McCloy <[email protected]>

* FIX: Narrow scope of style rule for GitHub & GitLab link shortening (pydata#1167)

Fixes pydata#1156

* ENH: Add breadcrumbs to article header (pydata#1142)

* ENH: Add breadcrumbs to article header

* Update src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/breadcrumbs.html

Co-authored-by: Tania Allard <[email protected]>

* More fixes

* Improving nested page behavior

* Documenting breadcrumbs

* Update src/pydata_sphinx_theme/assets/styles/components/_breadcrumbs.scss

Co-authored-by: Rambaud Pierrick <[email protected]>

* Breacrumbs have link color

---------

Co-authored-by: Tania Allard <[email protected]>
Co-authored-by: Rambaud Pierrick <[email protected]>

* Degrade gracefully when JavaScript is disabled (pydata#1146)

* Fix header vertical spacing and jupyter-sphinx cells (pydata#1164)

Fixes undefined

* RLS: v0.13.0rc2 (pydata#1170)

* DOCS: admonition customization (pydata#1155)

* first draft of the admonition customization

* typo in doc link

* flesh out admon. customization example; DRY

* use :code:rst instead of :literal:

* Update docs/_static/custom.css

---------

Co-authored-by: Daniel McCloy <[email protected]>

* Fix article header CSS (pydata#1171)

* “Edit this page” → “Edit on GitHub/GitLab/Bitbucket” (pydata#1177)

* “Edit this page” → “Edit on GitHub/GitLab/Bitbucket”

Fixes pydata#1172

* Add tests

* Fix typo

* Properly handle default_mode=auto when writing logos (pydata#1183)

We used to only defaulting to the light version when `default_mode` was
undefined, not when it was explicitly set to `auto`. We also need to
handle the latter, as the new test shows.

Closes pydata#1180

Co-authored-by: Jérémy Bobbio (Lunar) <[email protected]>

* fix: correctly add DOM listeners (pydata#1179)

fix adding DOM listeners

* maint: update GitLab URL tests (pydata#1186)

Co-authored-by: JoerivanEngelen <[email protected]>

* Standardize template structure in more sections (pydata#1184)

* Standardize template structure in all sections

* Fixing footer behavior

* Update docs/user_guide/layout.rst

Co-authored-by: Daniel McCloy <[email protected]>

* Remove use of id= as much as possible

---------

Co-authored-by: Daniel McCloy <[email protected]>

* maint: remove sphinx-panels support; remove deprecated config shims (pydata#1188)

* Minor style improvements to ablog (pydata#1185)

* RLS: v0.13.0rc3

* dev0

* FIX: Some style bugs (pydata#1191)

* FIX: Some style bugs

* Move link word wrap to global rule

* DOCS: Add internationalization instructions (pydata#1178)

Co-authored-by: James McKinney <[email protected]>

* Refactor contributing docs to be more modular (pydata#1173)

* Dev0

* Fix github gitlab brand (pydata#1194)

* RLS: v0.13.0rc4

* FIX: Make wide equations scroll (pydata#1196)

* Fix math scrollbars for realz (pydata#1198)

* Fix math scrollbars for realz

* Update src/pydata_sphinx_theme/assets/styles/content/_math.scss

* Update src/pydata_sphinx_theme/assets/styles/content/_math.scss

* copy_logo_images: do not render dynamic Sphinx template content (pydata#1204)

* copy_logo_images: do not render dynamic Sphinx template content when copying logo image files

* Update src/pydata_sphinx_theme/__init__.py

---------

Co-authored-by: Chris Holdgraf <[email protected]>

* Add conditional check for last-updated template (pydata#1201)

* Add conditional check for last-updated template

* Whitespace

* Properly set configuration with app.builder.theme_options (pydata#1199)

* Properly set configuration

* Dict to values

* Making it explicit in a function

* Better name

* Fix test

* Foot

* Revert complex config set

* Clarify docs

* Use CSS transform for skip link (pydata#1206)

* feat: Add full i18n support (pydata#1192)

Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: James McKinney <[email protected]>
Co-authored-by: Chris Holdgraf <[email protected]>
Co-authored-by: Chris Holdgraf <[email protected]>

* Dev0

* FIX: Remove icon links component when no icon links given (pydata#1209)

* RLS: 0.13.0rc5

* dev0

* FIX: Get theme options in a more robust way (pydata#1214)

* RLS: v0.13.0rc6

* Make heading-style use the font-weight-heading value (pydata#1213)

* Make heading-style use the font-weight-heading value

* Separate font-weight setting for content headers and admonitions

* Flip var to be consistent with --pst-font-weight-heading instead

* RLS: v0.13.0

* bump: dev0

* DOCS: Remove <p> from announcement sample text (pydata#1223)

---------

Co-authored-by: Chris Holdgraf <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Nico Albers <[email protected]>
Co-authored-by: Chris Holdgraf <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brendan Heberlein <[email protected]>
Co-authored-by: Tania Allard <[email protected]>
Co-authored-by: Lunar <[email protected]>
Co-authored-by: Jean Abou-Samra <[email protected]>
Co-authored-by: Jérémy Bobbio (Lunar) <[email protected]>
Co-authored-by: JoerivanEngelen <[email protected]>
Co-authored-by: James McKinney <[email protected]>
Co-authored-by: James Addison <[email protected]>
Co-authored-by: Veronica Berglyd Olsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants