Skip to content

Commit 6ba1fd1

Browse files
committed
add pre-commit and linter
1 parent 2437071 commit 6ba1fd1

File tree

5 files changed

+40
-2
lines changed

5 files changed

+40
-2
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ jobs:
3131
- name: Build & install
3232
run: |
3333
pip install -U pip
34-
pip install -U .
34+
pip install -U .[dev]
35+
36+
- name: Lint
37+
run: |
38+
ruff check
3539
3640
package-deploy:
3741
name: Build the Python package, and deploy if needed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ build/
22
dist/
33
ledgerblue.egg-info/
44
__pycache__
5+
.python-version
56

67
__version__.py

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.2.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
# Ruff version.
13+
rev: v0.3.7
14+
hooks:
15+
# Run the linter.
16+
- id: ruff
17+
args: [ --fix ]
18+
# Run the formatter.
19+
- id: ruff-format

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ doc = [
6262
"sphinx_rtd_theme",
6363
"sphinx_argparse"
6464
]
65+
dev = [
66+
"pre-commit==3.2.0",
67+
"ruff==0.3.7"
68+
]
6569

6670
[tool.setuptools_scm]
6771
write_to = "ledgerblue/__version__.py"
6872
local_scheme = "no-local-version"
69-
fallback_version = "0.0.0"
73+
fallback_version = "0.0.0"

ruff.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src = ["ledgerblue", "doc"]
2+
3+
[lint]
4+
# Using rules from: pycodestyle, Pyflake and isort
5+
# INP001 __init__ files check on package
6+
select = [ "E", "F", "I", "INP001"]
7+
8+
9+
[lint.per-file-ignores]
10+
"!ledgerblue/*" = ["INP001"]

0 commit comments

Comments
 (0)