Skip to content
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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@ on:
workflow_dispatch:

jobs:
lint:
name: Check code style
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Install precommit
run: pip install pre-commit
- name: Check lint
run: pre-commit run ruff-check --all-files
- name: Check format
run: pre-commit run ruff-format --all-files
test:
name: CI on python${{ matrix.python }} via ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: lint
strategy:
matrix:
include:
Expand Down
15 changes: 4 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.4.2
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.11
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-simplify
- id: ruff-check
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion ceph_devstack/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from ceph_devstack.resources.ceph import CephDevStack


def main():
def main(): # noqa: C901
args = parse_args(sys.argv[1:])
config.load(args.config_file)
if args.verbose:
Expand Down
4 changes: 1 addition & 3 deletions ceph_devstack/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ async def check_selinux_bool(self, name: str):
proc = await host.arun(["getsebool", name])
assert proc.stdout is not None
out = await proc.stdout.read()
if out.decode().strip() != f"{name} --> on":
return False
return True
return out.decode().strip() != f"{name} --> on"

async def get_sysctl_value(self, name: str) -> int:
proc = await host.arun(["sysctl", "-b", name])
Expand Down
4 changes: 2 additions & 2 deletions ceph_devstack/resources/ceph/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_most_recent_run(runs: list[str]) -> str:
)
)
return run_name
except StopIteration:
raise FileNotFoundError
except StopIteration as e:
raise FileNotFoundError from e


def get_job_id(jobs: list[str]):
Expand Down
2 changes: 2 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[lint]
extend-select = ["B", "C", "SIM"]