Skip to content

Commit eeeb69a

Browse files
committed
ci: Move linting to pre-commit
That's where the cool kids are 😎
1 parent 9cf6e87 commit eeeb69a

File tree

9 files changed

+82
-85
lines changed

9 files changed

+82
-85
lines changed

β€Ž.github/workflows/lint.ymlβ€Ž

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master, dev]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v3
14+
- uses: pre-commit/action@v3.0.0

β€Ž.pre-commit-config.yamlβ€Ž

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
# See https://pre-commit.ci for CI config
4+
5+
ci:
6+
autoupdate_schedule: monthly
7+
repos:
8+
- repo: meta
9+
hooks:
10+
- id: check-hooks-apply
11+
- id: check-useless-excludes
12+
- repo: local
13+
hooks:
14+
- id: check-future-annotations
15+
name: check future annotations
16+
language: script
17+
entry: scripts/check-future-annotations.sh
18+
types: [python]
19+
exclude: ^docs/source/
20+
- id: check-license-header
21+
name: check license header
22+
language: script
23+
entry: scripts/check-license-header.sh
24+
types_or: [cython, python]
25+
exclude: ^docs/source/
26+
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
27+
rev: v4.3.0
28+
hooks:
29+
- id: trailing-whitespace
30+
- id: end-of-file-fixer
31+
- id: check-yaml
32+
- id: check-added-large-files
33+
- repo: 'https://github.com/psf/black'
34+
rev: 22.6.0
35+
hooks:
36+
- id: black
37+
types: [python]
38+
- repo: 'https://github.com/pycqa/flake8'
39+
rev: 5.0.4
40+
hooks:
41+
- id: flake8
42+
additional_dependencies:
43+
- flake8-force
44+
- flake8-pytest-style
45+
types_or: [cython, python]
46+
- repo: 'https://github.com/PyCQA/isort'
47+
rev: 5.10.1
48+
hooks:
49+
- id: isort
50+
types_or: [cython, python]
51+
- repo: 'https://github.com/asottile/pyupgrade'
52+
rev: v2.37.3
53+
hooks:
54+
- id: pyupgrade
55+
types_or: [cython, python]
56+
args:
57+
- '--py37-plus'
58+
- '--keep-runtime-typing'

β€ŽREADME.rstβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
Cryptographic library for Python with Mbed TLS back end
55
=======================================================
66

7+
.. image:: https://results.pre-commit.ci/badge/github/Synss/python-mbedtls/master.svg
8+
:target: https://results.pre-commit.ci/latest/github/Synss/python-mbedtls/master
9+
:alt: pre-commit.ci status
10+
711
.. image::
812
https://github.com/Synss/python-mbedtls/actions/workflows/main.yml/badge.svg?branch=master
913
:target: https://github.com/Synss/python-mbedtls/actions/

β€Žrequirements/lint.inβ€Ž

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

β€Žrequirements/lint.txtβ€Ž

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/sh
22

33
ANNOTATIONS_MISSING="$(
4-
find programs src tests -name '*.py' -o -name '*.pyi' \
5-
| xargs grep -L '^from __future__ import annotations$'
4+
grep -L '^from __future__ import annotations$' "$@"
65
)"
76
printf "%s\n" "$ANNOTATIONS_MISSING"
87
test -z "$ANNOTATIONS_MISSING"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/sh
22

33
LICENSE_MISSING="$(
4-
find programs src tests -name '*.py' -o -name '*.pyi' -o -name '*.pyx' -o -name '*.pxd' \
5-
| xargs grep -L '^# SPDX-License-Identifier: MIT$'
4+
grep -L '^# SPDX-License-Identifier: MIT$' "$@"
65
)"
76
printf "%s\n" "$LICENSE_MISSING"
87
test -z "$LICENSE_MISSING"

β€Žsetup.pyβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
from __future__ import annotations
4+
15
import ctypes
26
import ctypes.util
37
import os

0 commit comments

Comments
Β (0)