Skip to content

Commit

Permalink
Merge pull request #1 from bookwyrm-social/workflows
Browse files Browse the repository at this point in the history
Adds python validation workflows
  • Loading branch information
hughrun committed Nov 8, 2023
2 parents d7f6fd6 + 9e8f064 commit 0655eb2
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Python Formatting (run tox -e black to fix)
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox==4.11.3
- name: Run Black
run: |
tox -e black -- . --diff
tox -e black -- . --check
25 changes: 25 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pylint
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Pylint
run: |
python -m pip install --upgrade pip
pip install tox==4.11.3
- name: Analysing the code with pylint
run: |
tox -e pylint -- src
tox -e pylint -- tests
23 changes: 23 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Python Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox==4.11.3
- name: Run Tests
run: |
tox -e py39
8 changes: 8 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[MAIN]
load-plugins=pylint.extensions.no_self_use

[MESSAGES CONTROL]
disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801,C3001,import-error

[FORMAT]
max-line-length=88
1 change: 1 addition & 0 deletions src/file_resubmit/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FileCache:
def __init__(self):
self.backend = self.get_backend()

# pylint: disable=no-self-use
def get_backend(self):
"""get the file_resubmit cache"""
return get_cache("file_resubmit")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


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

# pylint: disable=no-self-use
def response_add(
self, request, obj, *args, **kwargs
): # pylint: disable=unused-argument
Expand Down

0 comments on commit 0655eb2

Please sign in to comment.