Skip to content

Commit

Permalink
Switch to ruff formatter and add extra pre-commit checks (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus authored Nov 16, 2023
1 parent e8191b3 commit f947528
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Build distributions
run: |
poetry build -vvv
- name: Upload distribution artifacts
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
poetry publish
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
21 changes: 18 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
ci:
autofix_prs: false
autoupdate_schedule: monthly

repos:
- repo: https://github.com/psf/black
rev: 23.11.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: black
- id: trailing-whitespace
exclude: ^(.*\.egg-info/|tests/(fixtures|ui).*)$
- id: end-of-file-fixer
exclude: ^(.*\.egg-info/|tests/(fixtures|ui).*)$
- id: check-merge-conflict
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: pretty-format-json
args: [ --autofix, --no-ensure-ascii, --no-sort-keys ]
- id: check-ast
- id: debug-statements
- id: check-docstring-first

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.5
hooks:
- id: ruff
- id: ruff-format
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ their version specifiers, which explicitly included `1.0.0` pre-releases.

### Removed

- Removed doc comment-based command configuration notation
- Removed doc comment-based command configuration notation
([#239](https://github.com/python-poetry/cleo/pull/239)).

### Fixed
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ poetry run pytest

## Code Style and Linters

We use [Black](https://github.com/psf/black) to format the code and [Ruff](https://github.com/charliermarsh/ruff) as the linter.
They are all integrated into [pre-commit](https://pre-commit.com/). You can enable it by:
We use [Ruff](https://github.com/charliermarsh/ruff) as the linter and formatter.
It is integrated into [pre-commit](https://pre-commit.com/). You can enable it by:

> NOTICE: `pre-commit` is declared as one of development dependencies of Cleo. If you don't have `pre-commit` installed globally, prepend the commands in this section with `poetry run`
Expand Down Expand Up @@ -58,5 +58,3 @@ your change. News fragments are placed in the `news/` directory, and should be n

The contents of the file should be a single sentence in past tense that describes your changes (e.g., `Added CONTRIBUTING.md file.`).
See entries in the [Change Log](/CHANGELOG.md) for more examples.


2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 2 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ built-in options as well as a couple of built-in commands for Cleo.

These examples assume you have added a file ``application.py`` to run at
the cli:

.. code-block:: python
#!/usr/bin/env python
Expand All @@ -18,7 +18,7 @@ built-in options as well as a couple of built-in commands for Cleo.
application = Application()
# ...
if __name__ == '__main__':
application.run()
Expand Down
1 change: 1 addition & 0 deletions news/385.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Switch to ruff formatter and add extra pre-commit checks

0 comments on commit f947528

Please sign in to comment.