Format docs by Cjkjvfnby · Pull Request #7821 · TheAlgorithms/Python · GitHub
Skip to content

Format docs - #7821

Merged
cclauss merged 4 commits into
TheAlgorithms:masterfrom
Cjkjvfnby:format-docs
Oct 29, 2022
Merged

Format docs#7821
cclauss merged 4 commits into
TheAlgorithms:masterfrom
Cjkjvfnby:format-docs

Conversation

@Cjkjvfnby

Copy link
Copy Markdown
Contributor

Describe your change:

Fix some warnings that would be raised by adding adding flake8-docstrings to the pre-commit hooks.

This PR is just to show the features of that tool.

There are two groups of checks.

Documentation

This looks like a good match with the repo guidelines. For classes and functions, there is an easy trick to use the leading underscore for names, then classes/functions won't be public, so you could document only what you need.

  • D100 Missing docstring in public module
  • D101 Missing docstring in public class
  • D104 Missing docstring in public package

Docstring formating

It might be a bit confusing for people since the summary does not have a lot of sense in the context of this repo. It will have the same words as in the file and function names and algorithm description is in the module docstring. Ignoring that line is not an option since there is a lot of code with doctests.

  • D205 1 blank line required between summary line and description
  • D400 First line should end with a period
  • D401 First line should be in imperative mood; try rephrasing
  • D403 First word of the first line should be properly capitalized
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Oct 28, 2022
@Cjkjvfnby Cjkjvfnby mentioned this pull request Oct 28, 2022
1 task
Comment thread physics/kinetic_energy.py Outdated
Comment thread sorts/merge_sort.py Outdated
@CaedenPH

Copy link
Copy Markdown
Contributor

@Cjkjvfnby Cjkjvfnby left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

...

@Cjkjvfnby

Copy link
Copy Markdown
Contributor Author

However maybe it's just better to leave it to persona preference

Since we don't build documentation for that code we could leave it as is.

80% of these params/returns could be eliminated by annotations and good variable names.

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Oct 29, 2022
@cclauss
cclauss merged commit cf08d9f into TheAlgorithms:master Oct 29, 2022
@cclauss

cclauss commented Oct 29, 2022

Copy link
Copy Markdown
Member

@Cjkjvfnby
Cjkjvfnby deleted the format-docs branch October 29, 2022 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants