added Black linter
This commit is contained in:
Родитель
43ffabf414
Коммит
90a4b6f217
|
@ -0,0 +1,33 @@
|
|||
name: Code Formatting
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: 'ubuntu-latest'
|
||||
name: PR Formatter
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Setup Python Dependencies
|
||||
run: |
|
||||
sudo apt-get -y install python3-pip
|
||||
sudo pip3 install pipenv
|
||||
pipenv install --dev
|
||||
- name: Format the code
|
||||
run: |
|
||||
pipenv run black . --check --diff
|
||||
|
||||
- name: Check-in updated code
|
||||
uses: EndBug/add-and-commit@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,49 +0,0 @@
|
|||
---
|
||||
############################
|
||||
############################
|
||||
## Preflight Stack Linter ##
|
||||
############################
|
||||
############################
|
||||
|
||||
#
|
||||
# Documentation:
|
||||
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
|
||||
#
|
||||
|
||||
#############################
|
||||
# Start the job on all push #
|
||||
#############################
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
###############
|
||||
# Set the Job #
|
||||
###############
|
||||
jobs:
|
||||
build:
|
||||
# Name the Job
|
||||
name: Stack linter
|
||||
# Set the agent to run on
|
||||
runs-on: ubuntu-latest
|
||||
##################
|
||||
# Load all steps #
|
||||
##################
|
||||
steps:
|
||||
##########################
|
||||
# Checkout the code base #
|
||||
##########################
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
################################
|
||||
# Run Linter against code base #
|
||||
################################
|
||||
- name: Lint Code Base
|
||||
uses: github/super-linter@v4
|
||||
env:
|
||||
DEFAULT_BRANCH: main
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VALIDATE_ALL_CODEBASE: false
|
||||
VALIDATE_DOCKERFILE: true
|
||||
VALIDATE_MARKDOWN: true
|
||||
VALIDATE_PYTHON_BLACK: true
|
|
@ -0,0 +1,18 @@
|
|||
repos:
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 20.8b1
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-isort
|
||||
rev: v5.7.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ["--profile", "black", "--filter-files"]
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.4.0
|
||||
hooks:
|
||||
- id: check-added-large-files
|
||||
args: ['--maxkb=1500']
|
|
@ -0,0 +1,9 @@
|
|||
[settings]
|
||||
atomic=True
|
||||
multi_line_output=3
|
||||
include_trailing_comma=True
|
||||
force_grid_wrap=0
|
||||
combine_as_imports=True
|
||||
line_length=88
|
||||
skip=.venv,migrations
|
||||
known_third_party=configurations,debug_toolbar,django,django_extensions,django_filters,pytest,pytz,requests,rest_framework,structlog
|
Загрузка…
Ссылка в новой задаче