mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-07-24 23:17:43 +00:00
Cleanup workflows
- Added Bandit - Added unimport, isort, flynt - Added PyRight - Enabled preview mode on Bandit
This commit is contained in:
parent
ec7f825107
commit
f38f253de0
6 changed files with 164 additions and 46 deletions
30
.github/workflows/autoblack.yml
vendored
30
.github/workflows/autoblack.yml
vendored
|
@ -1,30 +0,0 @@
|
||||||
# GitHub Action that uses Black to reformat the Python code in an incoming pull request.
|
|
||||||
# If all Python code in the pull request is compliant with Black then this Action does nothing.
|
|
||||||
# Othewrwise, Black is run and its changes are committed back to the incoming pull request.
|
|
||||||
# https://github.com/cclauss/autoblack
|
|
||||||
|
|
||||||
name: autoblack
|
|
||||||
on: [pull_request]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Set up Python 3.7
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: 3.7
|
|
||||||
- name: Install Black
|
|
||||||
run: pip install black
|
|
||||||
- name: Run black --check .
|
|
||||||
run: black --check .
|
|
||||||
- name: If needed, commit black changes to the pull request
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
black .
|
|
||||||
git config --global user.name 'autoblack'
|
|
||||||
git config --global user.email 'cclauss@users.noreply.github.com'
|
|
||||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
|
||||||
git checkout $GITHUB_HEAD_REF
|
|
||||||
git commit -am "fixup: Format Python code with Black"
|
|
||||||
git push
|
|
26
.github/workflows/bandit.yml
vendored
Normal file
26
.github/workflows/bandit.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
name: Bandit
|
||||||
|
|
||||||
|
on: [ pull_request, push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: github.event.pull_request.user.type != 'Bot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [ '3.8', '3.9', '3.10' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install Bandit
|
||||||
|
run: pip install -U pip bandit
|
||||||
|
|
||||||
|
- name: Run Bandit
|
||||||
|
run: bandit --recursive ./
|
47
.github/workflows/lint.yml
vendored
Normal file
47
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
name: Lint
|
||||||
|
|
||||||
|
on: [ pull_request, push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: github.event.pull_request.user.type != 'Bot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [ '3.8', '3.9', '3.10' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install Unimport, Isort, Black, and Flynt
|
||||||
|
run: pip install -U pip unimport isort black flynt
|
||||||
|
|
||||||
|
- name: Run Unimport
|
||||||
|
continue-on-error: true
|
||||||
|
run: unimport ./ --ignore-init --gitignore -r
|
||||||
|
|
||||||
|
- name: Run Isort
|
||||||
|
run: isort ./
|
||||||
|
|
||||||
|
- name: Run Black
|
||||||
|
run: black ./
|
||||||
|
|
||||||
|
- name: Run Flynt
|
||||||
|
run: flynt ./ -tc
|
||||||
|
|
||||||
|
- name: Setup Git
|
||||||
|
run: git config user.name "Automated Linter"
|
||||||
|
|
||||||
|
- name: Push To GitHub
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
git pull
|
||||||
|
git add ./
|
||||||
|
git commit --reuse-message=HEAD
|
||||||
|
git push
|
33
.github/workflows/pylint.yml
vendored
33
.github/workflows/pylint.yml
vendored
|
@ -1,23 +1,26 @@
|
||||||
name: Pylint
|
name: PyLint
|
||||||
|
|
||||||
on: [push]
|
on: [ pull_request, push ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: github.event.pull_request.user.type != 'Bot'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.8", "3.9", "3.10"]
|
python-version: [ '3.8', '3.9', '3.10' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout Repository
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
uses: actions/checkout@v3
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
uses: actions/setup-python@v2
|
||||||
- name: Install dependencies
|
with:
|
||||||
run: |
|
python-version: ${{ matrix.python-version }}
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install pylint
|
- name: Install PyLint
|
||||||
- name: Analysing the code with pylint
|
run: pip install -U pip pylint
|
||||||
run: |
|
|
||||||
pylint $(git ls-files '*.py')
|
- name: Run PyLint
|
||||||
|
run: pylint $(git ls-files '*.py')
|
||||||
|
|
28
.github/workflows/pyright.yml
vendored
Normal file
28
.github/workflows/pyright.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
name: PyRight
|
||||||
|
|
||||||
|
on: [ pull_request, push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: github.event.pull_request.user.type != 'Bot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: [ '3.8', '3.9', '3.10' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install PyRight & Dependencies
|
||||||
|
run: |
|
||||||
|
pip install -U pip pyright
|
||||||
|
pip install -Ur requirements.txt
|
||||||
|
|
||||||
|
- name: Run PyRight
|
||||||
|
run: pyright ./
|
|
@ -1,3 +1,47 @@
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 125
|
line-length = 125
|
||||||
skip-string-normalization = true
|
skip-string-normalization = true
|
||||||
|
preview = true # better formatting basically
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
line_length = 125
|
||||||
|
combine_as_imports = true
|
||||||
|
combine_star = true
|
||||||
|
|
||||||
|
[tool.pyright]
|
||||||
|
typeCheckingMode = "basic"
|
||||||
|
strictListInference = true
|
||||||
|
strictDictionaryInference = true
|
||||||
|
strictSetInference = true
|
||||||
|
|
||||||
|
# explicity enabling is better than making it strict and disabling stuff
|
||||||
|
reportMissingModuleSource = "error"
|
||||||
|
reportAssertAlwaysTrue = "error"
|
||||||
|
reportInvalidStringEscapeSequence = "error"
|
||||||
|
reportInvalidTypeVarUse = "error"
|
||||||
|
reportSelfClsParameterName = "error"
|
||||||
|
reportUnsupportedDunderAll = "error"
|
||||||
|
reportUnusedExpression = "error"
|
||||||
|
reportWildcardImportFromLibrary = "error"
|
||||||
|
reportConstantRedefinition = "error"
|
||||||
|
reportDuplicateImport = "error"
|
||||||
|
reportImportCycles = "error"
|
||||||
|
reportIncompatibleVariableOverride = "error"
|
||||||
|
reportIncompleteStub = "error"
|
||||||
|
reportInconsistentConstructor = "error"
|
||||||
|
reportInvalidStubStatement = "error"
|
||||||
|
reportMatchNotExhaustive = "error"
|
||||||
|
reportMissingParameterType = "error"
|
||||||
|
reportTypeCommentUsage = "error"
|
||||||
|
reportUnnecessaryCast = "error"
|
||||||
|
reportUnnecessaryComparison = "error"
|
||||||
|
reportUnnecessaryIsInstance = "error"
|
||||||
|
reportUnusedClass = "error"
|
||||||
|
reportUnusedVariable = "error"
|
||||||
|
reportUntypedBaseClass = "error"
|
||||||
|
reportUntypedClassDecorator = "error"
|
||||||
|
reportUntypedFunctionDecorator = "error"
|
||||||
|
reportUntypedNamedTuple = "error"
|
||||||
|
reportCallInDefaultInitializer = "error"
|
||||||
|
reportPropertyTypeMismatch = "error"
|
||||||
|
reportUnnecessaryTypeIgnoreComment = "error"
|
Loading…
Add table
Add a link
Reference in a new issue