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

Implement documentation linting #1854

Merged
merged 4 commits into from
Apr 10, 2023
Merged

Implement documentation linting #1854

merged 4 commits into from
Apr 10, 2023

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented Apr 9, 2023

Changes

  • Introduce new tox environments docs-lint and docs-all
    • docs-lint will check for dead links and run spellchecking
    • docs-all will force a rebuild for all documentation
  • Update documentation and docstrings to pass linting; this includes some innocuous code changes for modernization
  • Run tox -e docs-lint on RTD before the docs are built

Notes

  • The -j auto switch cannot be used for multiprocessing; crate.sphinx.csv doesn't support it....or at least doesn't explicitly say it's supported.
  • The "nitpick" option -n cannot be used because of several issues with references.
    • I fixed what I could but a more complete review is necessary to resolve them all.
    • Of note, this is why I changed, for example, toga.App to toga.app.App; sphinx needs the canonical path.
    • It also appears a lot of this could be resolved with an effort to update the older typing methods.

nitpick errors:

pickling environment... done
checking consistency... done
preparing documents... done
/home/russell/github/beeware/toga/core/src/toga/widgets/optioncontainer.py:docstring of toga.widgets.optioncontainer.OptionContainer:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/optioncontainer.py:docstring of toga.widgets.optioncontainer.OptionContainer:2: WARNING: py:class reference target not found: toga.OptionItem
/home/russell/github/beeware/toga/core/src/toga/widgets/scrollcontainer.py:docstring of toga.widgets.scrollcontainer.ScrollContainer:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/splitcontainer.py:docstring of toga.widgets.splitcontainer.SplitContainer:6: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Canvas:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Context.remove:1: WARNING: py:class reference target not found: drawing_object
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Context.stroke:1: WARNING: py:class reference target not found: array
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Context.stroke:1: WARNING: py:class reference target not found: floats
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Stroke:1: WARNING: py:class reference target not found: array
/home/russell/github/beeware/toga/core/src/toga/widgets/canvas.py:docstring of toga.widgets.canvas.Stroke:1: WARNING: py:class reference target not found: floats
/home/russell/github/beeware/toga/core/src/toga/widgets/detailedlist.py:docstring of toga.widgets.detailedlist.DetailedList:20: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/detailedlist.py:docstring of toga.widgets.detailedlist.DetailedList:1: WARNING: py:class reference target not found: ListSource
/home/russell/github/beeware/toga/core/src/toga/widgets/detailedlist.py:docstring of toga.widgets.detailedlist.DetailedList:1: WARNING: py:obj reference target not found: ListSource
/home/russell/github/beeware/toga/core/src/toga/widgets/imageview.py:docstring of toga.widgets.imageview.ImageView:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/multilinetextinput.py:docstring of toga.widgets.multilinetextinput.MultilineTextInput:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/numberinput.py:docstring of toga.widgets.numberinput.NumberInput:9: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/numberinput.py:docstring of toga.widgets.numberinput.NumberInput:1: WARNING: py:class reference target not found: number
/home/russell/github/beeware/toga/core/src/toga/widgets/numberinput.py:docstring of toga.widgets.numberinput.NumberInput:1: WARNING: py:class reference target not found: number
/home/russell/github/beeware/toga/core/src/toga/widgets/numberinput.py:docstring of toga.widgets.numberinput.NumberInput:1: WARNING: py:class reference target not found: number
/home/russell/github/beeware/toga/core/src/toga/widgets/numberinput.py:docstring of toga.widgets.numberinput.NumberInput:1: WARNING: py:class reference target not found: number
writing output... [  6%] background/commands .. background/index
/home/russell/github/beeware/toga/core/src/toga/widgets/selection.py:docstring of toga.widgets.selection.Selection:5: WARNING: py:obj reference target not found: Style
writing output... [ 12%] background/layout .. background/roadmap
/home/russell/github/beeware/toga/core/src/toga/widgets/table.py:docstring of toga.widgets.table.Table:15: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/table.py:docstring of toga.widgets.table.Table:1: WARNING: py:obj reference target not found: ListSource
/home/russell/github/beeware/toga/core/src/toga/widgets/table.py:docstring of toga.widgets.table.Table:1: WARNING: py:obj reference target not found: ListSource
/home/russell/github/beeware/toga/core/src/toga/widgets/textinput.py:docstring of toga.widgets.textinput.TextInput:5: WARNING: py:obj reference target not found: Style
/home/russell/github/beeware/toga/core/src/toga/widgets/tree.py:docstring of toga.widgets.tree.Tree:7: WARNING: py:class reference target not found: toga.sources.TreeSource
/home/russell/github/beeware/toga/core/src/toga/widgets/tree.py:docstring of toga.widgets.tree.Tree:7: WARNING: py:class reference target not found: toga.sources.TreeSource
/home/russell/github/beeware/toga/core/src/toga/widgets/tree.py:docstring of toga.widgets.tree.Tree.data:4: WARNING: py:class reference target not found: returns
writing output... [ 18%] background/success .. how-to/get-started
writing output... [ 25%] how-to/index .. index
/home/russell/github/beeware/toga/docs/reference/widgets_by_platform.rst:43: WARNING: py:class reference target not found: toga.widgets.datepicker.DatePicker
/home/russell/github/beeware/toga/docs/reference/widgets_by_platform.rst:43: WARNING: py:class reference target not found: toga.widgets.timepicker.TimePicker
writing output... [ 31%] reference/api/app .. reference/api/containers/optioncontainer
writing output... [ 37%] reference/api/containers/scrollcontainer .. reference/api/mainwindow
writing output... [ 43%] reference/api/resources/command .. reference/api/resources/icons
writing output... [ 50%] reference/api/resources/images .. reference/api/widgets/button
writing output... [ 56%] reference/api/widgets/canvas .. reference/api/widgets/imageview
writing output... [ 62%] reference/api/widgets/index .. reference/api/widgets/numberinput
writing output... [ 68%] reference/api/widgets/passwordinput .. reference/api/widgets/slider
writing output... [ 75%] reference/api/widgets/switch .. reference/api/widgets/tree
writing output... [ 81%] reference/api/widgets/webview .. reference/index
writing output... [ 87%] reference/platforms .. reference/widgets_by_platform
writing output... [ 93%] tutorial/index .. tutorial/tutorial-2
writing output... [100%] tutorial/tutorial-3 .. tutorial/tutorial-issues-note

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@@ -15,11 +15,13 @@ def onClick(self, _):


