chore(gh-actions): add linting

fix: typo

style: rename job
This commit is contained in:
Kristofers Solo 2024-01-09 17:49:13 +02:00
parent 12776ee181
commit c3443b5385
5 changed files with 69 additions and 42 deletions

25
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Lint
on: [push, pull_request]
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Analysing the code with mypy
run: |
mypy $(git ls-files '*.py')
- name: Analysing the code with ruff
run: |
ruff check $(git ls-files '*.py')

View File

@ -73,12 +73,13 @@ ignore = ["E741"]
show-fixes = true show-fixes = true
line-length = 120 line-length = 120
indent-width = 4 indent-width = 4
target-version = "py38" target-version = "py310"
[tool.ruff.lint] [tool.ruff.lint]
extend-select = ["I"] extend-select = ["I"]
preview = true preview = true
fixable = ["ALL"]
[tool.ruff.format] [tool.ruff.format]
quote-style = "double" quote-style = "double"

View File

@ -1,3 +1,4 @@
mypy==1.8.0 mypy==1.8.0
pytest==7.4.3 pytest==7.4.3
ruff==0.1.9 ruff==0.1.9
types-toml==0.10.8.7

View File

@ -355,10 +355,10 @@ class Tetris(BaseScreen):
def _initialize_timers(self) -> None: def _initialize_timers(self) -> None:
"""Initialize game timers.""" """Initialize game timers."""
self.timers = Timers( self.timers = Timers(
Timer(self.initial_block_speed, True, self.move_down), Timer(self.initial_block_speed, True, self.move_down), # type: ignore
Timer(CONFIG.game.movment_delay), Timer(CONFIG.game.movment_delay), # type: ignore
Timer(CONFIG.game.rotation_delay), Timer(CONFIG.game.rotation_delay), # type: ignore
Timer(CONFIG.game.drop_delay), Timer(CONFIG.game.drop_delay), # type: ignore
) )
self.timers.vertical.activate() self.timers.vertical.activate()

View File

@ -57,10 +57,10 @@ def run() -> None:
game.Main(GameMode.PLAYER).run() game.Main(GameMode.PLAYER).run()
def main(args: argparse.ArgumentParser) -> None: def main(args) -> None:
if args.debug: if args.debug: # type: ignore
level = "debug" level = "debug"
elif args.verbose: elif args.verbose: # type: ignore
level = "info" level = "info"
else: else:
level = "warning" level = "warning"
@ -72,4 +72,4 @@ def main(args: argparse.ArgumentParser) -> None:
if __name__ == "__main__": if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
main(args) main(args) # type: ignore