Skip to content

Commit 2fe03bb

Browse files
committed
add linting
1 parent 21ddfe0 commit 2fe03bb

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

.github/workflows/lint-code.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Lint code
2+
on: [push, pull_request]
3+
4+
jobs:
5+
# Use ruff to check for code style violations
6+
ruff-check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repo
10+
uses: actions/checkout@v4
11+
- name: Set up Python
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.14"
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
pip install ruff
19+
- name: ruff --> Check for style violations
20+
# Configured in pyproject.toml
21+
run: ruff check .
22+
23+
# Use ruff to check code formatting
24+
ruff-format:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout repo
28+
uses: actions/checkout@v4
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.14"
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install ruff
37+
- name: ruff --> Check code formatting
38+
run: ruff format --check .
39+
40+
# Use mypy for static type checking
41+
mypy-check:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout repo
45+
uses: actions/checkout@v4
46+
- name: Set up Python
47+
uses: actions/setup-python@v4
48+
with:
49+
python-version: "3.14"
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install mypy
54+
# Start by installing type stubs
55+
- name: mypy --> Install stubs
56+
run: mypy --install-types --non-interactive .
57+
58+
# Use pip-check-reqs/pip-missing-reqs to check for missing dependencies
59+
requirements-check:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
- name: Set up Python
65+
uses: actions/setup-python@v4
66+
with:
67+
python-version: "3.14"
68+
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install pip-check-reqs
73+
74+
- name: Run pip-check-reqs/pip-missing-reqs
75+
run: |
76+
pip-missing-reqs .
77+
78+
# Use Prettier to check various file formats
79+
prettier:
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
- name: Setup node
85+
uses: actions/setup-node@v4
86+
with:
87+
node-version: "20"
88+
89+
- name: Install Prettier
90+
run: npm install -g prettier
91+
92+
- name: Run Prettier --check
93+
run: prettier --check .

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
[tool.ruff.lint]
2+
select = [
3+
# Ruff default rules
4+
# ------------------------------
5+
"E4", # pycodestyle Imports
6+
"E7", # pycodestyle Statements
7+
"E9", # pycodestyle Runtime
8+
"F", # Pyflakes
9+
10+
# Additional Comment
11+
# ------------------------------------------------------
12+
"I", # isort Best-practice sorting of imports
13+
"UP", # pyupgrade Make sure syntax is up-to-date
14+
]
15+
ignore = [
16+
"E402", # Module level import not at top of file
17+
"E722", # Do not use bare 'except'
18+
"E741", # Ambiguous variable name
19+
]
20+
21+
[tool.mypy]
22+
ignore_missing_imports = true
23+
follow_imports = 'skip'
24+
exclude = "build"
25+
126
[project]
227
name = "dataflow_transfer"
328
version = "1.0.3"

0 commit comments

Comments
 (0)