Skip to content

Commit

Permalink
chore(lint): replace black, flake8 and isort with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Aug 9, 2024
1 parent e5d315d commit a8041e9
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 319 deletions.
26 changes: 0 additions & 26 deletions .flake8

This file was deleted.

39 changes: 15 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.1
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: local
hooks:
- id: black
stages: [commit]
name: black
language: system
entry: black
types: [python]
- id: isort
stages: [commit]
name: isort
language: system
entry: isort
types: [python]
- id: flake8
stages: [commit]
name: flake8
language: system
entry: flake8
types: [python]
- id: gitlint
stages: [commit-msg]
name: gitlint
description: Validate commit lint
entry: gitlint --msg-filename
language: system
- id: gitlint
stages: [commit-msg]
name: gitlint
description: Validate commit lint
entry: gitlint --msg-filename
language: system
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ etc.

```bash
# linting
poetry run flake8
poetry run ruff check .
# format code
poetry run black .
poetry run ruff format .
# running tests
poetry run pytest
# create migrations
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ test: ## Test the backend

.PHONY: lint
lint: ## Lint the backend
@docker compose run --rm alexandria sh -c "poetry run black --check . && poetry run flake8"
@docker compose run --rm alexandria sh -c "poetry run ruff check . && poetry run ruff format --check ."

.PHONY: format
format: ## format the backend
@docker compose run --rm alexandria sh -c "poetry run black . && poetry run isort ."
@docker compose run --rm alexandria sh -c "poetry run ruff check --fix . && poetry run ruff format ."

.PHONY: bash
bash: ## Shell into the backend
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://github.com/projectcaluma/alexandria/workflows/Tests/badge.svg)](https://github.com/projectcaluma/alexandria/actions?query=workflow%3ATests)
[![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)](https://github.com/projectcaluma/alexandria/blob/master/pyproject.toml#L107)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/projectcaluma/alexandria)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![License: GPL-3.0-or-later](https://img.shields.io/github/license/projectcaluma/alexandria)](https://spdx.org/licenses/GPL-3.0-or-later.html)

Our goal is to implement an external document management service to hold and provide uploaded documents.
Expand Down
Loading

0 comments on commit a8041e9

Please sign in to comment.