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
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

*
!docs
!gitopscli/
!tests/
!CONTRIBUTING.md
!mkdocs.yml
!Makefile
!mypy.ini
!uv.lock
!pyproject.toml
!README.md
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ testrepo/
.eggs/
site/
build/
.mypy_cache
.ruff_cache
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ repos:
language: system
pass_filenames: false
always_run: true
- id: mypy
name: make mypy
entry: make mypy
- id: typecheck
name: make typecheck
entry: make typecheck
language: system
pass_filenames: false
always_run: true
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ format-check:
lint:
uv run ruff check gitopscli tests

mypy:
uv run mypy --install-types --non-interactive .
typecheck:
uv run ty check


test:
Expand All @@ -24,7 +24,7 @@ coverage:
uv run coverage html
uv run coverage report

checks: format-check lint mypy test
checks: format-check lint typecheck test

image:
DOCKER_BUILDKIT=1 docker build --progress=plain -t gitopscli:latest .
Expand All @@ -35,4 +35,4 @@ docs:
update:
uv lock -U

.PHONY: init format format-check lint mypy test coverage checks image docs update
.PHONY: init format format-check lint typecheck test coverage checks image docs update
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ make init # install dependencies, setup dev gitopscli, install pre-commit hooks
make format # format code
make format-check # check formatting
make lint # run linter
make mypy # run type checks
make typecheck # run type checks
make test # run unit tests
make coverage # run unit tests and create coverage report
make checks # run all checks (format-check + lint + mypy + test)
make checks # run all checks (format-check + lint + typecheck + test)
make image # build docker image
make docs # serves web docs
make update # update package dependencies
Expand Down
2 changes: 1 addition & 1 deletion gitopscli/git_api/azure_devops_git_repo_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def add_pull_request_comment(self, pr_id: int, text: str, parent_id: int | None
except Exception as ex:
raise GitOpsException(f"Error connecting to '{self.__base_url}'") from ex

def delete_branch(self, _: str) -> None:
def delete_branch(self, branch: str) -> None: # noqa: ARG002
# branch deletion is set in merge completion_options
return

Expand Down
4 changes: 2 additions & 2 deletions gitopscli/git_api/bitbucket_git_repo_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def create_pull_request(
def merge_pull_request(
self,
pr_id: int,
_merge_method: Literal["squash", "rebase", "merge"] = "merge",
_merge_parameters: dict[str, Any] | None = None,
merge_method: Literal["squash", "rebase", "merge"] = "merge", # noqa: ARG002
merge_parameters: dict[str, Any] | None = None, # noqa: ARG002
) -> None:
pull_request = self.__bitbucket.get_pull_request(self.__organisation, self.__repository_name, pr_id)
self.__bitbucket.merge_pull_request(
Expand Down
3 changes: 2 additions & 1 deletion gitopscli/git_api/git_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import logging
from pathlib import Path
from types import TracebackType
from typing import Literal, Self
from typing import Literal

from git import GitCommandError, GitError, Repo
from typing_extensions import Self # noqa: UP035

from gitopscli.gitops_exception import GitOpsException
from gitopscli.io_api.tmp_dir import create_tmp_dir, delete_tmp_dir
Expand Down
2 changes: 1 addition & 1 deletion gitopscli/git_api/git_repo_api_logging_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def merge_pull_request(
self,
pr_id: int,
merge_method: Literal["squash", "rebase", "merge"] = "merge",
_merge_parameters: dict[str, Any] | None = None,
merge_parameters: dict[str, Any] | None = None, # noqa: ARG002
) -> None:
logging.info("Merging pull request %s", pr_id)
self.__api.merge_pull_request(pr_id, merge_method=merge_method)
Comment on lines +43 to 46
Expand Down
4 changes: 2 additions & 2 deletions gitopscli/git_api/github_git_repo_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def merge_pull_request(
self,
pr_id: int,
merge_method: Literal["squash", "rebase", "merge"] = "merge",
_merge_parameters: dict[str, Any] | None = None,
merge_parameters: dict[str, Any] | None = None, # noqa: ARG002
) -> None:
pull_request = self.__get_pull_request(pr_id)
pull_request.merge(merge_method=merge_method)
Expand All @@ -70,7 +70,7 @@ def add_pull_request_comment(
self,
pr_id: int,
text: str,
_parent_id: int | None = None,
parent_id: int | None = None, # noqa: ARG002
) -> None:
pull_request = self.__get_pull_request(pr_id)
pull_request.create_issue_comment(text)
Expand Down
2 changes: 1 addition & 1 deletion gitopscli/git_api/gitlab_git_repo_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def add_pull_request_comment(
self,
pr_id: int,
text: str,
_parent_id: int | None = None,
parent_id: int | None = None, # noqa: ARG002
) -> None:
merge_request = self.__project.mergerequests.get(pr_id)
merge_request.notes.create({"body": text})
Expand Down
3 changes: 2 additions & 1 deletion gitopscli/gitops_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections.abc import Callable
from dataclasses import dataclass
from string import Template
from typing import Any, ClassVar
from typing import Any, ClassVar, cast

from gitopscli.gitops_exception import GitOpsException

Expand Down Expand Up @@ -406,6 +406,7 @@ def __parse_v2(self) -> GitOpsConfig:
key = f"{file_key}.[{index}]"
if not isinstance(file_replacement, dict):
raise GitOpsException(f"Item '{key}' should be an object in GitOps config!")
file_replacement = cast("dict[str, Any]", file_replacement)
if "path" not in file_replacement:
raise GitOpsException(f"Key '{key}.path' not found in GitOps config!")
if "value" not in file_replacement:
Expand Down
26 changes: 0 additions & 26 deletions mypy.ini

This file was deleted.

19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"pygithub",
"python-gitlab>=2.6.0,<3",
"azure-devops>=7,<8",
"typing_extensions>=4",
]

[project.urls]
Expand All @@ -25,11 +26,9 @@ gitopscli = "gitopscli.__main__:main"
test = [
"ruff",
"pytest-cov",
"mypy==1.19.1",
"ty",
"typeguard>=2.13.3,<3",
"pre-commit",
"types-requests",
"types-Deprecated",
]
docs = [
"mkdocs",
Expand Down Expand Up @@ -87,3 +86,17 @@ ignore = [
"gitopscli/git_api/azure_devops_git_repo_api_adapter.py" = [
"TRY300", # https://docs.astral.sh/ruff/rules/try-consider-else/ (conflicts with RET505)
]

[tool.ty.environment]
python-version = "3.10"
python = ".venv/bin/python"

[tool.ty.src]
exclude = [
"build",
"tests",
]

[tool.ty.terminal]
output-format = "concise"
error-on-warning = true
Loading