Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Changed

* Recommend `ruff format` instead of `yapf` for fixing code style readability [#695](https://github.com/NLeSC/python-template/pull/695)

### Removed

## 0.6.1
Expand Down
1 change: 1 addition & 0 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ ignore = [
"FIX001", # Resolve FIXMEs
"FIX002", # Resolve TODOs
"B028", # No explicit `stacklevel` keyword argument found in warning
"COM812", # Trailing commas are taken care of by `ruff format`
# No docstrings required in the following cases
"D100", # Missing module docstring
"D104", # Missing public package docstring
Expand Down
8 changes: 6 additions & 2 deletions template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ coverage report
{%- if AddLinting -%}
## Running linters locally

For linting and sorting imports we will use [ruff](https://beta.ruff.rs/docs/). Running the linters requires an
For linting and sorting imports we will use [ruff](https://docs.astral.sh/ruff/). Running the linters requires an
activated virtual environment with the development tools installed.

```shell
Expand All @@ -76,7 +76,11 @@ ruff check .
ruff check . --fix
```

To fix readability of your code style you can use [yapf](https://github.com/google/yapf).
It also provides a command to fix readability of your code style:

```shell
ruff format .
```
{%- endif -%}

{%- if AddPreCommit -%}
Expand Down
4 changes: 2 additions & 2 deletions template/{% if AddPreCommit %}.githooks{% endif %}/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ echo "Script $0 triggered ..."
echo "Starting ruff analysis..."

# quietly run ruff
ruff check --fix
ruff format
ruff check --fix .
ruff format .

# use return code to abort commit if necessary
if [ $? != "0" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ jobs:
python -m pip install .[dev,publishing]
- name: Check style against standards using ruff
run: |
ruff check
ruff format --check
ruff check .
ruff format --check .
{%- endif %}

{%- if AddTyping %}
Expand All @@ -82,4 +82,4 @@ jobs:
- name: Run {{ SelectTypeChecker }}
run: |
{{ SelectTypeChecker }}
{%- endif %}
{%- endif %}