Skip to content

Commit 7b7c235

Browse files
committed
Use uv and ruff linter
1 parent 6b98f24 commit 7b7c235

File tree

16 files changed

+710
-325
lines changed

16 files changed

+710
-325
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,18 @@ jobs:
2929

3030
steps:
3131

32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v6
3333

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

39-
- name: Install dependencies
40-
run: |
41-
python -m pip install --upgrade pip
42-
pip install bandit coverage flake8 mock mypy pylint pytest pytest-cov types-mock
39+
- name: Install the project
40+
run: uv sync --locked --all-extras --dev
4341

44-
- name: Lint with flake8
45-
run: make flake8
42+
- name: Lint
43+
run: make lint
4644

47-
- name: Lint with pylint
48-
run: make pylint
49-
50-
- name: Lint with mypy
51-
run: make mypy
52-
53-
- name: Lint with bandit
54-
run: make bandit
55-
56-
- name: Test with pytest
45+
- name: Run tests
5746
run: make test

Makefile

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,13 @@ all: check
2323

2424
check: lint test
2525

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

28-
flake8:
29-
flake8 weechat_script_lint tests/*.py --count --select=E9,F63,F7,F82 --ignore=E203,W503 --show-source --statistics
30-
flake8 weechat_script_lint tests/*.py --count --ignore=E203,W503 --exit-zero --max-complexity=10 --statistics
31-
32-
pylint:
33-
pylint weechat_script_lint tests/*.py
28+
ruff:
29+
uvx ruff check
3430

3531
mypy:
36-
mypy weechat_script_lint tests/*.py
37-
38-
bandit:
39-
bandit -r weechat_script_lint
32+
uvx mypy src
4033

4134
test:
42-
pytest -vv --cov-report term-missing --cov=weechat_script_lint tests
35+
uv run pytest -vv --cov=weechat_script_lint --cov-report=term-missing

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ executed in the CI of the WeeChat official scripts repository:
1818

1919
## Installation
2020

21-
The script requires Python ≥ 3.7.
21+
The script requires Python ≥ 3.9.
2222

2323
In a Python virtual environment:
2424

REUSE.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ path = "tests/scripts/**"
99
precedence = "override"
1010
SPDX-FileCopyrightText = "2021-2025 Sébastien Helleu <[email protected]>"
1111
SPDX-License-Identifier = "GPL-3.0-or-later"
12+
13+
[[annotations]]
14+
path = "uv.lock"
15+
precedence = "override"
16+
SPDX-FileCopyrightText = "2025 Sébastien Helleu <[email protected]>"
17+
SPDX-License-Identifier = "GPL-3.0-or-later"

pyproject.toml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-FileCopyrightText: 2025 Sébastien Helleu <[email protected]>
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
[project]
6+
name = "weechat-script-lint"
7+
version = "0.7.0-dev"
8+
description = "WeeChat script linter"
9+
readme = "README.md"
10+
authors = [
11+
{ name = "Sébastien Helleu", email = "[email protected]" }
12+
]
13+
license = "GPL-3.0-or-later"
14+
keywords = ["static", "analysis", "weechat", "script", "lint"]
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",
25+
"Topic :: Utilities",
26+
]
27+
requires-python = ">=3.9"
28+
29+
[project.scripts]
30+
weechat-script-lint = "weechat_script_lint:main"
31+
32+
[project.urls]
33+
Repository = "https://github.com/weechat/weechat-script-lint"
34+
Issues = "https://github.com/weechat/weechat-script-lint/issues"
35+
Changelog = "https://github.com/weechat/weechat-script-lint/blob/main/CHANGELOG.md"
36+
37+
[build-system]
38+
requires = ["uv_build>=0.9.17,<0.10.0"]
39+
build-backend = "uv_build"
40+
41+
[dependency-groups]
42+
dev = [
43+
"pytest>=7.4.4",
44+
"pytest-cov>=4.1.0",
45+
]
46+
47+
[tool.ruff]
48+
line-length = 120
49+
indent-width = 4
50+
extend-exclude = [
51+
"tests/scripts/*.py",
52+
]
53+
54+
[tool.ruff.lint]
55+
select = ["ALL"]
56+
57+
[tool.ruff.lint.extend-per-file-ignores]
58+
"tests/*.py" = [
59+
"ANN001",
60+
# at least this three should be fine in tests:
61+
"S101", # asserts allowed in tests...
62+
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
63+
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
64+
# The below are debateable
65+
"PLR2004", # Magic value used in comparison, ...
66+
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
67+
]

setup.py

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

2322
"""Static analysis tool for WeeChat scripts."""
2423

25-
from weechat_script_lint.main import * # noqa
26-
from weechat_script_lint.script import * # noqa
27-
from weechat_script_lint.utils import * # noqa
24+
from weechat_script_lint.lint import lint
25+
26+
27+
def main() -> None:
28+
"""Run weechat-script-lint."""
29+
lint()

0 commit comments

Comments
 (0)