Skip to content

Commit

Permalink
Add linting action
Browse files Browse the repository at this point in the history
  • Loading branch information
alastair committed Dec 20, 2023
1 parent 4025175 commit 6e7374a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[flake8]
exclude = */migrations
extend-ignore =
# "Celery tasks should have explicit names." isn't very well implemented at this time (4/19/2020)
PIE783
# False positive in flake8-pie 0.7 (2021-04-15)
PIE795
PIE798
PIE803
# Print found
T201

# Logging statement uses string.format()
G001
# Logging statement uses '%'
G002
# Logging statement uses '+'
G003
# Logging statement uses f-string (Same as PIE803)
G004

# This is used by flake8-import-order
import-order-style = pycharm
application-import-names = accounts, apiv2, bookmarks, clustering, comments, donations, favorites, follow, forum, freesound, general, geotags, messages, monitor, ratings, search, similarity, sounds, support, tags, tickets, utils, wiki
# This is used by flake8-requirements
known-modules =
max-line-length = 170

# This is used by flake8-annotations so that we don't have to explicitly type None in functions that don't use it
suppress-none-returning = true
22 changes: 22 additions & 0 deletions .github/workflows/python-flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Flake8
# https://gitlab.com/pycqa/flake8

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Lint with flake8
run: |
pip -q install -r requirements.linters.txt
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# These are just the style issues
flake8 . --count --statistics
15 changes: 15 additions & 0 deletions requirements.linters.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dlint
flake8
flake8-bandit
flake8-bugbear
flake8-builtins
flake8-debugger
flake8-django
flake8-eradicate
flake8-import-order
flake8-logging-format
flake8-mutable
flake8-pie
flake8-print
flake8-requirements
flake8-use-fstring

0 comments on commit 6e7374a

Please sign in to comment.