mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-19 13:38:30 +02: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
|
junit: results.xml
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
# Format anything python with python-black
|
# Format anything python with ruff
|
||||||
#
|
#
|
||||||
python-black:
|
python-black:
|
||||||
extends:
|
extends:
|
||||||
|
|
@ -147,9 +147,9 @@ python-black:
|
||||||
before_script:
|
before_script:
|
||||||
- python3 -m venv venv
|
- python3 -m venv venv
|
||||||
- source venv/bin/activate
|
- source venv/bin/activate
|
||||||
- pip3 install black
|
- pip3 install ruff
|
||||||
script:
|
script:
|
||||||
- black --check --diff . proto/ei-scanner
|
- ruff format --check --diff . proto/ei-scanner
|
||||||
|
|
||||||
# Lint with Ruff
|
# Lint with Ruff
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ check-merge-request:
|
||||||
junit: results.xml
|
junit: results.xml
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
# Format anything python with python-black
|
# Format anything python with ruff
|
||||||
#
|
#
|
||||||
python-black:
|
python-black:
|
||||||
extends:
|
extends:
|
||||||
|
|
@ -153,9 +153,9 @@ python-black:
|
||||||
before_script:
|
before_script:
|
||||||
- python3 -m venv venv
|
- python3 -m venv venv
|
||||||
- source venv/bin/activate
|
- source venv/bin/activate
|
||||||
- pip3 install black
|
- pip3 install ruff
|
||||||
script:
|
script:
|
||||||
- black --check --diff . proto/ei-scanner
|
- ruff format --check --diff . proto/ei-scanner
|
||||||
|
|
||||||
# Lint with Ruff
|
# Lint with Ruff
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,13 @@ repos:
|
||||||
- id: check-symlinks
|
- id: check-symlinks
|
||||||
- id: no-commit-to-branch
|
- id: no-commit-to-branch
|
||||||
args: ['--branch', 'main']
|
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
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||||
rev: v0.1.7
|
rev: v0.1.7
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: ['--ignore=E741,E501', '.', 'proto/ei-scanner']
|
args: ['--ignore=E741,E501', '.', 'proto/ei-scanner']
|
||||||
|
- id: ruff-format
|
||||||
|
args: ['.', 'proto/ei-scanner']
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: ci-fairy-generate-template
|
- id: ci-fairy-generate-template
|
||||||
|
|
|
||||||
12
meson.build
12
meson.build
|
|
@ -113,18 +113,14 @@ subdir('tools')
|
||||||
subdir('test')
|
subdir('test')
|
||||||
subdir('doc')
|
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)
|
ruff = find_program('ruff', required: false)
|
||||||
if ruff.found()
|
if ruff.found()
|
||||||
test('python-ruff', ruff,
|
test('python-ruff', ruff,
|
||||||
args: ['check', '--ignore=E741,E501', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
args: ['check', '--ignore=E741,E501', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
||||||
suite: 'python',
|
suite: 'python',
|
||||||
)
|
)
|
||||||
|
test('python-ruff-format', ruff,
|
||||||
|
args: ['format', meson.project_source_root(), meson.project_source_root() / 'proto' / 'ei-scanner'],
|
||||||
|
suite: 'python',
|
||||||
|
)
|
||||||
endif
|
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
|
invalid_type = 4
|
||||||
try:
|
try:
|
||||||
EiHandshake.EiContextType(invalid_type)
|
EiHandshake.EiContextType(invalid_type)
|
||||||
assert (
|
assert False, f"{invalid_type} should not be a valid ContextType, this test needs an update"
|
||||||
False
|
|
||||||
), f"{invalid_type} should not be a valid ContextType, this test needs an update"
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -1101,7 +1099,9 @@ class TestEiProtocol:
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class Status:
|
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)
|
all_caps: int = attr.ib(default=0)
|
||||||
|
|
||||||
status = Status()
|
status = Status()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue