Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

More GitHub Actions #24

Merged
merged 8 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
name: linting
# Linting tools use `pyproject.toml` and `setup.cfg` for config.

on:
- pull_request

jobs:
isort:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: isort/isort-action@master
- name: Install linting tools
run: |
pip install -r lint-requirements.txt
- name: isort
run: isort .
- name: black
run: black .
- name: flake8
run: flake8 .
# - name: mypy
# run: mypy .
- name: safety
run: safety check
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: tests

on:
- pull_request

Expand Down
2 changes: 1 addition & 1 deletion app/ui/settings_dialog.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from os import PathLike

from PySide6 import QtGui, QtWidgets
from utils import get_asset

from app.hd_active import HdActive
from app.ui.forms.settings_ui import Ui_Dialog
from app.utils import get_asset


class SettingsDialog(QtWidgets.QDialog):
Expand Down
4 changes: 2 additions & 2 deletions app/ui/system_tray_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, icon, parent=None, hd_active_file_name: str = 'hd_active.ini'
self.hd_active = HdActive(drive_paths=config.drive_paths, run=config.run, wait=config.wait)
if HD_ACTION_DEBUG:
# Disable actual writing to HD
self.hd_active.write_hds = lambda: None
self.hd_active.write_hds = lambda: None # type: ignore

