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

Add blacken-docs to pre-commit & apply minor reST fixes #1807

Merged
merged 18 commits into from Nov 28, 2022

Conversation

namurphy
Copy link
Member

This PR adds a pre-commit hook for blacken-docs and applies a bunch of the changes. It also applies some issues with examples in code blocks that I found with shed, which I learned about in a podcast and was trying out for fun.

@github-actions
Copy link

Thank you for contributing to PlasmaPy! The project's future depends deeply on contributors like you, so we deeply appreciate it! 🌱 The following checklist will be used by the code reviewer to help guide the code review process.

  • Overall
    • Does the PR do what it intends to do?
    • Except for very minor changes, is a changelog entry included and consistent with the changelog guide?
    • Are the continuous integration checks passing? (Most linter problems can be automagically fixed by commenting on this PR with pre-commit.ci autofix.)
  • Code
    • Is new/updated code understandable and consistent with the coding guide?
    • Are there ways to greatly simplify the implementation?
    • Are there any large functions that should be split up into shorter functions?
  • Tests
    • Are tests added/updated as required, and consistent with the testing guide?
    • Are the tests understandable?
    • Do the tests cover all important cases?
  • Docs
    • Are docs added/updated as required, and consistent with the doc guide?
    • Are the docs understandable?
    • Do the docs show up correctly in the preview, including Jupyter notebooks?

Comment on lines -91 to -102
A comprehension might be more readable when spread out over multiple
lines.

.. code-block:: pycon

>>> {
... x: x ** 2
... for x in range(17)
... if x % 2 == 0
... }
{0: 0, 2: 4, 4: 16, 6: 36, 8: 64, 10: 100, 12: 144, 14: 196, 16: 256}

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't relevant to us anymore since this sort of formatting is handed by autoformatters. Hence, we can delete it!

@codecov
Copy link

codecov bot commented Nov 27, 2022

Codecov Report

Base: 98.34% // Head: 98.34% // No change to project coverage 👍

Coverage data is based on head (0e5cd0c) compared to base (9119028).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1807   +/-   ##
=======================================
  Coverage   98.34%   98.34%           
=======================================
  Files          91       91           
  Lines        8223     8223           
=======================================
  Hits         8087     8087           
  Misses        136      136           
Impacted Files Coverage Δ
plasmapy/particles/particle_class.py 98.99% <ø> (ø)
plasmapy/plasma/grids.py 99.34% <ø> (ø)
plasmapy/utils/decorators/checks.py 100.00% <ø> (ø)
plasmapy/utils/decorators/lite_func.py 100.00% <ø> (ø)
plasmapy/utils/pytest_helpers/pytest_helpers.py 91.35% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@namurphy namurphy marked this pull request as ready for review November 27, 2022 21:18
@namurphy namurphy requested a review from a team as a code owner November 27, 2022 21:18
@namurphy namurphy requested review from StanczakDominik and removed request for a team November 27, 2022 21:18
@namurphy namurphy changed the title Add blacken-docs to pre-commit & apply changes Add blacken-docs to pre-commit & apply minor reST fixes Nov 27, 2022
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

Looks simple enough! Glad to have it, too.

@namurphy
Copy link
Member Author

namurphy commented Nov 28, 2022

Thanks for the quick review! I'm happy to have the extra check that...with running black in the docs...we can check to make sure that the Abstract Syntax Tree for examples is valid (i.e. that it's valid Python code).

@namurphy namurphy merged commit 17aecc2 into PlasmaPy:main Nov 28, 2022
@namurphy namurphy deleted the code-blocks branch November 28, 2022 17:33
@namurphy namurphy added the linters For linters (e.g., flake8, ruff) and autoformatters (e.g., ruff, black, isort, Sourcery) label May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linters For linters (e.g., flake8, ruff) and autoformatters (e.g., ruff, black, isort, Sourcery)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants