From 2bb268dff360b932b7a5ceeac412db7bca9608a4 Mon Sep 17 00:00:00 2001 From: Benjamin Dornel Date: Sun, 8 Oct 2023 18:53:39 +0800 Subject: [PATCH] ci: add flake8 pre-commit hook --- .flake8 | 2 ++ .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 2 +- tests/integration/banks/ocbc/test_ocbc_load.py | 1 - tests/unit/test_check_trusted_user.py | 4 ++-- 5 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..2bcd70e3 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 88 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 91512699..6bd336e7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,13 @@ repos: require_serial: true types_or: [python, pyi] + - repo: https://github.com/PyCQA/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + name: flake8 + entry: flake8 + - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index f253f86f..2bdd8705 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ google-api-python-client-stubs = "^1.17.0" [tool.taskipy.tasks] format = "isort . && black ." -lint = "flake8 --max-line-length 88 monopoly && pylint monopoly" +lint = "flake8 . && pylint monopoly" test = "pytest -n auto" ci = "poetry run task format && poetry run task lint && poetry run task test" diff --git a/tests/integration/banks/ocbc/test_ocbc_load.py b/tests/integration/banks/ocbc/test_ocbc_load.py index ccfb2fe9..8d1c11cf 100644 --- a/tests/integration/banks/ocbc/test_ocbc_load.py +++ b/tests/integration/banks/ocbc/test_ocbc_load.py @@ -7,7 +7,6 @@ from monopoly.bank import Statement from monopoly.banks.ocbc import Ocbc -from monopoly.helpers.constants import ROOT_DIR from monopoly.statement import Transaction diff --git a/tests/unit/test_check_trusted_user.py b/tests/unit/test_check_trusted_user.py index 39753f10..f332fd2a 100644 --- a/tests/unit/test_check_trusted_user.py +++ b/tests/unit/test_check_trusted_user.py @@ -12,7 +12,7 @@ def test_trusted_user(message: Message): message.payload = trusted_message message.trusted_user_emails = trusted_user_emails - assert message.from_trusted_user == True + assert message.from_trusted_user def test_untrusted_user(message: Message): @@ -24,4 +24,4 @@ def test_untrusted_user(message: Message): message.payload = untrusted_message message.trusted_user_emails = trusted_user_emails - assert message.from_trusted_user == False + assert not message.from_trusted_user