From a5b238ec5beb115e26eff96291383edbf8433676 Mon Sep 17 00:00:00 2001
From: Dorian Turba <froggit.commit.z3jqj@simplelogin.com>
Date: Mon, 17 Jul 2023 13:22:42 +0200
Subject: [PATCH] add flake8

---
 .gitlab-ci.yml                                     | 11 +++++++++--
 pyproject.toml                                     | 14 ++++++++++++++
 tests/flake8_project/pyproject.toml                | 11 +++++++++++
 .../src/flake8_project}/__init__.py                |  0
 .../src/flake8_project}/main.py                    |  0
 tests/pytest_project/pyproject.toml                |  2 +-
 .../pytest_project/src/pytest_project/__init__.py  |  3 +++
 tests/pytest_project/src/pytest_project/main.py    | 11 +++++++++++
 tests/pytest_project/src/test_project/py.typed     |  0
 tests/pytest_project/tests/test_main.py            |  2 +-
 10 files changed, 50 insertions(+), 4 deletions(-)
 create mode 100644 pyproject.toml
 create mode 100644 tests/flake8_project/pyproject.toml
 rename tests/{pytest_project/src/test_project => flake8_project/src/flake8_project}/__init__.py (100%)
 rename tests/{pytest_project/src/test_project => flake8_project/src/flake8_project}/main.py (100%)
 create mode 100644 tests/pytest_project/src/pytest_project/__init__.py
 create mode 100644 tests/pytest_project/src/pytest_project/main.py
 delete mode 100644 tests/pytest_project/src/test_project/py.typed

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 76aa3cb..cff5349 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,18 @@
 stages:
-  - test
+    - code_quality
+    - test
 
 include:
     - local: 'templates/python/testing/pytest/pytest.yml'
+    - local: 'templates/python/code_quality/flake8/flake8.yml'
 
 pytest:
     variables:
-        IMAGE_TAG: "latest"
         PROJECT_PATH: "tests/pytest_project"
         PYTHON_SETUP: "pip install ${PROJECT_PATH} pytest"
+
+flake8:
+    variables:
+        IMAGE_TAG: "latest"
+        PROJECT_PATH: "tests/flake8_project"
+        PYTHON_SETUP: "pip install ${PROJECT_PATH} flake8"
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..6f9451f
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,14 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[tool.hatch.metadata]
+allow-direct-references = true
+
+[project]
+name = "r2devops_catalog"
+version = "0.1.0"
+authors = [
+    { name = "Dorian Turba", email = "author.name@example.com" },
+]
+description = "A description of what the package is for."
diff --git a/tests/flake8_project/pyproject.toml b/tests/flake8_project/pyproject.toml
new file mode 100644
index 0000000..eb3a841
--- /dev/null
+++ b/tests/flake8_project/pyproject.toml
@@ -0,0 +1,11 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "flake8_project"
+version = "0.1.0"
+authors = [
+    { name = "Author Name", email = "author.name@example.com" },
+]
+description = "A description of what the package is for."
diff --git a/tests/pytest_project/src/test_project/__init__.py b/tests/flake8_project/src/flake8_project/__init__.py
similarity index 100%
rename from tests/pytest_project/src/test_project/__init__.py
rename to tests/flake8_project/src/flake8_project/__init__.py
diff --git a/tests/pytest_project/src/test_project/main.py b/tests/flake8_project/src/flake8_project/main.py
similarity index 100%
rename from tests/pytest_project/src/test_project/main.py
rename to tests/flake8_project/src/flake8_project/main.py
diff --git a/tests/pytest_project/pyproject.toml b/tests/pytest_project/pyproject.toml
index 69a3320..b72bdac 100644
--- a/tests/pytest_project/pyproject.toml
+++ b/tests/pytest_project/pyproject.toml
@@ -3,7 +3,7 @@ requires = ["hatchling"]
 build-backend = "hatchling.build"
 
 [project]
-name = "test_project"
+name = "pytest_project"
 version = "0.1.0"
 authors = [
     { name = "Author Name", email = "author.name@example.com" },
diff --git a/tests/pytest_project/src/pytest_project/__init__.py b/tests/pytest_project/src/pytest_project/__init__.py
new file mode 100644
index 0000000..d4cc63e
--- /dev/null
+++ b/tests/pytest_project/src/pytest_project/__init__.py
@@ -0,0 +1,3 @@
+from pytest_project.main import main
+
+__all__ = ['main']
diff --git a/tests/pytest_project/src/pytest_project/main.py b/tests/pytest_project/src/pytest_project/main.py
new file mode 100644
index 0000000..28caf00
--- /dev/null
+++ b/tests/pytest_project/src/pytest_project/main.py
@@ -0,0 +1,11 @@
+"""Sample main module."""
+
+
+def main() -> bool:
+    """Sample main function."""
+    print("Hello, world!")
+    return True
+
+
+if __name__ == '__main__':
+    main()
diff --git a/tests/pytest_project/src/test_project/py.typed b/tests/pytest_project/src/test_project/py.typed
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/pytest_project/tests/test_main.py b/tests/pytest_project/tests/test_main.py
index 0c0a1de..9206179 100644
--- a/tests/pytest_project/tests/test_main.py
+++ b/tests/pytest_project/tests/test_main.py
@@ -1,6 +1,6 @@
 """Sample test module."""
 
-from test_project import main
+from pytest_project import main
 
 
 def test_main():
-- 
GitLab