Skip to content

Commit a25d9c9

Browse files
committed
cargo: Add some basic formatting and linting
1 parent 5b5c6f5 commit a25d9c9

File tree

3 files changed

+245
-5
lines changed

3 files changed

+245
-5
lines changed

.github/workflows/cargo.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Cargo CI
2+
3+
on:
4+
push:
5+
branches: master
6+
paths:
7+
- cargo/**
8+
pull_request:
9+
branches: master
10+
paths:
11+
- cargo/**
12+
13+
defaults:
14+
run:
15+
working-directory: cargo
16+
17+
jobs:
18+
ci:
19+
permissions:
20+
contents: read
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 30
23+
steps:
24+
# 4.2.2
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
26+
with:
27+
persist-credentials: false
28+
29+
- name: Setup Poetry
30+
run: |
31+
curl -sSL https://install.python-poetry.org | python3 -
32+
sudo ln -s /github/home/.local/bin/poetry /usr/bin/poetry
33+
34+
- name: Install python dependencies
35+
run: poetry sync --all-groups --all-extras
36+
37+
- name: Check code formatting
38+
run: poetry run ruff format --check
39+
40+
- name: Lint
41+
run: poetry run ruff check --output-format=github
42+
43+
- name: Check python types
44+
run: poetry run mypy .

cargo/poetry.lock

Lines changed: 165 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo/pyproject.toml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,44 @@ version = "0.0.1"
77
description = "Script to generate flatpak-builder manifest from Cargo lockfiles"
88
license = {text = "MIT"}
99
readme = "README.md"
10-
requires-python = "<4.0,>=3.8"
10+
requires-python = "<4.0,>=3.9"
1111
dependencies = [
1212
"aiohttp<4.0.0,>=3.9.5",
1313
"toml<1.0.0,>=0.10.2",
1414
"PyYAML<7.0.0,>=6.0.2",
1515
]
16+
17+
[tool.poetry.group.dev.dependencies]
18+
ruff = "^0.6.7"
19+
mypy = "^1.11.2"
20+
types-toml = "^0.10.8"
21+
types-pyyaml = "^6.0.12"
22+
23+
[tool.ruff]
24+
line-length = 88
25+
include = ["*.py"]
26+
target-version = "py39"
27+
28+
[tool.ruff.lint]
29+
preview = true
30+
extend-select = [
31+
"B",
32+
"ERA",
33+
"I",
34+
"PLE",
35+
"PLW",
36+
"W",
37+
]
38+
39+
[tool.ruff.format]
40+
line-ending = "lf"
41+
quote-style = "double"
42+
43+
[tool.mypy]
44+
disallow_untyped_defs = true
45+
disallow_any_unimported = true
46+
no_implicit_optional = true
47+
check_untyped_defs = true
48+
warn_unused_ignores = true
49+
show_error_codes = true
50+
warn_return_any = true

0 commit comments

Comments
 (0)