Skip to content

Commit

Permalink
Refactor 2023 (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Mar 21, 2023
1 parent 2b569f6 commit 006a0b8
Show file tree
Hide file tree
Showing 26 changed files with 1,092 additions and 1,357 deletions.
18 changes: 0 additions & 18 deletions .deepsource.toml

This file was deleted.

4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

18 changes: 0 additions & 18 deletions .github/dependabot.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@168b99b3c22180941ae7dbdd5f5c9678ede476ba # v2
- name: 🚀 Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@168b99b3c22180941ae7dbdd5f5c9678ede476ba # v2
4 changes: 2 additions & 2 deletions .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🚀 Run Label Syncer
uses: micnncim/action-label-syncer@v1.3.0
uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
279 changes: 177 additions & 102 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,125 +7,200 @@ on:
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"

jobs:
precommit:
name: ${{ matrix.name }}
codespell:
name: codespell
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Check code for common misspellings
run: poetry run pre-commit run codespell --all-files

ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run Ruff
run: poetry run ruff .

black:
name: black
runs-on: ubuntu-latest
strategy:
matrix:
include:
- id: bandit
name: Check with bandit
- id: black
name: Check code style
- id: blacken-docs
name: Check code style in documentation
- id: check-ast
name: Check Python AST
- id: check-case-conflict
name: Check for case conflicts
- id: check-docstring-first
name: Check docstring is first
- id: check-executables-have-shebangs
name: Check that executables have shebangs
- id: check-json
name: Check JSON files
- id: check-merge-conflict
name: Check for merge conflicts
- id: check-symlinks
name: Check for broken symlinks
- id: check-toml
name: Check TOML files
- id: check-xml
name: Check XML files
- id: check-yaml
name: Check YAML files
- id: codespell
name: Check code for common misspellings
- id: debug-statements
name: Debug Statements and imports (Python)
- id: detect-private-key
name: Detect Private Keys
- id: end-of-file-fixer
name: Check End of Files
- id: fix-byte-order-marker
name: Check UTF-8 byte order marker
- id: flake8
name: Enforcing style guide with flake8
- id: isort
name: Check imports are sorted
- id: poetry
name: Check pyproject file
- id: prettier
name: Check if code is prettier
- id: pylint
name: Check with pylint
- id: pyupgrade
name: Check for upgradable syntax
- id: trailing-whitespace
name: Trim Trailing Whitespace
- id: vulture
name: Check for unused Python code
- id: yamllint
name: Check YAML style
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v3
- name: 🏗 Set up Python 3.8
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
python-version: 3.8
- name: 🏗 Read .nvmrc
if: ${{ matrix.id == 'prettier' }}
id: nvm
run: echo "##[set-output name=nvmrc;]$(cat .nvmrc)"
- name: 🏗 Set up Node.js ${{ steps.nvm.outputs.nvmrc }}
if: ${{ matrix.id == 'prettier' }}
uses: actions/setup-node@v3.6.0
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run black on docs
run: poetry run blacken-docs

pre-commit-hooks:
name: pre-commit-hooks
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
node-version: "${{ steps.nvm.outputs.nvmrc }}"
- name: 🏗 Get pip cache dir
id: pip-cache
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: ⤵️ Restore cached Python PIP packages
uses: actions/cache@v3
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Check Python AST
run: poetry run pre-commit run check-ast --all-files
- name: 🚀 Check for case conflicts
run: poetry run pre-commit run check-case-conflict --all-files
- name: 🚀 Check docstring is first
run: poetry run pre-commit run check-docstring-first --all-files
- name: 🚀 Check that executables have shebangs
run: poetry run pre-commit run check-executables-have-shebangs --all-files
- name: 🚀 Check JSON files
run: poetry run pre-commit run check-json --all-files
- name: 🚀 Check for merge conflicts
run: poetry run pre-commit run check-merge-conflict --all-files
- name: 🚀 Check for broken symlinks
run: poetry run pre-commit run check-symlinks --all-files
- name: 🚀 Check TOML files
run: poetry run pre-commit run check-toml --all-files
- name: 🚀 Check XML files
run: poetry run pre-commit run check-xml --all-files
- name: 🚀 Check YAML files
run: poetry run pre-commit run check-yaml --all-files
- name: 🚀 Check YAML files
run: poetry run pre-commit run check-yaml --all-files
- name: 🚀 Detect Private Keys
run: poetry run pre-commit run detect-private-key --all-files
- name: 🚀 Check End of Files
run: poetry run pre-commit run end-of-file-fixer --all-files
- name: 🚀 Trim Trailing Whitespace
run: poetry run pre-commit run trailing-whitespace --all-files

pylint:
name: pylint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('.github/workflows/requirements.txt') }}
restore-keys: |
pip-${{ runner.os }}-${{ steps.python.outputs.python-version }}-
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
pip install -r .github/workflows/requirements.txt
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: ⤵️ Restore cached Python virtual environment
id: cached-poetry-dependencies
uses: actions/cache@v3
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run pylint
run: poetry run pre-commit run pylint --all-files

yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
path: .venv
key: >-
venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🏗 Get npm cache directory
if: ${{ matrix.id == 'prettier' }}
id: npm-cache
- name: 🚀 Run yamllint
run: poetry run yamllint .

prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'poetry'
- name: 🏗 Install workflow dependencies
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: ⤵️ Restore cached node modules
if: ${{ matrix.id == 'prettier' }}
uses: actions/cache@v3
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🏗 Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: node-${{ runner.os }}-${{ steps.nvm.outputs.nvmrc }}-${{ hashFiles('.github/workflows/requirements.txt') }}
restore-keys: |
node-${{ runner.os }}-${{ steps.nvm.outputs.nvmrc }}-
node-version-file: '.nvmrc'
cache: 'npm'
- name: 🏗 Install NPM dependencies
if: ${{ matrix.id == 'prettier' }}
run: npm install
- name: 🚀 Run pre-commit for ${{ matrix.id }}
run: poetry run pre-commit run ${{ matrix.id }} --all-files
- name: 🚀 Run prettier
run: poetry run pre-commit run prettier --all-files
Loading

0 comments on commit 006a0b8

Please sign in to comment.