Skip to content

Commit

Permalink
chore(lib): fully refactor the library for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Apr 19, 2024
1 parent eff21fc commit 58a72ff
Show file tree
Hide file tree
Showing 19 changed files with 2,096 additions and 333 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/languagetool.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: LanguageTool

on:
pull_request:
path: |
"README.md"
workflow_dispatch:

name: LanguageTool check

jobs:
languagetool_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: reviewdog/action-languagetool@v1
- name: Checkout repository
uses: actions/checkout@v4

- name: Check and report
uses: reviewdog/action-languagetool@v1
with:
reporter: github-pr-review
patterns: README.md
patterns: '*.md src/**.rs'
level: warning
69 changes: 69 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Lint code and (optionally) apply fixes
name: Lint code

on:
pull_request:
push:
branches: [main]
schedule:
- cron: 0 0 * * 1 # Every monday
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install pre-commit
run: pip install pre-commit

- name: Run autoupdate
run: pre-commit autoupdate

- name: Create a pull request with updated versions
uses: peter-evans/create-pull-request@v6
with:
branch: update/pre-commit-hooks
title: 'chore(deps): update pre-commit hooks'
commit-message: 'chore(deps): update pre-commit hooks'
pre-commit:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.11'
cache: true

- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy,rustfmt

- name: Install dependencies
run: |
pdm install -G test,github-action
- name: Run pre-commit hooks
uses: pre-commit/[email protected]

- name: Apply fixes when present
uses: pre-commit-ci/[email protected]
if: always()
with:
msg: 'chore(fmt): auto fixes from pre-commit hooks'
39 changes: 0 additions & 39 deletions .github/workflows/rustlints.yml

This file was deleted.

32 changes: 25 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
hooks:
- id: markdownlint-fix
args: [--ignore, LICENSE.md]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.13.0
hooks:
- id: pretty-format-yaml
args: [--autofix]
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
args: [--autofix, --trailing-commas]
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: markdownlint-fix
args: [--ignore, LICENSE.md]
- id: cargo-check
- id: clippy
- repo: local
hooks:
- id: fmt
name: fmt
description: Format files with cargo fmt
entry: cargo +nightly fmt --
language: system
types: [rust]
args: []
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
Loading

0 comments on commit 58a72ff

Please sign in to comment.