class PickerBase(Widget, ABC):
@abstractclassmethod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abstractclassmethod was deprecated a long time ago.

@@ -208,8 +208,6 @@ class CGEventRef(c_void_p):
kCGImageAlphaNoneSkipFirst = 6
kCGImageAlphaOnly = 7

kCGImageAlphaPremultipliedLast = 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it may not be clear....this was already initialized above.

@rmartin16 rmartin16 marked this pull request as ready for review April 9, 2023 16:31
- Introduce new tox environments `docs-lint` and `docs-all`
  - `docs-lint` will check for dead links and run spellchecking
  - `docs-all` will force a rebuild for all documentation
- Update documentation and docstrings to pass linting; this includes
  some innocuous code changes for modernization
- Run `tox -e docs-lint` on RTD before the docs are built
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good for the most part; The only comment I've got is the list of terms in the spelling list. That list shouldn't contain any examples of:

  1. code-specific terms (e.g., endAngle), or
  2. non-US spelling (e.g., initialised).

Code terms should be quoted as literals in the docs for rendering purposes; this also means they won't be considered for spelling.

As for the UK/AU spelling - for the sake of consistency and avoiding the inevitable "you spelled colour wrong" pull requests, we should converge on US spelling.

I've corrected these; so we should be good to go!

@rmartin16
Copy link
Member Author

RE: UK/AU spelling

I was actually surprised by PyCharm with this...it detected that a previous form of the word matched UK/AU spelling and suggested being consistent....I was mildly impressed and surprised by that.

Additionally, I commonly find myself google searching certain spellings because I'm not sure if it's misspelled.....or spelled differently elsewhere 😆

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 this pull request may close these issues.

2 participants