From b3f3ce0b168c709370f102b51e99dcc1d45345bd Mon Sep 17 00:00:00 2001 From: Klagarge Date: Sun, 13 Apr 2025 13:58:20 +0200 Subject: [PATCH] feat: Add answer for Q2.3 and configure pre-commit with flake8 Signed-off-by: Klagarge --- .gitignore | 2 ++ .pre-commit-config.yaml | 7 +++++++ docs/questions-part2.md | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index e00e44f..62f742b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ __pycache__/ src/.pdm-python src/htmlcov src/.env + +.env diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8164ee6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: + - repo: https://github.com/pycqa/flake8 + rev: '6.1.0' # Use the latest stable version + hooks: + - id: flake8 + additional_dependencies: [] + args: [--config=tox.ini] # Use the same config as in CI \ No newline at end of file diff --git a/docs/questions-part2.md b/docs/questions-part2.md index 4f5dbb6..b56d3b3 100644 --- a/docs/questions-part2.md +++ b/docs/questions-part2.md @@ -9,3 +9,6 @@ # Answers - Part 2 ## Q2.1 Solution is to add a `rule` section to add condition to trigger the pipeline. It's what is implemented for the `docker-build` job. Another option is to use an `only` section to trigger the pipeline only if the change is made in a specific branch. It's what is implemented for the `pages` job. + +## Q2.3 +We can use a pre-commit that runs the linter before committing. This ensures that the code is linted before it is committed, which can help catch errors and improve code quality. However, this approach can be time-consuming and may require additional setup.