Skip to content

Commit

Permalink
Add ruff formatting and linting (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
filmor authored Jul 10, 2024
1 parent f2058b4 commit 3e2dff0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ jobs:
path: "dist/*"
if-no-files-found: error

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depths: 0
- uses: actions/setup-python@v4
- name: Install Ruff
run: pip install ruff
- name: Check format
run: ruff format --check
- name: Check lints
run: ruff check

test:
runs-on: ${{ matrix.os }}
needs: build
Expand Down
2 changes: 1 addition & 1 deletion clr_loader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_mono(
jit_options: Optional[Sequence[str]] = None,
assembly_dir: Optional[str] = None,
config_dir: Optional[str] = None,
set_signal_chaining: bool = False
set_signal_chaining: bool = False,
) -> Runtime:
"""Get a Mono runtime instance
Expand Down
3 changes: 2 additions & 1 deletion clr_loader/mono.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class MethodDesc:
def __init__(self, typename, function):
self._desc = f"{typename}:{function}"
self._ptr = _MONO.mono_method_desc_new(
self._desc.encode("utf8"), 1 # include_namespace
self._desc.encode("utf8"),
1, # include_namespace
)

def search(self, image):
Expand Down
3 changes: 2 additions & 1 deletion clr_loader/util/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ def find_libmono(*, assembly_dir: str = None, sgen: bool = True) -> Path:
)

else:
if assembly_dir == None:
if assembly_dir is None:
from ctypes.util import find_library

path = find_library(unix_name)
else:
libname = "lib" + unix_name + ".so"
Expand Down
7 changes: 4 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import sys
from pathlib import Path

project = "clr-loader"
copyright = "2022, Benedikt Reinartz"
author = "Benedikt Reinartz"

extensions = ["sphinx.ext.autodoc"]

# Add parent to path for autodoc
import sys, os

sys.path.append(os.path.abspath(".."))
sys.path.append(str(Path("..").absolute()))

# autodoc_typehints = "both"

Expand Down
1 change: 0 additions & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import shutil
import pytest
from subprocess import check_call
import os
import sys
from pathlib import Path

Expand Down

0 comments on commit 3e2dff0

Please sign in to comment.