Repository: ubersan/pylic (language: python)

Issue:
Add quality check to CI jobs and use poetry there as well



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/quality.yml
similarity index 59%
rename from .github/workflows/unit-tests.yml
rename to .github/workflows/quality.yml
index 5e4d583..514bdf4 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/quality.yml
@@ -1,11 +1,11 @@
-name: Unit tests & Coverage Report
+name: Quality checks
 on:
   push:
     branches: [ main ]
   pull_request:
     branches: [ main ]
 jobs:
-  unit-test:
+  quality-checks:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
@@ -13,6 +13,17 @@ jobs:
       uses: actions/setup-python@v2
       with:
         python-version: 3.9
+    - name: Install poetry
+      run: pip install poetry
+    - uses: actions/cache@v2
+      with:
+        path: ~/.cache/pypoetry/virtualenvs
+        key: poetry-${{ hashFiles('poetry.lock') }}
+    - name: Install dependencies
+      run: poetry install --no-root
+    - name: Lint, format, sort imports & typecheck
+      run: |
+        poetry run task quality
     - name: Run tests & generate coverage report
       run: |
         pip install pytest pytest_mock pytest-cov
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 806b735..98d37ec 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,7 +9,6 @@
     },
     "python.linting.mypyEnabled": true,
     "python.linting.mypyArgs": [
-        "--ignore-missing-imports",
         "--follow-imports=silent",
         "--show-column-numbers",
         "--show-error-codes"
diff --git a/poetry.lock b/poetry.lock
index 733e39b..b6e4764 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -188,6 +188,19 @@ category = "dev"
 optional = false
 python-versions = "*"
 
+[[package]]
+name = "isort"
+version = "5.7.0"
+description = "A Python utility / library to sort Python imports."
+category = "dev"
+optional = false
+python-versions = ">=3.6,<4.0"
+
+[package.extras]
+pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
+requirements_deprecated_finder = ["pipreqs", "pip-api"]
+colors = ["colorama (>=0.4.3,<0.5.0)"]
+
 [[package]]
 name = "jeepney"
 version = "0.6.0"
@@ -604,7 +617,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
 [metadata]
 lock-version = "1.1"
 python-versions = "^3.9"
-content-hash = "7ee19de55e64136f8d49b7cbdcf3e7ebbaf7c64026fab4dfa39e239f538c4317"
+content-hash = "78d4e5f02d7fff7691aa9afa3130ddd8a6fa9dd3c9dcc25d599b6041f62a8363"
 
 [metadata.files]
 appdirs = [
@@ -764,6 +777,10 @@ iniconfig = [
     {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
     {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
 ]
+isort = [
+    {file = "isort-5.7.0-py3-none-any.whl", hash = "sha256:fff4f0c04e1825522ce6949973e83110a6e907750cd92d128b0d14aaaadbffdc"},
+    {file = "isort-5.7.0.tar.gz", hash = "sha256:c729845434366216d320e936b8ad6f9d681aab72dc7cbc2d51bedc3582f3ad1e"},
+]
 jeepney = [
     {file = "jeepney-0.6.0-py3-none-any.whl", hash = "sha256:aec56c0eb1691a841795111e184e13cad504f7703b9a64f63020816afa79a8ae"},
     {file = "jeepney-0.6.0.tar.gz", hash = "sha256:7d59b6622675ca9e993a6bd38de845051d315f8b0c72cca3aef733a20b648657"},
diff --git a/pyproject.toml b/pyproject.toml
index dc18a9c..ad056b6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -21,10 +21,12 @@ taskipy = "^1.6.0"
 pytest = "^6.2.2"
 pytest-cov = "^2.11.1"
 pytest-mock = "^3.5.1"
+isort = "^5.7.0"
 
 [tool.taskipy.tasks]
 release = "scripts/create_new_release.sh"
 test = "pytest --cov=./ --cov-report=xml"
+quality = "black . && flake8 --count . && isort . && mypy ."
 
 [tool.pylic]
 safe_licenses = [
@@ -42,6 +44,14 @@ safe_licenses = [
 [tool.black]
 line_length = 120
 
+[tool.isort]
+multi_line_output = 3
+include_trailing_comma = "True"
+force_grid_wrap = 0
+use_parentheses = "True"
+ensure_newline_before_comments = "True"
+line_length = 120
+
 [tool.coverage.run]
 omit = ["setup.py", "pylic/__main__.py", "tests/*"]
 
diff --git a/setup.py b/setup.py
index a871f5f..43f5ca4 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-import setuptools
+import setuptools  # type: ignore
 import toml
 
 with open("README.md", "r") as readme_file:


Test patch:
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/python-version-integration-tests.yml
similarity index 100%
rename from .github/workflows/integration-tests.yml
rename to .github/workflows/python-version-integration-tests.yml
diff --git a/tests/test_pylic.py b/tests/test_pylic.py
index 85b99f0..2952c8c 100644
--- a/tests/test_pylic.py
+++ b/tests/test_pylic.py
@@ -2,6 +2,9 @@
 import string
 
 import pytest
+from pytest_mock import MockerFixture
+from toml import TomlDecodeError
+
 from pylic.pylic import (
     check_for_unnecessary_safe_licenses,
     check_for_unnecessary_unsafe_packages,
@@ -13,8 +16,6 @@
     read_license_from_metadata,
     read_pyproject_file,
 )
-from pytest_mock import MockerFixture
-from toml import TomlDecodeError
 
 
 def random_string():