Skip to content

Commit

Permalink
feat: integrate ruff (#144)
Browse files Browse the repository at this point in the history
* feat: change flake to ruff

* fix: finetune linting to CI pipeline

DONE:

- Removed pre-commit (different checks has to be run)
- Running hooks in a version not modifying files
  • Loading branch information
szymonmaszke authored Feb 26, 2023
1 parent 95ff783 commit 0497462
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 792 deletions.
52 changes: 10 additions & 42 deletions .github/workflows/code-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,55 +38,23 @@ jobs:
- name: Setup Dependencies
uses: ./.github/actions/setup-poetry
- name: Run Poetry check
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
poetry-check
run: poetry check
- name: Run YAML linter
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
yaml-linter
run: poetry run yamllint
- name: Run Python autoflake
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-autoflake
- name: Run Python isort
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-isort
run: poetry run autoflake --recursive --check .
- name: Run Python tryceratops
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-tryceratops
run: poetry run tryceratops .
- name: Run Python docformatter
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-docformatter
run: poetry run docformatter --recursive --check .
- name: Run Python black
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-black
run: poetry run black --check .
- name: Run Python interrogate
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-interrogate
- name: Run Python flake
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-flake
run: poetry run interrogate -c pyproject.toml .
- name: Run Python ruff
run: poetry run ruff --no-fix --format github
- name: Run Python pytype
run: >
poetry run pre-commit run
--from-ref origin/${{ github.base_ref }} --to-ref HEAD
python-pytype
run: poetry run pytype .
- name: Run reporters
run: |
echo "# Code condition report" >> $GITHUB_STEP_SUMMARY
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ruff cache
.ruff_cache
15 changes: 3 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ repos:
- commit
types:
- python
- id: python-isort
verbose: true
name: Python Isort Fixer
entry: poetry run isort .
language: system
stages:
- commit
types:
- python
- id: python-tryceratops
verbose: true
name: Python Tryceratops Fixer
Expand Down Expand Up @@ -87,10 +78,10 @@ repos:
- commit
types:
- python
- id: python-flake
- id: python-ruff
verbose: true
name: Python Flake Linter
entry: poetry run flakeheaven lint .
name: Python Ruff Linter
entry: poetry run ruff check --fix
language: system
stages:
- commit
Expand Down
Loading

0 comments on commit 0497462

Please sign in to comment.