Skip to content

Commit e633e62

Browse files
committed
Use uv and ruff linter
1 parent c760d71 commit e633e62

15 files changed

Lines changed: 788 additions & 428 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,22 @@ jobs:
2828

2929
steps:
3030

31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v6
3232

33-
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v5
33+
- name: Install uv and set the Python version
34+
uses: astral-sh/setup-uv@v7
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737

38+
- name: Install the project
39+
run: uv sync --locked --all-extras --dev
40+
3841
- name: Install dependencies
3942
run: |
4043
sudo apt-get install gettext aspell aspell-fr enchant-2
41-
pip install -r requirements.txt
42-
pip install bandit coverage flake8 pylint pytest pytest-cov
43-
44-
- name: Lint with flake8
45-
run: make flake8
46-
47-
- name: Lint with pylint
48-
run: make pylint
4944
50-
- name: Lint with bandit
51-
run: make bandit
45+
- name: Lint
46+
run: make lint
5247

53-
- name: Test with pytest
48+
- name: Run tests
5449
run: make test

.github/workflows/reuse.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818

19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v6
2020

2121
- name: REUSE Compliance Check
22-
uses: fsfe/reuse-action@v4
22+
uses: fsfe/reuse-action@v6

Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,10 @@ all: check
2323

2424
check: lint test
2525

26-
lint: flake8 pylint bandit
26+
lint: ruff
2727

28-
flake8:
29-
flake8 . --count --select=E9,F63,F7,F82 --ignore=E203,W503 --show-source --statistics
30-
flake8 . --count --ignore=E203,W503 --exit-zero --max-complexity=10 --statistics
31-
32-
pylint:
33-
pylint --disable=W0511 msgcheck
34-
pylint --disable=W0511 tests
35-
36-
bandit:
37-
bandit -r msgcheck
28+
ruff:
29+
uvx ruff check
3830

3931
test:
40-
pytest -vv --cov-report term-missing --cov=msgcheck tests
32+
uv run pytest -vv --cov=msgcheck --cov-report=term-missing

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Msgcheck performs various checks on gettext files (with extension `.po`):
2323

2424
The script requires:
2525

26-
- Python ≥ 3.6
26+
- Python ≥ 3.9
2727
- gettext (for the command `msgfmt`, used to compile PO files)
2828
- the python module `pyenchant` if spelling is checked (with option `-s`).
2929

REUSE.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ precedence = "override"
1313
SPDX-FileCopyrightText = "2009-2025 Sébastien Helleu <flashcode@flashtux.org>"
1414
SPDX-License-Identifier = "GPL-3.0-or-later"
1515

16+
[[annotations]]
17+
path = "uv.lock"
18+
precedence = "override"
19+
SPDX-FileCopyrightText = "2025 Sébastien Helleu <flashcode@flashtux.org>"
20+
SPDX-License-Identifier = "GPL-3.0-or-later"
21+
1622
[[annotations]]
1723
path = "tests/fr_invalid_utf8.po"
1824
precedence = "override"

pyproject.toml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-FileCopyrightText: 2025 Sébastien Helleu <flashcode@flashtux.org>
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
[project]
6+
name = "msgcheck"
7+
version = "4.2.0-dev"
8+
description = "Perform various checks on gettext files"
9+
readme = "README.md"
10+
authors = [
11+
{ name = "Sébastien Helleu", email = "flashcode@flashtux.org" }
12+
]
13+
license = "GPL-3.0-or-later"
14+
keywords = ["gettext"]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Environment :: Console",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
20+
"Natural Language :: English",
21+
"Operating System :: OS Independent",
22+
"Programming Language :: Python",
23+
"Programming Language :: Python :: 3",
24+
"Topic :: Software Development :: Localization",
25+
]
26+
requires-python = ">=3.9"
27+
dependencies = [
28+
"pyenchant>=3.3.0",
29+
]
30+
31+
[project.scripts]
32+
msgcheck = "msgcheck:main"
33+
34+
[project.urls]
35+
Repository = "https://github.com/flashcode/msgcheck"
36+
Issues = "https://github.com/flashcode/msgcheck/issues"
37+
Changelog = "https://github.com/flashcode/msgcheck/blob/main/CHANGELOG.md"
38+
39+
[build-system]
40+
requires = ["uv_build>=0.9.17,<0.10.0"]
41+
build-backend = "uv_build"
42+
43+
[dependency-groups]
44+
dev = [
45+
"pytest>=7.4.4",
46+
"pytest-cov>=4.1.0",
47+
]
48+
49+
[tool.ruff]
50+
line-length = 120
51+
indent-width = 4
52+
53+
[tool.ruff.lint]
54+
select = ["ALL"]
55+
56+
[tool.ruff.lint.extend-per-file-ignores]
57+
"tests/*.py" = [
58+
"ANN001", # missing-type-function-argument
59+
"FBT", # flake8-boolean-trap
60+
"PLR2004", # magic-value-comparison
61+
"S101", # assert
62+
]

requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 61 deletions
This file was deleted.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
#
32
# SPDX-FileCopyrightText: 2009-2025 Sébastien Helleu <flashcode@flashtux.org>
43
#
@@ -22,5 +21,9 @@
2221

2322
"""Gettext file checker."""
2423

25-
from . import msgcheck # noqa: F401
26-
from . import po # noqa: F401
24+
from msgcheck.msgcheck import check
25+
26+
27+
def main() -> None:
28+
"""Check files."""
29+
check()

0 commit comments

Comments
 (0)