mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-01-26 06:10:23 +01:00
Drop black, switch to ruff format
This commit is contained in:
parent
dbc06510a1
commit
0770fec433
6 changed files with 18 additions and 23 deletions
|
|
@ -138,7 +138,7 @@ check-merge-request:
|
|||
junit: results.xml
|
||||
allow_failure: true
|
||||
|
||||
# Format anything python with python-black
|
||||
# Format anything python with ruff
|
||||
#
|
||||
python-black:
|
||||
extends:
|
||||
|
|
@ -147,9 +147,9 @@ python-black:
|
|||
before_script:
|
||||
- python3 -m venv venv
|
||||
- source venv/bin/activate
|
||||
- pip3 install black
|
||||
- pip3 install ruff
|
||||
script:
|
||||
- black --check --diff . proto/ei-scanner
|
||||
- ruff format --check --diff . proto/ei-scanner
|
||||
|
||||
# Lint with Ruff
|
||||
#
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ check-merge-request:
|
|||
junit: results.xml
|
||||
allow_failure: true
|
||||
|
||||
# Format anything python with python-black
|
||||
# Format anything python with ruff
|
||||
#
|
||||
python-black:
|
||||
extends:
|
||||
|
|
@ -153,9 +153,9 @@ python-black:
|
|||
before_script:
|
||||
- python3 -m venv venv
|
||||
- source venv/bin/activate
|
||||
- pip3 install black
|
||||
- pip3 install ruff
|
||||
script:
|
||||
- black --check --diff . proto/ei-scanner
|
||||
- ruff format --check --diff . proto/ei-scanner
|
||||
|
||||
# Lint with Ruff
|
||||
#
|
||||
|
|
|
|||
|
|
@ -8,16 +8,13 @@ repos:
|
|||
- id: check-symlinks
|
||||
- id: no-commit-to-branch
|
||||
args: ['--branch', 'main']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.11.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: ['--check', '--diff', '.', 'proto/ei-scanner']
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: v0.1.7
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ['--ignore=E741,E501', '.', 'proto/ei-scanner']
|
||||
- id: ruff-format
|
||||
args: ['.', 'proto/ei-scanner']
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: ci-fairy-generate-template
|
||||
|
|
|
|||
12
meson.build
12
meson.build
|
|
@ -113,18 +113,14 @@ subdir('tools')
|
|||
subdir('test')
|
||||
subdir('doc')
|
||||
|
||||
black = find_program('black', required: false)
|
||||
if black.found()
|
||||
test('python-black', black,
|
||||
args: ['--check', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
||||
suite: 'python',
|
||||
)
|
||||
endif
|
||||
|
||||
ruff = find_program('ruff', required: false)
|
||||
if ruff.found()
|
||||
test('python-ruff', ruff,
|
||||
args: ['check', '--ignore=E741,E501', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
||||
suite: 'python',
|
||||
)
|
||||
test('python-ruff-format', ruff,
|
||||
args: ['format', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
||||
suite: 'python',
|
||||
)
|
||||
endif
|
||||
|
|
|
|||
2
ruff.toml
Normal file
2
ruff.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Same as Black.
|
||||
line-length = 88
|
||||
|
|
@ -459,9 +459,7 @@ class TestEiProtocol:
|
|||
invalid_type = 4
|
||||
try:
|
||||
EiHandshake.EiContextType(invalid_type)
|
||||
assert (
|
||||
False
|
||||
), f"{invalid_type} should not be a valid ContextType, this test needs an update"
|
||||
assert False, f"{invalid_type} should not be a valid ContextType, this test needs an update"
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
|
@ -1101,7 +1099,9 @@ class TestEiProtocol:
|
|||
|
||||
@attr.s
|
||||
class Status:
|
||||
pointers: dict[InterfaceName, Interface] = attr.ib(default=attr.Factory(dict)) # type: ignore
|
||||
pointers: dict[InterfaceName, Interface] = attr.ib(
|
||||
default=attr.Factory(dict)
|
||||
) # type: ignore
|
||||
all_caps: int = attr.ib(default=0)
|
||||
|
||||
status = Status()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue