Skip to content

Commit

Permalink
Replace black/isort with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
leifwar committed Aug 15, 2024
1 parent c8afb2d commit 5939dcb
Show file tree
Hide file tree
Showing 11 changed files with 606 additions and 433 deletions.
9 changes: 8 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"extends": [
"config:base"
],
"lockFileMaintenance": { "enabled": true }
"lockFileMaintenance": { "enabled": true },
"packageRules": [
{
"matchDatasources": ["pypi"],
"enabled": false
}
]

}
55 changes: 26 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
---
name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '25 22 * * 1'

Expand All @@ -32,40 +33,36 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ['python']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
9 changes: 9 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
17 changes: 9 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Tests

on: [push, pull_request]
Expand All @@ -19,9 +20,9 @@ jobs:
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

- name: Install and configure Poetry
uses: abatilo/actions-poetry@v2.1.6
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.2.1
poetry-version: 1.8.3

- name: Set poetry virtualenv to local
run: poetry config virtualenvs.in-project true
Expand All @@ -45,21 +46,21 @@ jobs:
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.9', '3.10']
poetry-version: [ 1.2.1 ]
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
poetry-version: [1.8.3]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install and configure Poetry
uses: abatilo/actions-poetry@v2.1.6
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: ${{ matrix.poetry-version }}

Expand Down
41 changes: 6 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,18 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-json
- id: check-merge-conflict
- id: debug-statements
- id: detect-private-key
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: pycln
args: [--all]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies:
- pyflakes
- pycodestyle
- flake8-bugbear
- flake8-comprehensions
- flake8-eradicate
- flake8-mutable
- flake8-simplify
- flake8-builtins
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.6
hooks:
- id: python-bandit-vulnerability-check
args: [-ll, -ii, --exclude, ./.venv/*, --recursive, .]
pass_filenames: false
always_run: true
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
Loading

0 comments on commit 5939dcb

Please sign in to comment.