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

Ruff docstring formatting #174

Merged
merged 3 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ runs:
shell: bash

# Python formatting ------------------------------------------------------------------------------------------------
# Note on sorting Python imports https://stackoverflow.com/questions/77876253/sort-imports-alphabetically-with-ruff
# Ignored rules explanation:
# D100: Missing docstring in public module
# D104: Missing docstring in public package
# D205: 1 blank line required between summary line and description
- name: Run Python
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && inputs.python == 'true' && github.event.action != 'closed'
run: |
Expand All @@ -103,7 +106,8 @@ runs:
. || true
ruff check \
--fix \
--extend-select I \
--extend-select I,D \
--ignore D100,D104,D205 \
. || true
docformatter \
--wrap-summaries 120 \
Expand Down
11 changes: 8 additions & 3 deletions utils/update_markdown_code_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ def format_code_with_ruff(temp_dir):
print(f"ERROR running ruff format ❌ {e}")

try:
# Run ruff check, ignore F821 Undefined name, F841 Local variable is assigned to but never used
# Run ruff check with ignored rules:
# D100: Missing docstring in public module
# D104: Missing docstring in public package
# D205: 1 blank line required between summary line and description
# F821: Undefined name
# F841: Local variable is assigned to but never used
subprocess.run(
[
"ruff",
"check",
"--fix",
"--extend-select=I",
"--ignore=F821,F841",
"--extend-select=I,D",
"--ignore=D100,D104,D205,F821,F841",
str(temp_dir),
],
check=True,
Expand Down
Loading