Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace flake8 with ruff #12

Merged
merged 9 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 6 additions & 28 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Code Quality Check

on:
push:
branches: [ main ]
branches: [main]
pull_request:

env:
Expand All @@ -14,35 +14,13 @@ env:

jobs:
format:
name: Format and Lint Check
name: Format and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/checkout@v3
- uses: psf/black@stable
with:
python-version: 3.9
- name: Cache python environment
id: cache-env
uses: actions/cache@v2
src: "./acapy_cache_redis"
- uses: chartboost/ruff-action@v1
with:
path: env
key: ${{ runner.os }}-format-lint-${{ env.FLAKE8_VERSION }}-${{ env.BLACK_VERSION }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }}
- name: create virtual environment
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
python -m venv env
- name: Install dependencies
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
env/bin/python -m pip install black==${{ env.BLACK_VERSION }}
env/bin/python -m pip install flake8==${{ env.FLAKE8_VERSION }}
- name: Black Format Check
run: |
env/bin/python -m black --check acapy_cache_redis int/tests
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
env/bin/python -m flake8 . --exclude=env --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
env/bin/python -m flake8 . --exclude=env --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
src: "./acapy_cache_redis"
1 change: 0 additions & 1 deletion acapy_cache_redis/v0_1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import logging
import os

from aries_cloudagent.cache.base import BaseCache
from aries_cloudagent.config.injection_context import InjectionContext
Expand Down
6 changes: 3 additions & 3 deletions acapy_cache_redis/v0_1/redis_base_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ def __init__(self, root_profile: Profile) -> None:
credentials = config["credentials"]
self.username = credentials["username"]
self.password = credentials["password"]
except KeyError as error:
except KeyError:
pass

# Get the connection string
try:
self.max_connections = int(config["max_connections"])
except:
except KeyError:
self.max_connections = 50
LOGGER.debug(f"Max Redis Cache Pool connections set to: {self.max_connections}")

# Get the SSL CA Cert information (special redis SSL implementations only)
try:
lssl = config["ssl"]
self.ca_cert = lssl["cacerts"]
except KeyError as error:
except KeyError:
pass

# Get the prefix to seperate out ACA-Py instances
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN curl -sSL https://install.python-poetry.org | python -
RUN poetry config virtualenvs.create true; poetry config virtualenvs.in-project true

RUN mkdir acapy_cache_redis && touch acapy_cache_redis/__init__.py
COPY README.md setup.py pyproject.toml poetry.lock ./
COPY README.md pyproject.toml poetry.lock ./

RUN poetry install --no-dev

Expand Down
79 changes: 28 additions & 51 deletions int/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions int/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tool.poetry]
name = "acapy-plugin-qa-int-tests"
name = "acapy-cache-redis-int-tests"
version = "0.1.0"
description = "Integration tests for ACA-Py QA Protocol Plugin"
authors = ["Daniel Bluhm <[email protected]>"]
description = "Integration tests for ACA-Py Redis Cache Plugin"
authors = ["Colton Wolkins <[email protected]"]

[tool.poetry.dependencies]
python = "^3.9"
Expand All @@ -16,7 +16,7 @@ redis = "^4.1.4"

[tool.poetry.dev-dependencies]
black = "^23.7.0"
flake8 = "^6.0.0"
ruff = "^0.0.287"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 0 additions & 2 deletions int/tests/cluster/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import pytest
import json

from echo_agent.client import EchoClient
from echo_agent.models import ConnectionInfo


LOGGER = logging.getLogger(__name__)
Expand Down
2 changes: 0 additions & 2 deletions int/tests/host/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import pytest
import json

from echo_agent.client import EchoClient
from echo_agent.models import ConnectionInfo


LOGGER = logging.getLogger(__name__)
Expand Down
Loading