Skip to content

Commit 0655eb2

Browse files
authored
Merge pull request #1 from bookwyrm-social/workflows
Adds python validation workflows
2 parents d7f6fd6 + 9e8f064 commit 0655eb2

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed

.github/workflows/black.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Python Formatting (run tox -e black to fix)
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.9
17+
- name: Install Dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install tox==4.11.3
21+
- name: Run Black
22+
run: |
23+
tox -e black -- . --diff
24+
tox -e black -- . --check

.github/workflows/pylint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Pylint
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.9
17+
- name: Install Pylint
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install tox==4.11.3
21+
- name: Analysing the code with pylint
22+
run: |
23+
tox -e pylint -- src
24+
tox -e pylint -- tests
25+

.github/workflows/pytest.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Python Tests
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: 3.9
17+
- name: Install Dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install tox==4.11.3
21+
- name: Run Tests
22+
run: |
23+
tox -e py39

.pylintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[MAIN]
2+
load-plugins=pylint.extensions.no_self_use
3+
4+
[MESSAGES CONTROL]
5+
disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801,C3001,import-error
6+
7+
[FORMAT]
8+
max-line-length=88

src/file_resubmit/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class FileCache:
1818
def __init__(self):
1919
self.backend = self.get_backend()
2020

21+
# pylint: disable=no-self-use
2122
def get_backend(self):
2223
"""get the file_resubmit cache"""
2324
return get_cache("file_resubmit")

tests/test_all.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232

3333
# shortest possible PNG file, courtesy http://garethrees.org/2007/11/14/pngcrush/
34+
# pylint: disable=line-too-long
3435
PNG = (
3536
b"\x89PNG\r\n\x1a\n"
3637
b"\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x06\x00\x00\x00\x1f\x15\xc4\x89"
@@ -176,6 +177,7 @@ class TestModelAdmin(ModelAdmin):
176177
list page, I just return the saved object
177178
"""
178179

180+
# pylint: disable=no-self-use
179181
def response_add(
180182
self, request, obj, *args, **kwargs
181183
): # pylint: disable=unused-argument

0 commit comments

Comments
 (0)