From bfad881891eca35cb22959eb5848aec9c784085e Mon Sep 17 00:00:00 2001 From: Cliff Su Date: Mon, 21 Aug 2023 22:34:16 +0800 Subject: [PATCH] [ISSUE-#32] chore: add pre-commit, isort, yapf --- .pre-commit-config.yaml | 32 ++++++++++++++++++++++++++++++++ TaiwanLottery/utils.py | 5 +++-- requirements.txt | Bin 224 -> 263 bytes setup.cfg | 1 + setup.py | 1 + 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d4091cc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: check-added-large-files + - id: check-ast + - id: check-case-conflict + - id: check-json + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + + - repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + args: + - --max-line-length=160 + - repo: https://github.com/PyCQA/isort + rev: 5.11.5 + hooks: + - id: isort + args: + - --line-length=160 + - repo: https://github.com/pre-commit/mirrors-yapf + rev: v0.32.0 + hooks: + - id: yapf + args: + - column_limit = 160 + additional_dependencies: [toml] diff --git a/TaiwanLottery/utils.py b/TaiwanLottery/utils.py index d0d0ad7..c53adcb 100644 --- a/TaiwanLottery/utils.py +++ b/TaiwanLottery/utils.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- import datetime -import math -import logging import json +import logging +import math + from terminaltables import AsciiTable diff --git a/requirements.txt b/requirements.txt index 7909ee53a5a75b43be7ce03df1de170e3abb10ac..242316de01ab4318cb0a7e27a252e1ab7105e802 100644 GIT binary patch delta 46 tcmaFB*v>TJfjTb(7efI<5ko42E<-XyK0_`LW-^p8*aD$3gB}!f0RZ`I2#){& delta 6 NcmZo?dcZj00RRZS0^0xp diff --git a/setup.cfg b/setup.cfg index cbf9916..47e29d8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,6 +29,7 @@ testing = pytest>=7.0 pytest-cov>=4.0 flake8>=6.0 + pre-commit>=3.3 [flake8] max-line-length = 160 diff --git a/setup.py b/setup.py index b39d725..d3c6529 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ "pytest>=7.0", "pytest-cov>=4.0", "flake8>=6.0", + "pre-commit>=3.3" ], keywords=['python', 'taiwanlottery', 'crawler', 'lottery', 'taiwan', '台灣彩券', '樂透', '彩券'], classifiers=[