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

Format the repository and enforce code style in CI #1280

Merged
merged 3 commits into from
Mar 5, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lints

on:
pull_request:
push:
paths-ignore:
- '**.rst'

jobs:
ruff:
runs-on: ubuntu-22.04

steps:
- name: Checkout pygit2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install ruff
run: pip install ruff

- name: Check code style with ruff
run: ruff format --diff
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

project = 'pygit2'
copyright = '2010-2024 The pygit2 contributors'
#author = ''
# author = ''

# The full version, including alpha/beta/rc tags
release = '1.14.1'
Expand Down
34 changes: 21 additions & 13 deletions pygit2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@


def init_repository(
path: typing.Union[str, bytes, PathLike, None],
bare: bool = False,
flags: enums.RepositoryInitFlag = enums.RepositoryInitFlag.MKPATH,
mode: typing.Union[int, enums.RepositoryInitMode] = enums.RepositoryInitMode.SHARED_UMASK,
workdir_path: typing.Optional[str] = None,
description: typing.Optional[str] = None,
template_path: typing.Optional[str] = None,
initial_head: typing.Optional[str] = None,
origin_url: typing.Optional[str] = None
path: typing.Union[str, bytes, PathLike, None],
bare: bool = False,
flags: enums.RepositoryInitFlag = enums.RepositoryInitFlag.MKPATH,
mode: typing.Union[
int, enums.RepositoryInitMode
] = enums.RepositoryInitMode.SHARED_UMASK,
workdir_path: typing.Optional[str] = None,
description: typing.Optional[str] = None,
template_path: typing.Optional[str] = None,
initial_head: typing.Optional[str] = None,
origin_url: typing.Optional[str] = None,
) -> Repository:
"""
Creates a new Git repository in the given *path*.
Expand Down Expand Up @@ -108,8 +110,7 @@ def init_repository(

# Options
options = ffi.new('git_repository_init_options *')
C.git_repository_init_options_init(options,
C.GIT_REPOSITORY_INIT_OPTIONS_VERSION)
C.git_repository_init_options_init(options, C.GIT_REPOSITORY_INIT_OPTIONS_VERSION)
options.flags = int(flags)
options.mode = mode

Expand Down Expand Up @@ -143,8 +144,15 @@ def init_repository(


def clone_repository(
url, path, bare=False, repository=None, remote=None,
checkout_branch=None, callbacks=None, depth=0):
url,
path,
bare=False,
repository=None,
remote=None,
checkout_branch=None,
callbacks=None,
depth=0,
):
"""
Clones a new Git repository from *url* in the given *path*.

Expand Down
2 changes: 1 addition & 1 deletion pygit2/_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ def get_libgit2_paths():
'libraries': ['git2'],
'include_dirs': [str(x) for x in include_dirs],
'library_dirs': [str(x) for x in library_dirs],
}
},
)
Loading