diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65f1b32a..69728af6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -20,7 +20,7 @@ repos: - id: sort-simple-yaml - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.3.5' + rev: 'v0.4.3' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/src/scmrepo/git/backend/dulwich/__init__.py b/src/scmrepo/git/backend/dulwich/__init__.py index 62109689..c03d6b60 100644 --- a/src/scmrepo/git/backend/dulwich/__init__.py +++ b/src/scmrepo/git/backend/dulwich/__init__.py @@ -264,7 +264,7 @@ def clone( cls._set_mirror(repo, progress=progress) else: cls._set_default_tracking_branch(repo) - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise CloneError(url, os.fsdecode(to_path)) from exc @staticmethod @@ -580,7 +580,7 @@ def iter_remote_refs(self, url: str, base: Optional[str] = None, **kwargs): try: _remote, location = get_remote_repo(self.repo, url) client, path = get_transport_and_path(location, **kwargs) - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise InvalidRemote(url) from exc try: @@ -617,7 +617,7 @@ def push_refspecs( # noqa: C901 try: _remote, location = get_remote_repo(self.repo, url) client, path = get_transport_and_path(location, **kwargs) - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise SCMError(f"'{url}' is not a valid Git remote or URL") from exc change_result = {} @@ -910,7 +910,7 @@ def validate_git_remote(self, url: str, **kwargs): try: _, location = get_remote_repo(self.repo, url) client, path = get_transport_and_path(location, **kwargs) - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise InvalidRemote(url) from exc if isinstance(client, LocalGitClient) and not os.path.exists( os.path.join("", path) @@ -989,5 +989,5 @@ def ls_remote(url: str) -> dict[str, str]: return {os.fsdecode(ref): sha.decode("ascii") for ref, sha in refs.items()} except HTTPUnauthorized as exc: raise AuthError(url) from exc - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise InvalidRemote(url) from exc diff --git a/src/scmrepo/git/lfs/storage.py b/src/scmrepo/git/lfs/storage.py index fa8cb862..677ffbb1 100644 --- a/src/scmrepo/git/lfs/storage.py +++ b/src/scmrepo/git/lfs/storage.py @@ -53,7 +53,7 @@ def open( raise try: self.fetch(fetch_url, [obj], batch_size=batch_size) - except BaseException as exc: # noqa: BLE001 + except BaseException as exc: raise FileNotFoundError( errno.ENOENT, os.strerror(errno.ENOENT), path ) from exc diff --git a/src/scmrepo/git/stash.py b/src/scmrepo/git/stash.py index d5878a58..f352ae2a 100644 --- a/src/scmrepo/git/stash.py +++ b/src/scmrepo/git/stash.py @@ -53,7 +53,7 @@ def pop(self, **kwargs): rev = self.scm.resolve_rev(ref) try: self.apply(rev, **kwargs) - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise SCMError("Could not apply stash commit") from exc self.drop() return rev