# Menu
menu = QtWidgets.QMenu(parent)
Expand All @@ -32,7 +32,7 @@ def __init__(self, icon, parent=None, hd_active_file_name: str = 'hd_active.ini'
show_settings_action.triggered.connect(self._show_settings_dialog)
menu.addSeparator()
quit_action = menu.addAction('Exit')
quit_action.triggered.connect(QtWidgets.QApplication.instance().quit)
quit_action.triggered.connect(QtWidgets.QApplication.instance().quit) # type: ignore
self.setContextMenu(menu)

# Other events
Expand Down
7 changes: 1 addition & 6 deletions dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
-r requirements.txt
bandit
black
flake8
-r lint-requirements.txt
invoke
isort
mypy
pip-tools
pre-commit
pytest
pytest-check
safety
97 changes: 69 additions & 28 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,86 +9,115 @@ atomicwrites==1.4.0
attrs==21.4.0
# via pytest
bandit==1.7.1
# via -r .\dev-requirements.in
# via -r .\lint-requirements.txt
black==21.12b0
# via -r .\dev-requirements.in
# via -r .\lint-requirements.txt
certifi==2021.10.8
# via requests
# via
# -r .\lint-requirements.txt
# requests
cfgv==3.3.1
# via pre-commit
charset-normalizer==2.0.10
# via requests
# via
# -r .\lint-requirements.txt
# requests
click==8.0.3
# via
# -r .\lint-requirements.txt
# black
# pip-tools
# safety
colorama==0.4.4
# via
# -r .\lint-requirements.txt
# bandit
# click
# pytest
distlib==0.3.4
# via virtualenv
dparse==0.5.1
# via safety
# via
# -r .\lint-requirements.txt
# safety
filelock==3.4.2
# via virtualenv
flake8==4.0.1
# via -r .\dev-requirements.in
# via -r .\lint-requirements.txt
gitdb==4.0.9
# via gitpython
gitpython==3.1.24
# via bandit
identify==2.4.1
# via
# -r .\lint-requirements.txt
# gitpython
gitpython==3.1.26
# via
# -r .\lint-requirements.txt
# bandit
identify==2.4.5
# via pre-commit
idna==3.3
# via requests
# via
# -r .\lint-requirements.txt
# requests
iniconfig==1.1.1
# via pytest
invoke==1.6.0
# via -r .\dev-requirements.in
isort==5.10.1
# via -r .\dev-requirements.in
# via -r .\lint-requirements.txt
mccabe==0.6.1
# via flake8
mypy==0.930
# via -r .\dev-requirements.in
# via
# -r .\lint-requirements.txt
# flake8
mypy==0.931
# via -r .\lint-requirements.txt
mypy-extensions==0.4.3
# via
# -r .\lint-requirements.txt
# black
# mypy
nodeenv==1.6.0
# via pre-commit
packaging==21.3
# via
# -r .\lint-requirements.txt
# dparse
# pytest
# safety
pathspec==0.9.0
# via black
# via
# -r .\lint-requirements.txt
# black
pbr==5.8.0
# via stevedore
# via
# -r .\lint-requirements.txt
# stevedore
pep517==0.12.0
# via pip-tools
pip-tools==6.4.0
# via -r .\dev-requirements.in
platformdirs==2.4.1
# via
# -r .\lint-requirements.txt
# black
# virtualenv
pluggy==1.0.0
# via pytest
pre-commit==2.16.0
pre-commit==2.17.0
# via -r .\dev-requirements.in
py==1.11.0
# via pytest
pycodestyle==2.8.0
# via flake8
# via
# -r .\lint-requirements.txt
# flake8
pyflakes==2.4.0
# via flake8
pyparsing==3.0.6
# via packaging
# via
# -r .\lint-requirements.txt
# flake8
pyparsing==3.0.7
# via
# -r .\lint-requirements.txt
# packaging
pyside6==6.2.2.1
# via -r .\requirements.txt
pytest==6.2.5
Expand All @@ -99,39 +128,51 @@ pytest-check==1.0.4
# via -r .\dev-requirements.in
pyyaml==6.0
# via
# -r .\lint-requirements.txt
# bandit
# dparse
# pre-commit
requests==2.27.1
# via safety
# via
# -r .\lint-requirements.txt
# safety
safety==1.10.3
# via -r .\dev-requirements.in
# via -r .\lint-requirements.txt
shiboken6==6.2.2.1
# via
# -r .\requirements.txt
# pyside6
six==1.16.0
# via virtualenv
smmap==5.0.0
# via gitdb
# via
# -r .\lint-requirements.txt
# gitdb
stevedore==3.5.0
# via bandit
# via
# -r .\lint-requirements.txt
# bandit
toml==0.10.2
# via
# -r .\lint-requirements.txt
# dparse
# pre-commit
# pytest
tomli==1.2.3
# via
# -r .\lint-requirements.txt
# black
# mypy
# pep517
typing-extensions==4.0.1
# via
# -r .\lint-requirements.txt
# black
# mypy
urllib3==1.26.7
# via requests
urllib3==1.26.8
# via
# -r .\lint-requirements.txt
# requests
virtualenv==20.13.0
# via pre-commit
wheel==0.37.1
Expand Down
6 changes: 6 additions & 0 deletions lint-requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bandit
black
flake8
isort
mypy
safety
85 changes: 85 additions & 0 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile '.\lint-requirements.in'
#
bandit==1.7.1
# via -r .\lint-requirements.in
black==21.12b0
# via -r .\lint-requirements.in
certifi==2021.10.8
# via requests
charset-normalizer==2.0.10
# via requests
click==8.0.3
# via
# black
# safety
colorama==0.4.4
# via
# bandit
# click
dparse==0.5.1
# via safety
flake8==4.0.1
# via -r .\lint-requirements.in
gitdb==4.0.9
# via gitpython
gitpython==3.1.26
# via bandit
idna==3.3
# via requests
isort==5.10.1
# via -r .\lint-requirements.in
mccabe==0.6.1
# via flake8
mypy==0.931
# via -r .\lint-requirements.in
mypy-extensions==0.4.3
# via
# black
# mypy
packaging==21.3
# via
# dparse
# safety
pathspec==0.9.0
# via black
pbr==5.8.0
# via stevedore
platformdirs==2.4.1
# via black
pycodestyle==2.8.0
# via flake8
pyflakes==2.4.0
# via flake8
pyparsing==3.0.7
# via packaging
pyyaml==6.0
# via
# bandit
# dparse
requests==2.27.1
# via safety
safety==1.10.3
# via -r .\lint-requirements.in
smmap==5.0.0
# via gitdb
stevedore==3.5.0
# via bandit
toml==0.10.2
# via dparse
tomli==1.2.3
# via
# black
# mypy
typing-extensions==4.0.1
# via
# black
# mypy
urllib3==1.26.8
# via requests

# The following packages are considered to be unsafe in a requirements file:
# setuptools
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ testpaths = ['tests']
python_version = '3.10'
warn_return_any = true
warn_unused_configs = true

[[tool.mypy.overrides]]
module = ['invoke', 'pytest_check']
ignore_missing_imports = true
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configuration for tools that don't support `pyproject.toml`.

[flake8]
exclude = .git,.github,.venv,__pycache__,assets,app/ui/forms,docs,site
max-line-length = 120
3 changes: 3 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def lint(c):
"""
c.run('isort .')
c.run('black .')
c.run('flake8 .')
c.run('mypy .')
c.run('safety check')


@task
Expand Down