diff --git a/docs/conf.py b/docs/conf.py
index ea8b1ed4..042dd588 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,7 +13,7 @@
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #
-sys.path.insert(0, os.path.abspath('..'))
+sys.path.insert(0, os.path.abspath('..'))  # noqa: PTH100
 
 
 # -- Project information -----------------------------------------------------
diff --git a/pygit2/__init__.py b/pygit2/__init__.py
index c431f7d4..fabb4e96 100644
--- a/pygit2/__init__.py
+++ b/pygit2/__init__.py
@@ -35,23 +35,23 @@
 
 # High level API
 from . import enums
-from ._build import __version__
-from .blame import Blame, BlameHunk
-from .blob import BlobIO
-from .callbacks import Payload, RemoteCallbacks, CheckoutCallbacks, StashApplyCallbacks
-from .callbacks import git_clone_options, git_fetch_options, get_credentials
-from .config import Config
-from .credentials import *
-from .errors import check_error, Passthrough
+from ._build import __version__  # noqa: F401
+from .blame import Blame, BlameHunk  # noqa: F401
+from .blob import BlobIO  # noqa: F401
+from .callbacks import Payload, RemoteCallbacks, CheckoutCallbacks, StashApplyCallbacks  # noqa: F401
+from .callbacks import git_clone_options, git_fetch_options, get_credentials  # noqa: F401
+from .config import Config  # noqa: F401
+from .credentials import *  # noqa: F403
+from .errors import check_error, Passthrough  # noqa: F401
 from .ffi import ffi, C
-from .filter import Filter
-from .index import Index, IndexEntry
-from .legacyenums import *
-from .packbuilder import PackBuilder
-from .remotes import Remote
+from .filter import Filter  # noqa: F401
+from .index import Index, IndexEntry  # noqa: F401
+from .legacyenums import *  # noqa: F403
+from .packbuilder import PackBuilder  # noqa: F401
+from .remotes import Remote  # noqa: F401
 from .repository import Repository
 from .settings import Settings
-from .submodules import Submodule
+from .submodules import Submodule  # noqa: F401
 from .utils import to_bytes, to_str
 
 
@@ -59,14 +59,15 @@
 features = enums.Feature(C.git_libgit2_features())
 
 # libgit version tuple
-LIBGIT2_VER = (LIBGIT2_VER_MAJOR, LIBGIT2_VER_MINOR, LIBGIT2_VER_REVISION)
+LIBGIT2_VER = (LIBGIT2_VER_MAJOR, LIBGIT2_VER_MINOR, LIBGIT2_VER_REVISION)  # noqa: F405
 
 # Let _pygit2 cache references to Python enum types.
 # This is separate from PyInit__pygit2() to avoid a circular import.
 _cache_enums()
 
 
-def init_repository(
+
+def init_repository(  # noqa: PLR0913
     path: typing.Union[str, bytes, os.PathLike, None],
     bare: bool = False,
     flags: enums.RepositoryInitFlag = enums.RepositoryInitFlag.MKPATH,
@@ -144,7 +145,7 @@ def init_repository(
     return Repository(to_str(path))
 
 
-def clone_repository(
+def clone_repository(  # noqa: PLR0913
     url,
     path,
     bare=False,
@@ -221,6 +222,6 @@ def clone_repository(
     return Repository._from_c(crepo[0], owned=True)
 
 
-tree_entry_key = functools.cmp_to_key(tree_entry_cmp)
+tree_entry_key = functools.cmp_to_key(tree_entry_cmp)  # noqa: F405
 
 settings = Settings()
diff --git a/pygit2/_build.py b/pygit2/_build.py
index 30e0d13f..78a8aad4 100644
--- a/pygit2/_build.py
+++ b/pygit2/_build.py
@@ -48,7 +48,7 @@ def _get_libgit2_path():
 
     # Default
     if os.name == 'nt':
-        return Path(r'%s\libgit2' % os.getenv('ProgramFiles'))
+        return Path(r'%s\libgit2' % os.getenv('ProgramFiles'))  # noqa: SIM112
     return Path('/usr/local')
 
 
diff --git a/pygit2/_pygit2.pyi b/pygit2/_pygit2.pyi
index 4895bade..8cd54d85 100644
--- a/pygit2/_pygit2.pyi
+++ b/pygit2/_pygit2.pyi
@@ -1,4 +1,4 @@
-from typing import Iterator, Literal, Optional, overload
+from typing import Iterator, Literal, Optional, overload  # noqa: I001
 from io import IOBase
 from . import Index
 from .enums import (
@@ -42,7 +42,7 @@ class Object:
     oid: Oid
     raw_name: bytes | None
     short_id: str
-    type: 'Literal[GIT_OBJ_COMMIT] | Literal[GIT_OBJ_TREE] | Literal[GIT_OBJ_TAG] | Literal[GIT_OBJ_BLOB]'
+    type: 'Literal[GIT_OBJ_COMMIT] | Literal[GIT_OBJ_TREE] | Literal[GIT_OBJ_TAG] | Literal[GIT_OBJ_BLOB]'  # noqa: E501
     type_str: "Literal['commit'] | Literal['tree'] | Literal['tag'] | Literal['blob']"
     @overload
     def peel(self, target_type: 'Literal[GIT_OBJ_COMMIT]') -> 'Commit': ...
diff --git a/pygit2/_run.py b/pygit2/_run.py
index 815910ec..c9b22a47 100644
--- a/pygit2/_run.py
+++ b/pygit2/_run.py
@@ -28,7 +28,7 @@
 """
 
 # Import from the Standard Library
-import codecs
+import codecs  # noqa: I001
 from pathlib import Path
 import sys
 
@@ -85,7 +85,7 @@
 ]
 h_source = []
 for h_file in h_files:
-    h_file = dir_path / 'decl' / h_file
+    h_file = dir_path / 'decl' / h_file  # noqa: PLW2901
     with codecs.open(h_file, 'r', 'utf-8') as f:
         h_source.append(f.read())
 
diff --git a/pygit2/blame.py b/pygit2/blame.py
index a1b8e42e..62b4b808 100644
--- a/pygit2/blame.py
+++ b/pygit2/blame.py
@@ -24,7 +24,7 @@
 # Boston, MA 02110-1301, USA.
 
 # Import from pygit2
-from .ffi import ffi, C
+from .ffi import ffi, C  # noqa: I001
 from .utils import GenericIterator
 from ._pygit2 import Signature, Oid
 
diff --git a/pygit2/blob.py b/pygit2/blob.py
index d9f4de89..e6a782bf 100644
--- a/pygit2/blob.py
+++ b/pygit2/blob.py
@@ -1,4 +1,4 @@
-import io
+import io  # noqa: I001
 import threading
 import time
 from contextlib import AbstractContextManager
diff --git a/pygit2/branches.py b/pygit2/branches.py
index c6323a1f..47b49bcf 100644
--- a/pygit2/branches.py
+++ b/pygit2/branches.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from __future__ import annotations
+from __future__ import annotations  # noqa: I001
 from typing import TYPE_CHECKING
 
 from .enums import BranchType, ReferenceType
diff --git a/pygit2/callbacks.py b/pygit2/callbacks.py
index 57e3d773..1bfb2eec 100644
--- a/pygit2/callbacks.py
+++ b/pygit2/callbacks.py
@@ -63,7 +63,7 @@
 """
 
 # Standard Library
-from contextlib import contextmanager
+from contextlib import contextmanager  # noqa: I001
 from functools import wraps
 from typing import Optional, Union
 
@@ -133,9 +133,9 @@ def sideband_progress(self, string: str) -> None:
 
     def credentials(
         self,
-        url: str,
-        username_from_url: Union[str, None],
-        allowed_types: CredentialType,
+        url: str,  # noqa: ARG002
+        username_from_url: Union[str, None],  # noqa: ARG002
+        allowed_types: CredentialType,  # noqa: ARG002
     ):
         """
         Credentials callback.  If the remote server requires authentication,
@@ -159,7 +159,7 @@ def credentials(
         """
         raise Passthrough
 
-    def certificate_check(self, certificate: None, valid: bool, host: str) -> bool:
+    def certificate_check(self, certificate: None, valid: bool, host: str) -> bool:  # noqa: ARG002
         """
         Certificate callback. Override with your own function to determine
         whether to accept the server's certificate.
@@ -493,7 +493,7 @@ def _certificate_check_cb(cert_i, valid, host, data):
         if not val:
             return C.GIT_ECERTIFICATE
     except Passthrough:
-        if is_ssh:
+        if is_ssh:  # noqa: SIM114
             return 0
         elif valid:
             return 0
@@ -667,7 +667,7 @@ def get_credentials(fn, url, username, allowed):
 
 
 @libgit2_callback
-def _checkout_notify_cb(
+def _checkout_notify_cb(  # noqa: PLR0913
     why, path_cstr, baseline, target, workdir, data: CheckoutCallbacks
 ):
     pypath = maybe_string(path_cstr)
@@ -675,7 +675,7 @@ def _checkout_notify_cb(
     pytarget = DiffFile.from_c(ptr_to_bytes(target))
     pyworkdir = DiffFile.from_c(ptr_to_bytes(workdir))
 
-    try:
+    try:  # noqa: SIM105
         data.checkout_notify(why, pypath, pybaseline, pytarget, pyworkdir)
     except Passthrough:
         # Unlike most other operations with optional callbacks, checkout
@@ -701,7 +701,7 @@ def _git_checkout_options(
     paths=None,
     c_checkout_options_ptr=None,
 ):
-    if callbacks is None:
+    if callbacks is None:  # noqa: SIM108
         payload = CheckoutCallbacks()
     else:
         payload = callbacks
@@ -768,7 +768,7 @@ def git_checkout_options(callbacks=None, strategy=None, directory=None, paths=No
 
 @libgit2_callback
 def _stash_apply_progress_cb(progress: StashApplyProgress, data: StashApplyCallbacks):
-    try:
+    try:  # noqa: SIM105
         data.stash_apply_progress(progress)
     except Passthrough:
         # Unlike most other operations with optional callbacks, stash apply
diff --git a/pygit2/config.py b/pygit2/config.py
index 3b739840..53e4fc6e 100644
--- a/pygit2/config.py
+++ b/pygit2/config.py
@@ -29,7 +29,7 @@
     from cached_property import cached_property
 
 # Import from pygit2
-from .errors import check_error
+from .errors import check_error  # noqa: I001
 from .ffi import ffi, C
 from .utils import to_bytes
 
@@ -93,7 +93,7 @@ def from_c(cls, repo, ptr):
         return config
 
     def __del__(self):
-        try:
+        try:  # noqa: SIM105
             C.git_config_free(self._config)
         except AttributeError:
             pass
diff --git a/pygit2/credentials.py b/pygit2/credentials.py
index 9a09db76..f08b001d 100644
--- a/pygit2/credentials.py
+++ b/pygit2/credentials.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from __future__ import annotations
+from __future__ import annotations  # noqa: I001
 
 from typing import TYPE_CHECKING
 
diff --git a/pygit2/enums.py b/pygit2/enums.py
index fe642168..15255e52 100644
--- a/pygit2/enums.py
+++ b/pygit2/enums.py
@@ -77,7 +77,7 @@ class BlameFlag(IntFlag):
     'Not yet implemented and reserved for future use (as of libgit2 1.9.0).'
 
     FIRST_PARENT = _pygit2.GIT_BLAME_FIRST_PARENT
-    'Restrict the search of commits to those reachable following only the first parents.'
+    'Restrict the search of commits to those reachable following only the first parents.'  # noqa: E501
 
     USE_MAILMAP = _pygit2.GIT_BLAME_USE_MAILMAP
     """
@@ -95,7 +95,7 @@ class BlobFilter(IntFlag):
     'Do not apply filters to binary files.'
 
     NO_SYSTEM_ATTRIBUTES = _pygit2.GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES
-    'Filters will not load configuration from the system-wide `gitattributes` in `/etc` (or system equivalent).'
+    'Filters will not load configuration from the system-wide `gitattributes` in `/etc` (or system equivalent).'  # noqa: E501
 
     ATTRIBUTES_FROM_HEAD = _pygit2.GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD
     'Load filters from a `.gitattributes` file in the HEAD commit.'
@@ -246,7 +246,7 @@ class ConfigLevel(IntEnum):
     'XDG compatible configuration file; typically ~/.config/git/config'
 
     GLOBAL = _pygit2.GIT_CONFIG_LEVEL_GLOBAL
-    'User-specific configuration file (also called Global configuration file); typically ~/.gitconfig'
+    'User-specific configuration file (also called Global configuration file); typically ~/.gitconfig'  # noqa: E501
 
     LOCAL = _pygit2.GIT_CONFIG_LEVEL_LOCAL
     'Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos'
@@ -642,7 +642,7 @@ class DiffStatsFormat(IntFlag):
     'Number statistics, equivalent of `--numstat`'
 
     INCLUDE_SUMMARY = _pygit2.GIT_DIFF_STATS_INCLUDE_SUMMARY
-    'Extended header information such as creations, renames and mode changes, equivalent of `--summary`'
+    'Extended header information such as creations, renames and mode changes, equivalent of `--summary`'  # noqa: E501
 
 
 class Feature(IntFlag):
@@ -726,7 +726,7 @@ class FilterFlag(IntFlag):
     'Load attributes from `.gitattributes` in the root of HEAD'
 
     ATTRIBUTES_FROM_COMMIT = _pygit2.GIT_FILTER_ATTRIBUTES_FROM_COMMIT
-    'Load attributes from `.gitattributes` in a given commit. This can only be specified in a `git_filter_options`.'
+    'Load attributes from `.gitattributes` in a given commit. This can only be specified in a `git_filter_options`.'  # noqa: E501
 
 
 class FilterMode(IntEnum):
@@ -947,7 +947,7 @@ class ObjectType(IntEnum):
 class Option(IntEnum):
     """Global libgit2 library options"""
 
-    # Commented out values --> exists in libgit2 but not supported in pygit2's options.c yet
+    # Commented out values --> exists in libgit2 but not supported in pygit2's options.c yet  # noqa: E501
     GET_MWINDOW_SIZE = _pygit2.GIT_OPT_GET_MWINDOW_SIZE
     SET_MWINDOW_SIZE = _pygit2.GIT_OPT_SET_MWINDOW_SIZE
     GET_MWINDOW_MAPPED_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_MAPPED_LIMIT
@@ -1293,7 +1293,7 @@ class SubmoduleStatus(IntFlag):
     'submodule workdir index is dirty (flag available if ignore is NONE or UNTRACKED)'
 
     WD_WD_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED
-    'submodule workdir has modified files (flag available if ignore is NONE or UNTRACKED)'
+    'submodule workdir has modified files (flag available if ignore is NONE or UNTRACKED)'  # noqa: E501
 
     WD_UNTRACKED = _pygit2.GIT_SUBMODULE_STATUS_WD_UNTRACKED
     'submodule workdir contains untracked files (flag available if ignore is NONE)'
diff --git a/pygit2/errors.py b/pygit2/errors.py
index 3ecef9df..fb28a30b 100644
--- a/pygit2/errors.py
+++ b/pygit2/errors.py
@@ -24,11 +24,11 @@
 # Boston, MA 02110-1301, USA.
 
 # Import from pygit2
-from .ffi import ffi, C
+from .ffi import ffi, C  # noqa: I001
 from ._pygit2 import GitError
 
 
-value_errors = set([C.GIT_EEXISTS, C.GIT_EINVALIDSPEC, C.GIT_EAMBIGUOUS])
+value_errors = set([C.GIT_EEXISTS, C.GIT_EINVALIDSPEC, C.GIT_EAMBIGUOUS])  # noqa: C405
 
 
 def check_error(err, io=False):
@@ -36,7 +36,7 @@ def check_error(err, io=False):
         return
 
     # These are special error codes, they should never reach here
-    test = err != C.GIT_EUSER and err != C.GIT_PASSTHROUGH
+    test = err != C.GIT_EUSER and err != C.GIT_PASSTHROUGH  # noqa: PLR1714
     assert test, f'Unexpected error code {err}'
 
     # Error message
diff --git a/pygit2/ffi.py b/pygit2/ffi.py
index 04ffefa0..51703469 100644
--- a/pygit2/ffi.py
+++ b/pygit2/ffi.py
@@ -24,4 +24,5 @@
 # Boston, MA 02110-1301, USA.
 
 # Import from pygit2
-from ._libgit2 import ffi, lib as C  # noqa: F401
+
+from ._libgit2 import ffi, lib as C  # noqa: I001, F401
diff --git a/pygit2/filter.py b/pygit2/filter.py
index 00c65184..363050b1 100644
--- a/pygit2/filter.py
+++ b/pygit2/filter.py
@@ -76,7 +76,7 @@ def check(self, src: FilterSource, attr_values: List[Optional[str]]):
         """
 
     def write(
-        self, data: bytes, src: FilterSource, write_next: Callable[[bytes], None]
+        self, data: bytes, src: FilterSource, write_next: Callable[[bytes], None]  # noqa: ARG002
     ):
         """
         Write input `data` to this filter.
diff --git a/pygit2/index.py b/pygit2/index.py
index c073fa6d..ecee5769 100644
--- a/pygit2/index.py
+++ b/pygit2/index.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import warnings
+import warnings  # noqa: I001
 import weakref
 
 # Import from pygit2
@@ -367,7 +367,7 @@ def oid(self):
     @property
     def hex(self):
         """The id of the referenced object as a hex string"""
-        warnings.warn('Use str(entry.id)', DeprecationWarning)
+        warnings.warn('Use str(entry.id)', DeprecationWarning)  # noqa: B028
         return str(self.id)
 
     def __str__(self):
@@ -375,7 +375,7 @@ def __str__(self):
 
     def __repr__(self):
         t = type(self)
-        return f'<{t.__module__}.{t.__qualname__} path={self.path} id={self.id} mode={self.mode}>'
+        return f'<{t.__module__}.{t.__qualname__} path={self.path} id={self.id} mode={self.mode}>'  # noqa: E501
 
     def __eq__(self, other):
         if self is other:
diff --git a/pygit2/packbuilder.py b/pygit2/packbuilder.py
index b9844d52..b386a8c4 100644
--- a/pygit2/packbuilder.py
+++ b/pygit2/packbuilder.py
@@ -25,7 +25,7 @@
 
 
 # Import from pygit2
-from .errors import check_error
+from .errors import check_error  # noqa: I001
 from .ffi import ffi, C
 from .utils import to_bytes
 
diff --git a/pygit2/references.py b/pygit2/references.py
index ca1d23dc..6b3ec6e6 100644
--- a/pygit2/references.py
+++ b/pygit2/references.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from __future__ import annotations
+from __future__ import annotations  # noqa: I001
 from typing import TYPE_CHECKING
 
 from .enums import ReferenceFilter
@@ -74,7 +74,7 @@ def iterator(self, references_return_type: ReferenceFilter = ReferenceFilter.ALL
         TODO: Add support for filtering by reference types notes and remotes.
         """
 
-        # Enforce ReferenceFilter type - raises ValueError if we're given an invalid value
+        # Enforce ReferenceFilter type - raises ValueError if we're given an invalid value  # noqa: E501
         references_return_type = ReferenceFilter(references_return_type)
 
         iter = self._repository.references_iterator_init()
diff --git a/pygit2/refspec.py b/pygit2/refspec.py
index 447cf7dc..0d62f404 100644
--- a/pygit2/refspec.py
+++ b/pygit2/refspec.py
@@ -24,7 +24,7 @@
 # Boston, MA 02110-1301, USA.
 
 # Import from pygit2
-from .errors import check_error
+from .errors import check_error  # noqa: I001
 from .ffi import ffi, C
 from .utils import to_bytes
 
diff --git a/pygit2/remotes.py b/pygit2/remotes.py
index 2322e7f7..247881ea 100644
--- a/pygit2/remotes.py
+++ b/pygit2/remotes.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from __future__ import annotations
+from __future__ import annotations  # noqa: I001
 from typing import TYPE_CHECKING
 
 # Import from pygit2
@@ -116,7 +116,7 @@ def connect(self, callbacks=None, direction=C.GIT_DIRECTION_FETCH, proxy=None):
             )
             payload.check_error(err)
 
-    def fetch(
+    def fetch(  # noqa: PLR0913
         self,
         refspecs=None,
         message=None,
@@ -185,7 +185,7 @@ def ls_remotes(self, callbacks=None, proxy=None):
         for i in range(int(refs_len[0])):
             ref = refs[0][i]
             local = bool(ref.local)
-            if local:
+            if local:  # noqa: SIM108
                 loid = Oid(raw=bytes(ffi.buffer(ref.loid.id)[:]))
             else:
                 loid = None
@@ -403,7 +403,7 @@ def delete(self, name):
         """Remove a remote from the configuration
 
         All remote-tracking branches and configuration settings for the remote will be removed.
-        """
+        """  # noqa: E501
         err = C.git_remote_delete(self._repo._repo, to_bytes(name))
         check_error(err)
 
diff --git a/pygit2/repository.py b/pygit2/repository.py
index 9a6594d0..cd2a4b24 100644
--- a/pygit2/repository.py
+++ b/pygit2/repository.py
@@ -22,7 +22,7 @@
 # along with this program; see the file COPYING.  If not, write to
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
-import warnings
+import warnings  # noqa: I001
 from io import BytesIO
 from os import PathLike
 from string import hexdigits
@@ -113,7 +113,7 @@ def pack(self, path=None, pack_delegate=None, n_threads=None):
 
         n_threads
             The number of threads the `PackBuilder` will spawn. If set to 0, libgit2 will autodetect the number of CPUs.
-        """
+        """  # noqa: E501
 
         def pack_all_objects(pack_builder):
             for obj in self.odb:
@@ -166,7 +166,7 @@ def hashfile(
         """
         c_path = to_bytes(path)
 
-        if as_path is None:
+        if as_path is None:  # noqa: SIM108
             c_as_path = ffi.NULL
         else:
             c_as_path = to_bytes(as_path)
@@ -270,11 +270,11 @@ def create_reference(self, name, target, force=False, message=None):
 
     def listall_references(self) -> typing.List[str]:
         """Return a list with all the references in the repository."""
-        return list(x.name for x in self.references.iterator())
+        return list(x.name for x in self.references.iterator())  # noqa: C400
 
     def listall_reference_objects(self) -> typing.List[Reference]:
         """Return a list with all the reference objects in the repository."""
-        return list(x for x in self.references.iterator())
+        return list(x for x in self.references.iterator())  # noqa: C400
 
     def resolve_refish(self, refish):
         """Convert a reference-like short name "ref-ish" to a valid
@@ -434,7 +434,7 @@ def __whatever_to_tree_or_blob(self, obj):
             return None
 
         # If it's a string, then it has to be valid revspec
-        if isinstance(obj, str) or isinstance(obj, bytes):
+        if isinstance(obj, str) or isinstance(obj, bytes):  # noqa: SIM101
             obj = self.revparse_single(obj)
         elif isinstance(obj, Oid):
             obj = self[obj]
@@ -448,11 +448,11 @@ def __whatever_to_tree_or_blob(self, obj):
             try:
                 obj = obj.peel(Tree)
             except Exception:
-                raise TypeError(f'unexpected "{type(obj)}"')
+                raise TypeError(f'unexpected "{type(obj)}"')  # noqa: B904
 
         return obj
 
-    def diff(
+    def diff(  # noqa: PLR0913
         self,
         a=None,
         b=None,
@@ -526,7 +526,7 @@ def diff(
 
         # Case 1: Diff tree to tree
         if isinstance(a, Tree) and isinstance(b, Tree):
-            return a.diff_to_tree(b, **dict(zip(opt_keys, opt_values)))
+            return a.diff_to_tree(b, **dict(zip(opt_keys, opt_values)))  # noqa: B905
 
         # Case 2: Index to workdir
         elif a is None and b is None:
@@ -568,7 +568,7 @@ def state_cleanup(self):
     #
     # blame
     #
-    def blame(
+    def blame(  # noqa: PLR0913
         self,
         path,
         flags: BlameFlag = BlameFlag.NORMAL,
@@ -744,7 +744,7 @@ def merge_commits(
 
         Both "ours" and "theirs" can be any object which peels to a commit or
         the id (string or Oid) of an object which peels to a commit.
-        """
+        """  # noqa: E501
         ours_ptr = ffi.new('git_commit **')
         theirs_ptr = ffi.new('git_commit **')
         cindex = ffi.new('git_index **')
@@ -767,7 +767,7 @@ def merge_commits(
 
         return Index.from_c(self, cindex)
 
-    def merge_trees(
+    def merge_trees(  # noqa: PLR0913
         self,
         ancestor: typing.Union[str, Oid, Tree],
         ours: typing.Union[str, Oid, Tree],
@@ -801,7 +801,7 @@ def merge_trees(
 
         file_flags
             A combination of enums.MergeFileFlag constants.
-        """
+        """  # noqa: E501
         ancestor_ptr = ffi.new('git_tree **')
         ours_ptr = ffi.new('git_tree **')
         theirs_ptr = ffi.new('git_tree **')
@@ -865,7 +865,7 @@ def merge(
 
         file_flags
             A combination of enums.MergeFileFlag constants.
-        """
+        """  # noqa: E501
 
         if isinstance(source, Reference):
             # Annotated commit from ref
@@ -878,7 +878,7 @@ def merge(
             # Annotated commit from commit id
             if isinstance(source, str):
                 # For backwards compatibility, parse a string as a partial commit hash
-                warnings.warn(
+                warnings.warn(  # noqa: B028
                     'Passing str to Repository.merge is deprecated. '
                     'Pass Commit, Oid, or a Reference (such as a Branch) instead.',
                     DeprecationWarning,
@@ -956,7 +956,7 @@ def remove_message(self):
     #
     # Describe
     #
-    def describe(
+    def describe(  # noqa: PLR0912, PLR0913
         self,
         committish=None,
         max_candidates_tags=None,
@@ -1084,7 +1084,7 @@ def describe(
     #
     # Stash
     #
-    def stash(
+    def stash(  # noqa: PLR0913
         self,
         stasher: Signature,
         message: typing.Optional[str] = None,
@@ -1393,7 +1393,7 @@ def get_attr(
         elif attr_kind == C.GIT_ATTR_VALUE_STRING:
             return ffi.string(cvalue[0]).decode('utf-8')
 
-        assert False, 'the attribute value from libgit2 is invalid'
+        assert False, 'the attribute value from libgit2 is invalid'  # noqa: B011
 
     #
     # Identity for reference operations
@@ -1471,7 +1471,7 @@ def revert_commit(self, revert_commit, our_commit, mainline=0):
     #
     # Amend commit
     #
-    def amend_commit(
+    def amend_commit(  # noqa: PLR0912, PLR0913
         self,
         commit,
         refname,
diff --git a/pygit2/submodules.py b/pygit2/submodules.py
index d8506d20..70aeae94 100644
--- a/pygit2/submodules.py
+++ b/pygit2/submodules.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from __future__ import annotations
+from __future__ import annotations  # noqa: I001
 from typing import TYPE_CHECKING, Iterable, Iterator, Optional, Union
 
 from ._pygit2 import Oid
@@ -227,7 +227,7 @@ def add(
         depth
             Number of commits to fetch.
             The default is 0 (full commit history).
-        """
+        """  # noqa: E501
         csub = ffi.new('git_submodule **')
         curl = ffi.new('char[]', to_bytes(url))
         cpath = ffi.new('char[]', to_bytes(path))
@@ -338,7 +338,7 @@ def status(
 
         ignore
             A SubmoduleIgnore value indicating how deeply to examine the working directory.
-        """
+        """  # noqa: E501
         cstatus = ffi.new('unsigned int *')
         err = C.git_submodule_status(
             cstatus, self._repository._repo, to_bytes(name), ignore
diff --git a/pygit2/utils.py b/pygit2/utils.py
index 1139b23c..4074a96b 100644
--- a/pygit2/utils.py
+++ b/pygit2/utils.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import contextlib
+import contextlib  # noqa: I001
 import os
 
 # Import from pygit2
diff --git a/pyproject.toml b/pyproject.toml
index 4971280d..60df608f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -25,15 +25,41 @@ environment = {LIBGIT2_VERSION="1.9.0", LIBSSH2_VERSION="1.11.1", OPENSSL_VERSIO
 repair-wheel-command = "DYLD_LIBRARY_PATH=/Users/runner/work/pygit2/pygit2/ci/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
 
 [tool.ruff]
+target-version = "py310" # oldest supported Python version
 extend-exclude = [ ".cache", ".coverage", "build", "site-packages", "venv*"]
-target-version = "py310"  # oldest supported Python version
+
+[tool.ruff.lint]
+select = [
+    "E",
+    "W",
+    "F",
+    "I",
+    "B",
+    "C4",
+    "ARG",
+    "SIM",
+    "PTH",
+    "PL",
+    "TID",
+]
+ignore = [] # To be added
 
 [tool.ruff.format]
 quote-style = "single"
 
+[tool.pyright]
+typeCheckingMode = "strict"
+pythonVersion = "3.10"
+reportPrivateUsage = "none"
+reportAttributeAccessIssue = "none"
+reportUnknownMemberType = "none"
+reportUnusedFunction = "none"
+reportUnnecessaryIsInstance = "none"
+
 [tool.codespell]
 # Ref: https://github.com/codespell-project/codespell#using-a-config-file
 skip = '.git*'
 check-hidden = true
 # ignore-regex = ''
 ignore-words-list = 'devault,claus'
+
diff --git a/setup.py b/setup.py
index 88d1536d..e72b85a0 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@
 # Boston, MA 02110-1301, USA.
 
 # Import setuptools before distutils to avoid user warning
-from setuptools import setup, Extension
+from setuptools import setup, Extension  # noqa: I001
 
 from distutils.command.build import build
 from distutils.command.sdist import sdist
diff --git a/test/__init__.py b/test/__init__.py
index 7fb15c4f..31e34752 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -29,6 +29,6 @@
 import os
 import sys
 
-cwd = os.getcwd()
+cwd = os.getcwd()  # noqa: PTH109
 sys.path.remove(cwd)
 sys.path.append(cwd)
diff --git a/test/conftest.py b/test/conftest.py
index 1c6d7b8f..0d826f9f 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -1,4 +1,4 @@
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import platform
 
 import pytest
diff --git a/test/test_apply_diff.py b/test/test_apply_diff.py
index 87e766dd..64c3ff9f 100644
--- a/test/test_apply_diff.py
+++ b/test/test_apply_diff.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pygit2
+import pygit2  # noqa: I001
 from pygit2.enums import ApplyLocation, CheckoutStrategy, FileStatus
 import pytest
 
@@ -151,7 +151,7 @@ def test_diff_applies_to_both(testrepo, old_content, patch_diff):
     assert not testrepo.applies(patch_diff, ApplyLocation.INDEX)
 
 
-def test_applies_error(testrepo, old_content, patch_diff, foreign_patch_diff):
+def test_applies_error(testrepo, old_content, patch_diff, foreign_patch_diff):  # noqa: ARG001
     # Try to apply a "foreign" patch that affects files that aren't in the repo;
     # ensure we get OSError about the missing file (due to raise_error)
     with pytest.raises(OSError):
@@ -160,6 +160,6 @@ def test_applies_error(testrepo, old_content, patch_diff, foreign_patch_diff):
     # Apply a valid patch
     testrepo.apply(patch_diff, ApplyLocation.BOTH)
 
-    # Ensure it can't be applied again and we get an exception about it (due to raise_error)
+    # Ensure it can't be applied again and we get an exception about it (due to raise_error)  # noqa: E501
     with pytest.raises(pygit2.GitError):
         testrepo.applies(patch_diff, ApplyLocation.BOTH, raise_error=True)
diff --git a/test/test_archive.py b/test/test_archive.py
index 7e2454f1..67a6609c 100644
--- a/test/test_archive.py
+++ b/test/test_archive.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import tarfile
 
 from pygit2 import Index, Oid, Tree, Object
@@ -34,7 +34,7 @@
 
 
 def check_writing(repo, treeish, timestamp=None):
-    archive = tarfile.open('foo.tar', mode='w')
+    archive = tarfile.open('foo.tar', mode='w')  # noqa: SIM115
     repo.write_archive(treeish, archive)
 
     index = Index()
diff --git a/test/test_attributes.py b/test/test_attributes.py
index 00ac91ad..d1181bbd 100644
--- a/test/test_attributes.py
+++ b/test/test_attributes.py
@@ -38,7 +38,7 @@ def test_no_attr(testrepo):
     assert testrepo.get_attr('file.py', 'foo') is None
     assert testrepo.get_attr('file.py', 'text')
     assert not testrepo.get_attr('file.jpg', 'text')
-    assert 'lf' == testrepo.get_attr('file.sh', 'eol')
+    assert 'lf' == testrepo.get_attr('file.sh', 'eol')  # noqa: SIM300
 
 
 def test_no_attr_aspath(testrepo):
diff --git a/test/test_blame.py b/test/test_blame.py
index 251f7e6d..28f2a583 100644
--- a/test/test_blame.py
+++ b/test/test_blame.py
@@ -25,7 +25,7 @@
 
 """Tests for Blame objects."""
 
-import pytest
+import pytest  # noqa: I001
 
 from pygit2 import Signature, Oid
 from pygit2.enums import BlameFlag
@@ -64,7 +64,7 @@
 def test_blame_index(testrepo):
     blame = testrepo.blame(PATH)
 
-    assert len(blame) == 3
+    assert len(blame) == 3  # noqa: PLR2004
 
     for i, hunk in enumerate(blame):
         assert hunk.lines_in_hunk == 1
@@ -81,7 +81,7 @@ def test_blame_index(testrepo):
 def test_blame_flags(blameflagsrepo):
     blame = blameflagsrepo.blame(PATH, flags=BlameFlag.IGNORE_WHITESPACE)
 
-    assert len(blame) == 3
+    assert len(blame) == 3  # noqa: PLR2004
 
     for i, hunk in enumerate(blame):
         assert hunk.lines_in_hunk == 1
@@ -109,7 +109,7 @@ def test():
 def test_blame_for_line(testrepo):
     blame = testrepo.blame(PATH)
 
-    for i, line in zip(range(0, 2), range(1, 3)):
+    for i, line in zip(range(0, 2), range(1, 3)):  # noqa: B905
         hunk = blame.for_line(line)
 
         assert hunk.lines_in_hunk == 1
diff --git a/test/test_blob.py b/test/test_blob.py
index c9025f49..f236dec0 100644
--- a/test/test_blob.py
+++ b/test/test_blob.py
@@ -25,7 +25,7 @@
 
 """Tests for Blob objects."""
 
-import io
+import io  # noqa: I001
 from pathlib import Path
 from threading import Event
 from queue import Queue
@@ -86,10 +86,10 @@ def test_read_blob(testrepo):
     assert blob.id == BLOB_SHA
     assert isinstance(blob, pygit2.Blob)
     assert not blob.is_binary
-    assert ObjectType.BLOB == blob.type
-    assert BLOB_CONTENT == blob.data
+    assert ObjectType.BLOB == blob.type  # noqa: SIM300
+    assert BLOB_CONTENT == blob.data  # noqa: SIM300
     assert len(BLOB_CONTENT) == blob.size
-    assert BLOB_CONTENT == blob.read_raw()
+    assert BLOB_CONTENT == blob.read_raw()  # noqa: SIM300
 
 
 def test_create_blob(testrepo):
@@ -97,17 +97,17 @@ def test_create_blob(testrepo):
     blob = testrepo[blob_oid]
 
     assert isinstance(blob, pygit2.Blob)
-    assert ObjectType.BLOB == blob.type
+    assert ObjectType.BLOB == blob.type  # noqa: SIM300
 
     assert blob_oid == blob.id
     assert utils.gen_blob_sha1(BLOB_NEW_CONTENT) == blob_oid
 
-    assert BLOB_NEW_CONTENT == blob.data
+    assert BLOB_NEW_CONTENT == blob.data  # noqa: SIM300
     assert len(BLOB_NEW_CONTENT) == blob.size
-    assert BLOB_NEW_CONTENT == blob.read_raw()
+    assert BLOB_NEW_CONTENT == blob.read_raw()  # noqa: SIM300
     blob_buffer = memoryview(blob)
     assert len(BLOB_NEW_CONTENT) == len(blob_buffer)
-    assert BLOB_NEW_CONTENT == blob_buffer
+    assert BLOB_NEW_CONTENT == blob_buffer  # noqa: SIM300
 
     def set_content():
         blob_buffer[:2] = b'hi'
@@ -121,14 +121,14 @@ def test_create_blob_fromworkdir(testrepo):
     blob = testrepo[blob_oid]
 
     assert isinstance(blob, pygit2.Blob)
-    assert ObjectType.BLOB == blob.type
+    assert ObjectType.BLOB == blob.type  # noqa: SIM300
 
     assert blob_oid == blob.id
     assert utils.gen_blob_sha1(BLOB_FILE_CONTENT) == blob_oid
 
-    assert BLOB_FILE_CONTENT == blob.data
+    assert BLOB_FILE_CONTENT == blob.data  # noqa: SIM300
     assert len(BLOB_FILE_CONTENT) == blob.size
-    assert BLOB_FILE_CONTENT == blob.read_raw()
+    assert BLOB_FILE_CONTENT == blob.read_raw()  # noqa: SIM300
 
 
 def test_create_blob_fromworkdir_aspath(testrepo):
@@ -148,7 +148,7 @@ def test_create_blob_fromdisk(testrepo):
     blob = testrepo[blob_oid]
 
     assert isinstance(blob, pygit2.Blob)
-    assert ObjectType.BLOB == blob.type
+    assert ObjectType.BLOB == blob.type  # noqa: SIM300
 
 
 def test_create_blob_fromiobase(testrepo):
@@ -160,10 +160,10 @@ def test_create_blob_fromiobase(testrepo):
     blob = testrepo[blob_oid]
 
     assert isinstance(blob, pygit2.Blob)
-    assert ObjectType.BLOB == blob.type
+    assert ObjectType.BLOB == blob.type  # noqa: SIM300
 
     assert blob_oid == blob.id
-    assert BLOB_SHA == blob_oid
+    assert BLOB_SHA == blob_oid  # noqa: SIM300
 
 
 def test_diff_blob(testrepo):
@@ -220,7 +220,7 @@ def test_blob_write_to_queue(testrepo):
     chunks = []
     while not queue.empty():
         chunks.append(queue.get())
-    assert BLOB_CONTENT == b''.join(chunks)
+    assert BLOB_CONTENT == b''.join(chunks)  # noqa: SIM300
 
 
 def test_blob_write_to_queue_filtered(testrepo):
@@ -235,14 +235,14 @@ def test_blob_write_to_queue_filtered(testrepo):
     chunks = []
     while not queue.empty():
         chunks.append(queue.get())
-    assert b'bye world\n' == b''.join(chunks)
+    assert b'bye world\n' == b''.join(chunks)  # noqa: SIM300
 
 
 def test_blobio(testrepo):
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     with pygit2.BlobIO(blob) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
     assert not reader.raw._thread.is_alive()
 
 
@@ -250,5 +250,5 @@ def test_blobio_filtered(testrepo):
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     with pygit2.BlobIO(blob, as_path='bye.txt') as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
     assert not reader.raw._thread.is_alive()
diff --git a/test/test_branch.py b/test/test_branch.py
index bfc944c0..05c094fc 100644
--- a/test/test_branch.py
+++ b/test/test_branch.py
@@ -25,7 +25,7 @@
 
 """Tests for branch methods."""
 
-import pygit2
+import pygit2  # noqa: I001
 import pytest
 import os
 from pygit2.enums import BranchType
diff --git a/test/test_branch_empty.py b/test/test_branch_empty.py
index c1d07970..4a246684 100644
--- a/test/test_branch_empty.py
+++ b/test/test_branch_empty.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pytest
+import pytest  # noqa: I001
 from pygit2.enums import BranchType
 
 
diff --git a/test/test_cherrypick.py b/test/test_cherrypick.py
index 136e7d26..54ec4416 100644
--- a/test/test_cherrypick.py
+++ b/test/test_cherrypick.py
@@ -25,7 +25,7 @@
 
 """Tests for merging and information about it."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import pytest
 
 import pygit2
diff --git a/test/test_commit.py b/test/test_commit.py
index 8967e5cd..2f0c1513 100644
--- a/test/test_commit.py
+++ b/test/test_commit.py
@@ -25,7 +25,7 @@
 
 """Tests for Commit objects."""
 
-import sys
+import sys  # noqa: I001
 
 import pytest
 
@@ -52,10 +52,10 @@ def test_commit_refcount(barerepo):
 
 def test_read_commit(barerepo):
     commit = barerepo[COMMIT_SHA]
-    assert COMMIT_SHA == commit.id
+    assert COMMIT_SHA == commit.id  # noqa: SIM300
     parents = commit.parents
-    assert 1 == len(parents)
-    assert 'c2792cfa289ae6321ecf2cd5806c2194b0fd070c' == parents[0].id
+    assert 1 == len(parents)  # noqa: SIM300
+    assert 'c2792cfa289ae6321ecf2cd5806c2194b0fd070c' == parents[0].id  # noqa: SIM300
     assert commit.message_encoding is None
     assert commit.message == (
         'Second test data commit.\n\nThis commit has some additional text.\n'
@@ -68,7 +68,7 @@ def test_read_commit(barerepo):
     assert commit.author == Signature(
         'Dave Borowitz', 'dborowitz@google.com', 1288477363, -420
     )
-    assert '967fce8df97cc71722d3c2a5930ef3e6f1d27b12' == commit.tree.id
+    assert '967fce8df97cc71722d3c2a5930ef3e6f1d27b12' == commit.tree.id  # noqa: SIM300
 
 
 def test_new_commit(barerepo):
@@ -89,17 +89,17 @@ def test_new_commit(barerepo):
     sha = repo.create_commit(None, author, committer, message, tree_prefix, parents)
     commit = repo[sha]
 
-    assert ObjectType.COMMIT == commit.type
-    assert '98286caaab3f1fde5bf52c8369b2b0423bad743b' == commit.id
+    assert ObjectType.COMMIT == commit.type  # noqa: SIM300
+    assert '98286caaab3f1fde5bf52c8369b2b0423bad743b' == commit.id  # noqa: SIM300
     assert commit.message_encoding is None
     assert message == commit.message
-    assert 12346 == commit.commit_time
+    assert 12346 == commit.commit_time  # noqa: SIM300, PLR2004
     assert committer == commit.committer
     assert author == commit.author
     assert tree == commit.tree.id
     assert Oid(hex=tree) == commit.tree_id
-    assert 1 == len(commit.parents)
-    assert COMMIT_SHA == commit.parents[0].id
+    assert 1 == len(commit.parents)  # noqa: SIM300
+    assert COMMIT_SHA == commit.parents[0].id  # noqa: SIM300
     assert Oid(hex=COMMIT_SHA) == commit.parent_ids[0]
 
 
@@ -118,16 +118,16 @@ def test_new_commit_encoding(barerepo):
     )
     commit = repo[sha]
 
-    assert ObjectType.COMMIT == commit.type
-    assert 'iso-8859-1' == commit.message_encoding
+    assert ObjectType.COMMIT == commit.type  # noqa: SIM300
+    assert 'iso-8859-1' == commit.message_encoding  # noqa: SIM300
     assert message.encode(encoding) == commit.raw_message
-    assert 12346 == commit.commit_time
+    assert 12346 == commit.commit_time  # noqa: SIM300, PLR2004
     assert committer == commit.committer
     assert author == commit.author
     assert tree == commit.tree.id
     assert Oid(hex=tree) == commit.tree_id
-    assert 1 == len(commit.parents)
-    assert COMMIT_SHA == commit.parents[0].id
+    assert 1 == len(commit.parents)  # noqa: SIM300
+    assert COMMIT_SHA == commit.parents[0].id  # noqa: SIM300
     assert Oid(hex=COMMIT_SHA) == commit.parent_ids[0]
 
 
@@ -139,15 +139,15 @@ def test_modify_commit(barerepo):
     commit = barerepo[COMMIT_SHA]
 
     with pytest.raises(AttributeError):
-        setattr(commit, 'message', message)
+        setattr(commit, 'message', message)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(commit, 'committer', committer)
+        setattr(commit, 'committer', committer)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(commit, 'author', author)
+        setattr(commit, 'author', author)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(commit, 'tree', None)
+        setattr(commit, 'tree', None)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(commit, 'parents', None)
+        setattr(commit, 'parents', None)  # noqa: B010
 
 
 def test_amend_commit_metadata(barerepo):
@@ -175,7 +175,7 @@ def test_amend_commit_metadata(barerepo):
     amended_commit = repo[amended_oid]
 
     assert repo.head.target == amended_oid
-    assert ObjectType.COMMIT == amended_commit.type
+    assert ObjectType.COMMIT == amended_commit.type  # noqa: SIM300
     assert amended_committer == amended_commit.committer
     assert amended_author == amended_commit.author
     assert amended_message.encode(encoding) == amended_commit.raw_message
@@ -196,7 +196,7 @@ def test_amend_commit_tree(barerepo):
     amended_commit = repo[amended_oid]
 
     assert repo.head.target == amended_oid
-    assert ObjectType.COMMIT == amended_commit.type
+    assert ObjectType.COMMIT == amended_commit.type  # noqa: SIM300
     assert commit.message == amended_commit.message
     assert commit.author == amended_commit.author
     assert commit.committer == amended_commit.committer
@@ -267,13 +267,13 @@ def test_amend_commit_argument_types(barerepo):
     # Pass an Oid for the commit
     amended_oid = repo.amend_commit(alt_commit1, None, message='Hello')
     amended_commit = repo[amended_oid]
-    assert ObjectType.COMMIT == amended_commit.type
+    assert ObjectType.COMMIT == amended_commit.type  # noqa: SIM300
     assert amended_oid != COMMIT_SHA_TO_AMEND
 
     # Pass a str for the commit
     amended_oid = repo.amend_commit(alt_commit2, None, message='Hello', tree=alt_tree)
     amended_commit = repo[amended_oid]
-    assert ObjectType.COMMIT == amended_commit.type
+    assert ObjectType.COMMIT == amended_commit.type  # noqa: SIM300
     assert amended_oid != COMMIT_SHA_TO_AMEND
     assert repo[COMMIT_SHA_TO_AMEND].tree != amended_commit.tree
     assert alt_tree.id == amended_commit.tree_id
@@ -282,6 +282,6 @@ def test_amend_commit_argument_types(barerepo):
     # (Warning: the tip of the branch will be altered after this test!)
     amended_oid = repo.amend_commit(alt_commit2, alt_refname, message='Hello')
     amended_commit = repo[amended_oid]
-    assert ObjectType.COMMIT == amended_commit.type
+    assert ObjectType.COMMIT == amended_commit.type  # noqa: SIM300
     assert amended_oid != COMMIT_SHA_TO_AMEND
     assert repo.head.target == amended_oid
diff --git a/test/test_commit_gpg.py b/test/test_commit_gpg.py
index 88450b6c..47dd1780 100644
--- a/test/test_commit_gpg.py
+++ b/test/test_commit_gpg.py
@@ -79,7 +79,7 @@
  -----END PGP SIGNATURE-----
 
 a simple commit which works\
-"""
+"""  # noqa: W293
 # NOTE: ^^^ mind the gap (space must exist after GnuPG header) ^^^
 # XXX: seems macos wants the space while linux does not
 
@@ -119,16 +119,16 @@ def test_commit_signing(gpgsigned):
     assert gpgsig_content == commit.read_raw().decode('utf-8')
 
     # perform sanity checks
-    assert ObjectType.COMMIT == commit.type
-    assert '6569fdf71dbd99081891154641869c537784a3ba' == commit.id
+    assert ObjectType.COMMIT == commit.type  # noqa: SIM300
+    assert '6569fdf71dbd99081891154641869c537784a3ba' == commit.id  # noqa: SIM300
     assert commit.message_encoding is None
     assert message == commit.message
-    assert 1358451456 == commit.commit_time
+    assert 1358451456 == commit.commit_time  # noqa: SIM300, PLR2004
     assert committer == commit.committer
     assert author == commit.author
     assert tree == commit.tree.id
     assert Oid(hex=tree) == commit.tree_id
-    assert 1 == len(commit.parents)
+    assert 1 == len(commit.parents)  # noqa: SIM300
     assert parent == commit.parents[0].id
     assert Oid(hex=parent) == commit.parent_ids[0]
 
diff --git a/test/test_commit_trailer.py b/test/test_commit_trailer.py
index d7236cd8..0605dce1 100644
--- a/test/test_commit_trailer.py
+++ b/test/test_commit_trailer.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pygit2
+import pygit2  # noqa: I001
 import pytest
 
 from . import utils
diff --git a/test/test_config.py b/test/test_config.py
index 0284d76f..d3555d9b 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pytest
 
@@ -37,7 +37,7 @@
 @pytest.fixture
 def config(testrepo):
     yield testrepo.config
-    try:
+    try:  # noqa: SIM105
         Path(CONFIG_FILENAME).unlink()
     except OSError:
         pass
@@ -48,7 +48,7 @@ def test_config(config):
 
 
 def test_global_config():
-    try:
+    try:  # noqa: SIM105
         assert Config.get_global_config() is not None
     except IOError:
         # There is no user config
@@ -56,7 +56,7 @@ def test_global_config():
 
 
 def test_system_config():
-    try:
+    try:  # noqa: SIM105
         assert Config.get_system_config() is not None
     except IOError:
         # There is no system config
@@ -65,7 +65,7 @@ def test_system_config():
 
 def test_new():
     # Touch file
-    open(CONFIG_FILENAME, 'w').close()
+    open(CONFIG_FILENAME, 'w').close()  # noqa: PTH123
 
     config_write = Config(CONFIG_FILENAME)
     assert config_write is not None
@@ -81,7 +81,7 @@ def test_new():
 
 
 def test_add():
-    with open(CONFIG_FILENAME, 'w') as new_file:
+    with open(CONFIG_FILENAME, 'w') as new_file:  # noqa: PTH123
         new_file.write('[this]\n\tthat = true\n')
         new_file.write('[something "other"]\n\there = false')
 
@@ -94,7 +94,7 @@ def test_add():
 
 
 def test_add_aspath():
-    with open(CONFIG_FILENAME, 'w') as new_file:
+    with open(CONFIG_FILENAME, 'w') as new_file:  # noqa: PTH123
         new_file.write('[this]\n\tthat = true\n')
 
     config = Config()
@@ -127,7 +127,7 @@ def test_write(config):
     assert 'core.dummy1' not in config
     config['core.dummy1'] = 42
     assert 'core.dummy1' in config
-    assert config.get_int('core.dummy1') == 42
+    assert config.get_int('core.dummy1') == 42  # noqa: PLR2004
 
     assert 'core.dummy2' not in config
     config['core.dummy2'] = 'foobar'
@@ -148,30 +148,30 @@ def test_write(config):
 
 
 def test_multivar():
-    with open(CONFIG_FILENAME, 'w') as new_file:
+    with open(CONFIG_FILENAME, 'w') as new_file:  # noqa: PTH123
         new_file.write('[this]\n\tthat = foobar\n\tthat = foobeer\n')
 
     config = Config()
     config.add_file(CONFIG_FILENAME, 6)
     assert 'this.that' in config
 
-    assert ['foobar', 'foobeer'] == list(config.get_multivar('this.that'))
-    assert ['foobar'] == list(config.get_multivar('this.that', 'bar'))
-    assert ['foobar', 'foobeer'] == list(config.get_multivar('this.that', 'foo.*'))
+    assert ['foobar', 'foobeer'] == list(config.get_multivar('this.that'))  # noqa: SIM300
+    assert ['foobar'] == list(config.get_multivar('this.that', 'bar'))  # noqa: SIM300
+    assert ['foobar', 'foobeer'] == list(config.get_multivar('this.that', 'foo.*'))  # noqa: SIM300
 
     config.set_multivar('this.that', '^.*beer', 'fool')
-    assert ['fool'] == list(config.get_multivar('this.that', 'fool'))
+    assert ['fool'] == list(config.get_multivar('this.that', 'fool'))  # noqa: SIM300
 
     config.set_multivar('this.that', 'foo.*', 'foo-123456')
-    assert ['foo-123456', 'foo-123456'] == list(
+    assert ['foo-123456', 'foo-123456'] == list(  # noqa: SIM300
         config.get_multivar('this.that', 'foo.*')
     )
 
     config.delete_multivar('this.that', 'bar')
-    assert ['foo-123456', 'foo-123456'] == list(config.get_multivar('this.that', ''))
+    assert ['foo-123456', 'foo-123456'] == list(config.get_multivar('this.that', ''))  # noqa: SIM300
 
     config.delete_multivar('this.that', 'foo-[0-9]+')
-    assert [] == list(config.get_multivar('this.that', ''))
+    assert [] == list(config.get_multivar('this.that', ''))  # noqa: SIM300
 
 
 def test_iterator(config):
@@ -188,5 +188,5 @@ def test_parsing():
     assert Config.parse_bool('on')
     assert Config.parse_bool('1')
 
-    assert 5 == Config.parse_int('5')
-    assert 1024 == Config.parse_int('1k')
+    assert 5 == Config.parse_int('5')  # noqa: SIM300, PLR2004
+    assert 1024 == Config.parse_int('1k')  # noqa: SIM300, PLR2004
diff --git a/test/test_credentials.py b/test/test_credentials.py
index e9578b36..3f767f4f 100644
--- a/test/test_credentials.py
+++ b/test/test_credentials.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import platform
 
 import pytest
@@ -117,10 +117,10 @@ def test_keypair_from_memory(tmp_path, pygit2_empty_key):
         pygit2.clone_repository(url, tmp_path)
 
     prv, pub, secret = pygit2_empty_key
-    with open(prv) as f:
+    with open(prv) as f:  # noqa: PTH123
         prv_mem = f.read()
 
-    with open(pub) as f:
+    with open(pub) as f:  # noqa: PTH123
         pub_mem = f.read()
 
     keypair = pygit2.KeypairFromMemory('git', pub_mem, prv_mem, secret)
@@ -130,20 +130,20 @@ def test_keypair_from_memory(tmp_path, pygit2_empty_key):
 
 def test_callback(testrepo):
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def credentials(testrepo, url, username, allowed):
+        def credentials(testrepo, url, username, allowed):  # noqa: ARG002
             assert allowed & CredentialType.USERPASS_PLAINTEXT
             raise Exception("I don't know the password")
 
     url = 'https://github.com/github/github'
     remote = testrepo.remotes.create('github', url)
-    with pytest.raises(Exception):
+    with pytest.raises(Exception):  # noqa: B017
         remote.fetch(callbacks=MyCallbacks())
 
 
 @utils.requires_network
 def test_bad_cred_type(testrepo):
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def credentials(testrepo, url, username, allowed):
+        def credentials(testrepo, url, username, allowed):  # noqa: ARG002
             assert allowed & CredentialType.USERPASS_PLAINTEXT
             return Keypair('git', 'foo.pub', 'foo', 'sekkrit')
 
diff --git a/test/test_describe.py b/test/test_describe.py
index 22650a5d..c53de710 100644
--- a/test/test_describe.py
+++ b/test/test_describe.py
@@ -25,7 +25,7 @@
 
 """Tests for describing commits."""
 
-import pytest
+import pytest  # noqa: I001
 
 from pygit2.enums import DescribeStrategy, ObjectType
 import pygit2
@@ -41,7 +41,7 @@ def add_tag(repo, name, target):
 
 def test_describe(testrepo):
     add_tag(testrepo, 'thetag', '4ec4389a8068641da2d6578db0419484972284c8')
-    assert 'thetag-2-g2be5719' == testrepo.describe()
+    assert 'thetag-2-g2be5719' == testrepo.describe()  # noqa: SIM300
 
 
 def test_describe_without_ref(testrepo):
@@ -50,18 +50,18 @@ def test_describe_without_ref(testrepo):
 
 
 def test_describe_default_oid(testrepo):
-    assert '2be5719' == testrepo.describe(show_commit_oid_as_fallback=True)
+    assert '2be5719' == testrepo.describe(show_commit_oid_as_fallback=True)  # noqa: SIM300
 
 
 def test_describe_strategies(testrepo):
-    assert 'heads/master' == testrepo.describe(describe_strategy=DescribeStrategy.ALL)
+    assert 'heads/master' == testrepo.describe(describe_strategy=DescribeStrategy.ALL)  # noqa: SIM300
 
     testrepo.create_reference(
         'refs/tags/thetag', '4ec4389a8068641da2d6578db0419484972284c8'
     )
     with pytest.raises(KeyError):
         testrepo.describe()
-    assert 'thetag-2-g2be5719' == testrepo.describe(
+    assert 'thetag-2-g2be5719' == testrepo.describe(  # noqa: SIM300
         describe_strategy=DescribeStrategy.TAGS
     )
 
@@ -70,20 +70,20 @@ def test_describe_pattern(testrepo):
     add_tag(testrepo, 'private/tag1', '5ebeeebb320790caf276b9fc8b24546d63316533')
     add_tag(testrepo, 'public/tag2', '4ec4389a8068641da2d6578db0419484972284c8')
 
-    assert 'public/tag2-2-g2be5719' == testrepo.describe(pattern='public/*')
+    assert 'public/tag2-2-g2be5719' == testrepo.describe(pattern='public/*')  # noqa: SIM300
 
 
 def test_describe_committish(testrepo):
     add_tag(testrepo, 'thetag', 'acecd5ea2924a4b900e7e149496e1f4b57976e51')
-    assert 'thetag-4-g2be5719' == testrepo.describe(committish='HEAD')
-    assert 'thetag-1-g5ebeeeb' == testrepo.describe(committish='HEAD^')
+    assert 'thetag-4-g2be5719' == testrepo.describe(committish='HEAD')  # noqa: SIM300
+    assert 'thetag-1-g5ebeeeb' == testrepo.describe(committish='HEAD^')  # noqa: SIM300
 
-    assert 'thetag-4-g2be5719' == testrepo.describe(committish=testrepo.head)
+    assert 'thetag-4-g2be5719' == testrepo.describe(committish=testrepo.head)  # noqa: SIM300
 
-    assert 'thetag-1-g6aaa262' == testrepo.describe(
+    assert 'thetag-1-g6aaa262' == testrepo.describe(  # noqa: SIM300
         committish='6aaa262e655dd54252e5813c8e5acd7780ed097d'
     )
-    assert 'thetag-1-g6aaa262' == testrepo.describe(committish='6aaa262')
+    assert 'thetag-1-g6aaa262' == testrepo.describe(committish='6aaa262')  # noqa: SIM300
 
 
 def test_describe_follows_first_branch_only(testrepo):
@@ -94,20 +94,20 @@ def test_describe_follows_first_branch_only(testrepo):
 
 def test_describe_abbreviated_size(testrepo):
     add_tag(testrepo, 'thetag', '4ec4389a8068641da2d6578db0419484972284c8')
-    assert 'thetag-2-g2be5719152d4f82c' == testrepo.describe(abbreviated_size=16)
-    assert 'thetag' == testrepo.describe(abbreviated_size=0)
+    assert 'thetag-2-g2be5719152d4f82c' == testrepo.describe(abbreviated_size=16)  # noqa: SIM300
+    assert 'thetag' == testrepo.describe(abbreviated_size=0)  # noqa: SIM300
 
 
 def test_describe_long_format(testrepo):
     add_tag(testrepo, 'thetag', '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98')
-    assert 'thetag-0-g2be5719' == testrepo.describe(always_use_long_format=True)
+    assert 'thetag-0-g2be5719' == testrepo.describe(always_use_long_format=True)  # noqa: SIM300
 
 
 def test_describe_dirty(dirtyrepo):
     add_tag(dirtyrepo, 'thetag', 'a763aa560953e7cfb87ccbc2f536d665aa4dff22')
-    assert 'thetag' == dirtyrepo.describe()
+    assert 'thetag' == dirtyrepo.describe()  # noqa: SIM300
 
 
 def test_describe_dirty_with_suffix(dirtyrepo):
     add_tag(dirtyrepo, 'thetag', 'a763aa560953e7cfb87ccbc2f536d665aa4dff22')
-    assert 'thetag-dirty' == dirtyrepo.describe(dirty_suffix='-dirty')
+    assert 'thetag-dirty' == dirtyrepo.describe(dirty_suffix='-dirty')  # noqa: SIM300
diff --git a/test/test_diff.py b/test/test_diff.py
index 28e1b0c3..70af6a4b 100644
--- a/test/test_diff.py
+++ b/test/test_diff.py
@@ -25,7 +25,7 @@
 
 """Tests for Diff objects."""
 
-from itertools import chain
+from itertools import chain  # noqa: I001
 import textwrap
 
 import pytest
@@ -114,11 +114,11 @@ def test_diff_empty_index(dirtyrepo):
 
     diff = head.tree.diff_to_index(repo.index)
     files = [patch.delta.new_file.path for patch in diff]
-    assert DIFF_HEAD_TO_INDEX_EXPECTED == files
+    assert DIFF_HEAD_TO_INDEX_EXPECTED == files  # noqa: SIM300
 
     diff = repo.diff('HEAD', cached=True)
     files = [patch.delta.new_file.path for patch in diff]
-    assert DIFF_HEAD_TO_INDEX_EXPECTED == files
+    assert DIFF_HEAD_TO_INDEX_EXPECTED == files  # noqa: SIM300
 
 
 def test_workdir_to_tree(dirtyrepo):
@@ -127,17 +127,17 @@ def test_workdir_to_tree(dirtyrepo):
 
     diff = head.tree.diff_to_workdir()
     files = [patch.delta.new_file.path for patch in diff]
-    assert DIFF_HEAD_TO_WORKDIR_EXPECTED == files
+    assert DIFF_HEAD_TO_WORKDIR_EXPECTED == files  # noqa: SIM300
 
     diff = repo.diff('HEAD')
     files = [patch.delta.new_file.path for patch in diff]
-    assert DIFF_HEAD_TO_WORKDIR_EXPECTED == files
+    assert DIFF_HEAD_TO_WORKDIR_EXPECTED == files  # noqa: SIM300
 
 
 def test_index_to_workdir(dirtyrepo):
     diff = dirtyrepo.diff()
     files = [patch.delta.new_file.path for patch in diff]
-    assert DIFF_INDEX_TO_WORK_EXPECTED == files
+    assert DIFF_INDEX_TO_WORK_EXPECTED == files  # noqa: SIM300
 
 
 def test_diff_invalid(barerepo):
@@ -172,7 +172,7 @@ def test_diff_tree(barerepo):
 
     def _test(diff):
         assert diff is not None
-        assert 2 == sum(map(lambda x: len(x.hunks), diff))
+        assert 2 == sum(map(lambda x: len(x.hunks), diff))  # noqa: C417, SIM300, PLR2004
 
         patch = diff[0]
         hunk = patch.hunks[0]
@@ -204,18 +204,18 @@ def test_diff_empty_tree(barerepo):
     diff = commit_a.tree.diff_to_tree()
 
     def get_context_for_lines(diff):
-        hunks = chain.from_iterable(map(lambda x: x.hunks, diff))
-        lines = chain.from_iterable(map(lambda x: x.lines, hunks))
-        return map(lambda x: x.origin, lines)
+        hunks = chain.from_iterable(map(lambda x: x.hunks, diff))  # noqa: C417
+        lines = chain.from_iterable(map(lambda x: x.lines, hunks))  # noqa: C417
+        return map(lambda x: x.origin, lines)  # noqa: C417
 
     entries = [p.delta.new_file.path for p in diff]
     assert all(commit_a.tree[x] for x in entries)
-    assert all('-' == x for x in get_context_for_lines(diff))
+    assert all('-' == x for x in get_context_for_lines(diff))  # noqa: SIM300
 
     diff_swaped = commit_a.tree.diff_to_tree(swap=True)
     entries = [p.delta.new_file.path for p in diff_swaped]
     assert all(commit_a.tree[x] for x in entries)
-    assert all('+' == x for x in get_context_for_lines(diff_swaped))
+    assert all('+' == x for x in get_context_for_lines(diff_swaped))  # noqa: SIM300
 
 
 def test_diff_revparse(barerepo):
@@ -230,11 +230,11 @@ def test_diff_tree_opts(barerepo):
     for flag in [DiffOption.IGNORE_WHITESPACE, DiffOption.IGNORE_WHITESPACE_EOL]:
         diff = commit_c.tree.diff_to_tree(commit_d.tree, flag)
         assert diff is not None
-        assert 0 == len(diff[0].hunks)
+        assert 0 == len(diff[0].hunks)  # noqa: SIM300
 
     diff = commit_c.tree.diff_to_tree(commit_d.tree)
     assert diff is not None
-    assert 1 == len(diff[0].hunks)
+    assert 1 == len(diff[0].hunks)  # noqa: SIM300
 
 
 def test_diff_merge(barerepo):
@@ -270,7 +270,7 @@ def test_diff_patch(barerepo):
 
     diff = commit_a.tree.diff_to_tree(commit_b.tree)
     assert diff.patch == PATCH
-    assert len(diff) == len([patch for patch in diff])
+    assert len(diff) == len([patch for patch in diff])  # noqa: C416
 
 
 def test_diff_ids(barerepo):
@@ -296,7 +296,7 @@ def test_hunk_content(barerepo):
     patch = commit_a.tree.diff_to_tree(commit_b.tree)[0]
     hunk = patch.hunks[0]
     lines = (f'{x.origin} {x.content}' for x in hunk.lines)
-    assert HUNK_EXPECTED == ''.join(lines)
+    assert HUNK_EXPECTED == ''.join(lines)  # noqa: SIM300
     for line in hunk.lines:
         assert line.content == line.raw_content.decode()
 
@@ -321,13 +321,13 @@ def test_diff_stats(barerepo):
 
     diff = commit_a.tree.diff_to_tree(commit_b.tree)
     stats = diff.stats
-    assert 1 == stats.insertions
-    assert 2 == stats.deletions
-    assert 2 == stats.files_changed
+    assert 1 == stats.insertions  # noqa: SIM300
+    assert 2 == stats.deletions  # noqa: SIM300, PLR2004
+    assert 2 == stats.files_changed  # noqa: SIM300, PLR2004
     formatted = stats.format(
         format=DiffStatsFormat.FULL | DiffStatsFormat.INCLUDE_SUMMARY, width=80
     )
-    assert STATS_EXPECTED == formatted
+    assert STATS_EXPECTED == formatted  # noqa: SIM300
 
 
 def test_deltas(barerepo):
@@ -353,16 +353,16 @@ def test_deltas(barerepo):
         # assert delta.flags == patch_delta.flags
 
 
-def test_diff_parse(barerepo):
+def test_diff_parse(barerepo):  # noqa: ARG001
     diff = pygit2.Diff.parse_diff(PATCH)
 
     stats = diff.stats
-    assert 2 == stats.deletions
-    assert 1 == stats.insertions
-    assert 2 == stats.files_changed
+    assert 2 == stats.deletions  # noqa: SIM300, PLR2004
+    assert 1 == stats.insertions  # noqa: SIM300
+    assert 2 == stats.files_changed  # noqa: SIM300, PLR2004
 
     deltas = list(diff.deltas)
-    assert 2 == len(deltas)
+    assert 2 == len(deltas)  # noqa: SIM300, PLR2004
 
 
 def test_parse_diff_null():
diff --git a/test/test_diff_binary.py b/test/test_diff_binary.py
index e23583ad..3f66015b 100644
--- a/test/test_diff_binary.py
+++ b/test/test_diff_binary.py
@@ -51,15 +51,15 @@ def repo(tmp_path):
 literal 8
 Pc${NM&PdElPvrst3ey5{
 
-"""
+"""  # noqa: E501
 
 
 def test_binary_diff(repo):
     diff = repo.diff('HEAD', 'HEAD^')
-    assert PATCH_BINARY == diff.patch
+    assert PATCH_BINARY == diff.patch  # noqa: SIM300
     diff = repo.diff('HEAD', 'HEAD^', flags=DiffOption.SHOW_BINARY)
-    assert PATCH_BINARY_SHOW == diff.patch
+    assert PATCH_BINARY_SHOW == diff.patch  # noqa: SIM300
     diff = repo.diff(b'HEAD', b'HEAD^')
-    assert PATCH_BINARY == diff.patch
+    assert PATCH_BINARY == diff.patch  # noqa: SIM300
     diff = repo.diff(b'HEAD', b'HEAD^', flags=DiffOption.SHOW_BINARY)
-    assert PATCH_BINARY_SHOW == diff.patch
+    assert PATCH_BINARY_SHOW == diff.patch  # noqa: SIM300
diff --git a/test/test_filter.py b/test/test_filter.py
index f37f9e1c..8dadf655 100644
--- a/test/test_filter.py
+++ b/test/test_filter.py
@@ -1,4 +1,4 @@
-from io import BytesIO
+from io import BytesIO  # noqa: I001
 import codecs
 import pytest
 
@@ -25,7 +25,7 @@ def __init__(self):
         super().__init__()
         self.buf = BytesIO()
 
-    def write(self, data, src, write_next):
+    def write(self, data, src, write_next):  # noqa: ARG002
         self.buf.write(data)
 
     def close(self, write_next):
@@ -71,51 +71,51 @@ def unmatched_filter():
     pygit2.filter_unregister('unmatched-rot13')
 
 
-def test_filter(testrepo, rot13_filter):
+def test_filter(testrepo, rot13_filter):  # noqa: ARG001
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     flags = BlobFilter.CHECK_FOR_BINARY | BlobFilter.ATTRIBUTES_FROM_HEAD
-    assert b'olr jbeyq\n' == blob.data
+    assert b'olr jbeyq\n' == blob.data  # noqa: SIM300
     with pygit2.BlobIO(blob) as reader:
-        assert b'olr jbeyq\n' == reader.read()
+        assert b'olr jbeyq\n' == reader.read()  # noqa: SIM300
     with pygit2.BlobIO(blob, as_path='bye.txt', flags=flags) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
 
 
-def test_filter_buffered(testrepo, buffered_filter):
+def test_filter_buffered(testrepo, buffered_filter):  # noqa: ARG001
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     flags = BlobFilter.CHECK_FOR_BINARY | BlobFilter.ATTRIBUTES_FROM_HEAD
-    assert b'olr jbeyq\n' == blob.data
+    assert b'olr jbeyq\n' == blob.data  # noqa: SIM300
     with pygit2.BlobIO(blob) as reader:
-        assert b'olr jbeyq\n' == reader.read()
+        assert b'olr jbeyq\n' == reader.read()  # noqa: SIM300
     with pygit2.BlobIO(blob, 'bye.txt', flags=flags) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
 
 
-def test_filter_passthrough(testrepo, passthrough_filter):
+def test_filter_passthrough(testrepo, passthrough_filter):  # noqa: ARG001
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     flags = BlobFilter.CHECK_FOR_BINARY | BlobFilter.ATTRIBUTES_FROM_HEAD
-    assert b'bye world\n' == blob.data
+    assert b'bye world\n' == blob.data  # noqa: SIM300
     with pygit2.BlobIO(blob) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
     with pygit2.BlobIO(blob, 'bye.txt', flags=flags) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
 
 
-def test_filter_unmatched(testrepo, unmatched_filter):
+def test_filter_unmatched(testrepo, unmatched_filter):  # noqa: ARG001
     blob_oid = testrepo.create_blob_fromworkdir('bye.txt')
     blob = testrepo[blob_oid]
     flags = BlobFilter.CHECK_FOR_BINARY | BlobFilter.ATTRIBUTES_FROM_HEAD
-    assert b'bye world\n' == blob.data
+    assert b'bye world\n' == blob.data  # noqa: SIM300
     with pygit2.BlobIO(blob) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
     with pygit2.BlobIO(blob, as_path='bye.txt', flags=flags) as reader:
-        assert b'bye world\n' == reader.read()
+        assert b'bye world\n' == reader.read()  # noqa: SIM300
 
 
-def test_filter_cleanup(dirtyrepo, rot13_filter):
+def test_filter_cleanup(dirtyrepo, rot13_filter):  # noqa: ARG001
     # Indirectly test that pygit2_filter_cleanup has the GIL
     # before calling pygit2_filter_payload_free.
     dirtyrepo.diff()
diff --git a/test/test_index.py b/test/test_index.py
index 5aae31ad..b20edbe1 100644
--- a/test/test_index.py
+++ b/test/test_index.py
@@ -25,7 +25,7 @@
 
 """Tests for Index files."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pytest
 
@@ -45,7 +45,7 @@ def test_index(testrepo):
 
 def test_read(testrepo):
     index = testrepo.index
-    assert len(index) == 2
+    assert len(index) == 2  # noqa: PLR2004
 
     with pytest.raises(TypeError):
         index[()]
@@ -66,7 +66,7 @@ def test_add(testrepo):
     assert 'bye.txt' not in index
     index.add('bye.txt')
     assert 'bye.txt' in index
-    assert len(index) == 3
+    assert len(index) == 3  # noqa: PLR2004
     assert index['bye.txt'].id == sha
 
 
@@ -123,7 +123,7 @@ def test_add_all_aspath(testrepo):
 
 def clear(repo):
     index = repo.index
-    assert len(index) == 2
+    assert len(index) == 2  # noqa: PLR2004
     index.clear()
     assert len(index) == 0
 
@@ -143,14 +143,14 @@ def test_read_tree(testrepo):
     tree_oid = '68aba62e560c0ebc3396e8ae9335232cd93a3f60'
     # Test reading first tree
     index = testrepo.index
-    assert len(index) == 2
+    assert len(index) == 2  # noqa: PLR2004
     index.read_tree(tree_oid)
     assert len(index) == 1
     # Test read-write returns the same oid
     assert index.write_tree() == tree_oid
     # Test the index is only modified in memory
     index.read()
-    assert len(index) == 2
+    assert len(index) == 2  # noqa: PLR2004
 
 
 def test_write_tree(testrepo):
@@ -164,7 +164,7 @@ def test_iter(testrepo):
 
     # Compare SHAs, not IndexEntry object identity
     entries = [index[x].id for x in range(n)]
-    assert list(x.id for x in index) == entries
+    assert list(x.id for x in index) == entries  # noqa: C400
 
 
 def test_mode(testrepo):
@@ -174,7 +174,7 @@ def test_mode(testrepo):
     index = testrepo.index
 
     hello_mode = index['hello.txt'].mode
-    assert hello_mode == 33188
+    assert hello_mode == 33188  # noqa: PLR2004
 
 
 def test_bare_index(testrepo):
@@ -224,9 +224,9 @@ def test_change_attributes(testrepo):
     entry.path = 'foo.txt'
     entry.id = ign_entry.id
     entry.mode = FileMode.BLOB_EXECUTABLE
-    assert 'foo.txt' == entry.path
+    assert 'foo.txt' == entry.path  # noqa: SIM300
     assert ign_entry.id == entry.id
-    assert FileMode.BLOB_EXECUTABLE == entry.mode
+    assert FileMode.BLOB_EXECUTABLE == entry.mode  # noqa: SIM300
 
 
 def test_write_tree_to(testrepo, tmp_path):
@@ -242,7 +242,7 @@ def test_create_entry(testrepo):
     hello_entry = index['hello.txt']
     entry = pygit2.IndexEntry('README.md', hello_entry.id, hello_entry.mode)
     index.add(entry)
-    assert '60e769e57ae1d6a2ab75d8d253139e6260e1f912' == index.write_tree()
+    assert '60e769e57ae1d6a2ab75d8d253139e6260e1f912' == index.write_tree()  # noqa: SIM300
 
 
 def test_create_entry_aspath(testrepo):
@@ -275,7 +275,7 @@ def test_entry_repr(testrepo):
     hello_entry = index['hello.txt']
     assert (
         repr(hello_entry)
-        == '<pygit2.index.IndexEntry path=hello.txt id=a520c24d85fbfc815d385957eed41406ca5a860b mode=33188>'
+        == '<pygit2.index.IndexEntry path=hello.txt id=a520c24d85fbfc815d385957eed41406ca5a860b mode=33188>'  # noqa: E501
     )
     assert (
         str(hello_entry)
diff --git a/test/test_mailmap.py b/test/test_mailmap.py
index 3cdef056..96bd466f 100644
--- a/test/test_mailmap.py
+++ b/test/test_mailmap.py
@@ -25,7 +25,7 @@
 
 """Tests for Mailmap."""
 
-from pygit2 import Mailmap
+from pygit2 import Mailmap  # noqa: I001
 
 
 TEST_MAILMAP = """\
diff --git a/test/test_merge.py b/test/test_merge.py
index 959854b3..5e50a2a3 100644
--- a/test/test_merge.py
+++ b/test/test_merge.py
@@ -25,7 +25,7 @@
 
 """Tests for merging and information about it."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pytest
 
@@ -56,12 +56,12 @@ def test_merge_analysis_uptodate(mergerepo):
     analysis, preference = mergerepo.merge_analysis(branch_id)
     assert analysis & MergeAnalysis.UP_TO_DATE
     assert not analysis & MergeAnalysis.FASTFORWARD
-    assert {} == mergerepo.status()
+    assert {} == mergerepo.status()  # noqa: SIM300
 
     analysis, preference = mergerepo.merge_analysis(branch_id, 'refs/heads/ff-branch')
     assert analysis & MergeAnalysis.UP_TO_DATE
     assert not analysis & MergeAnalysis.FASTFORWARD
-    assert {} == mergerepo.status()
+    assert {} == mergerepo.status()  # noqa: SIM300
 
 
 def test_merge_analysis_fastforward(mergerepo):
@@ -71,12 +71,12 @@ def test_merge_analysis_fastforward(mergerepo):
     analysis, preference = mergerepo.merge_analysis(branch_id)
     assert not analysis & MergeAnalysis.UP_TO_DATE
     assert analysis & MergeAnalysis.FASTFORWARD
-    assert {} == mergerepo.status()
+    assert {} == mergerepo.status()  # noqa: SIM300
 
     analysis, preference = mergerepo.merge_analysis(branch_id, 'refs/heads/master')
     assert not analysis & MergeAnalysis.UP_TO_DATE
     assert analysis & MergeAnalysis.FASTFORWARD
-    assert {} == mergerepo.status()
+    assert {} == mergerepo.status()  # noqa: SIM300
 
 
 def test_merge_no_fastforward_no_conflicts(mergerepo):
@@ -86,8 +86,8 @@ def test_merge_no_fastforward_no_conflicts(mergerepo):
     assert not analysis & MergeAnalysis.UP_TO_DATE
     assert not analysis & MergeAnalysis.FASTFORWARD
     # Asking twice to assure the reference counting is correct
-    assert {} == mergerepo.status()
-    assert {} == mergerepo.status()
+    assert {} == mergerepo.status()  # noqa: SIM300
+    assert {} == mergerepo.status()  # noqa: SIM300
 
 
 def test_merge_invalid_hex(mergerepo):
@@ -126,22 +126,22 @@ def test_merge_no_fastforward_conflicts(mergerepo):
 
     status = FileStatus.CONFLICTED
     # Asking twice to assure the reference counting is correct
-    assert {'.gitignore': status} == mergerepo.status()
-    assert {'.gitignore': status} == mergerepo.status()
+    assert {'.gitignore': status} == mergerepo.status()  # noqa: SIM300
+    assert {'.gitignore': status} == mergerepo.status()  # noqa: SIM300
 
     ancestor, ours, theirs = mergerepo.index.conflicts['.gitignore']
     assert ancestor is None
     assert ours is not None
     assert theirs is not None
-    assert '.gitignore' == ours.path
-    assert '.gitignore' == theirs.path
-    assert 1 == len(list(mergerepo.index.conflicts))
+    assert '.gitignore' == ours.path  # noqa: SIM300
+    assert '.gitignore' == theirs.path  # noqa: SIM300
+    assert 1 == len(list(mergerepo.index.conflicts))  # noqa: SIM300
 
     # Checking the index works as expected
     mergerepo.index.add('.gitignore')
     mergerepo.index.write()
     assert mergerepo.index.conflicts is None
-    assert {'.gitignore': FileStatus.INDEX_MODIFIED} == mergerepo.status()
+    assert {'.gitignore': FileStatus.INDEX_MODIFIED} == mergerepo.status()  # noqa: SIM300
 
 
 def test_merge_remove_conflicts(mergerepo):
diff --git a/test/test_nonunicode.py b/test/test_nonunicode.py
index c31f4202..67a121aa 100644
--- a/test/test_nonunicode.py
+++ b/test/test_nonunicode.py
@@ -25,7 +25,7 @@
 
 """Tests for non unicode byte strings"""
 
-import os
+import os  # noqa: I001
 import shutil
 
 import pygit2
@@ -34,9 +34,9 @@
 
 @utils.requires_network
 @utils.requires_linux
-def test_nonunicode_branchname(testrepo):
+def test_nonunicode_branchname(testrepo):  # noqa: ARG001
     folderpath = 'temp_repo_nonutf'
-    if os.path.exists(folderpath):
+    if os.path.exists(folderpath):  # noqa: PTH110
         shutil.rmtree(folderpath)
     newrepo = pygit2.clone_repository(
         path=folderpath, url='https://github.com/pygit2/test_branch_notutf.git'
diff --git a/test/test_note.py b/test/test_note.py
index 2a171924..bdfb3647 100644
--- a/test/test_note.py
+++ b/test/test_note.py
@@ -25,7 +25,7 @@
 
 """Tests for note objects."""
 
-from pygit2 import Signature
+from pygit2 import Signature  # noqa: I001
 import pytest
 
 
diff --git a/test/test_object.py b/test/test_object.py
index 668d2d66..54cf9852 100644
--- a/test/test_object.py
+++ b/test/test_object.py
@@ -25,7 +25,7 @@
 
 """Tests for Object objects."""
 
-import pytest
+import pytest  # noqa: I001
 
 from pygit2 import Tree, Tag
 from pygit2.enums import ObjectType
@@ -48,7 +48,7 @@ def test_equality(testrepo):
 
     assert commit_a is not commit_b
     assert commit_a == commit_b
-    assert not (commit_a != commit_b)
+    assert not (commit_a != commit_b)  # noqa: SIM202
 
 
 def test_hashing(testrepo):
diff --git a/test/test_odb.py b/test/test_odb.py
index c7e60f22..5beabceb 100644
--- a/test/test_odb.py
+++ b/test/test_odb.py
@@ -26,7 +26,7 @@
 """Tests for Odb objects."""
 
 # Standard Library
-import binascii
+import binascii  # noqa: I001
 from pathlib import Path
 
 import pytest
@@ -74,14 +74,14 @@ def test_read(odb):
     ab = odb.read(BLOB_OID)
     a = odb.read(BLOB_HEX)
     assert ab == a
-    assert (ObjectType.BLOB, b'a contents\n') == a
+    assert (ObjectType.BLOB, b'a contents\n') == a  # noqa: SIM300
 
     a2 = odb.read('7f129fd57e31e935c6d60a0c794efe4e6927664b')
-    assert (ObjectType.BLOB, b'a contents 2\n') == a2
+    assert (ObjectType.BLOB, b'a contents 2\n') == a2  # noqa: SIM300
 
     a_hex_prefix = BLOB_HEX[:4]
     a3 = odb.read(a_hex_prefix)
-    assert (ObjectType.BLOB, b'a contents\n') == a3
+    assert (ObjectType.BLOB, b'a contents\n') == a3  # noqa: SIM300
 
 
 def test_write(odb):
diff --git a/test/test_odb_backend.py b/test/test_odb_backend.py
index 026834c3..15d0586d 100644
--- a/test/test_odb_backend.py
+++ b/test/test_odb_backend.py
@@ -26,7 +26,7 @@
 """Tests for Odb backends."""
 
 # Standard Library
-import binascii
+import binascii  # noqa: I001
 from pathlib import Path
 
 import pytest
@@ -106,7 +106,7 @@ def proxy(barerepo):
 
 
 def test_iterable(proxy):
-    assert BLOB_HEX in [o for o in proxy]
+    assert BLOB_HEX in [o for o in proxy]  # noqa: C416
 
 
 def test_read(proxy):
@@ -117,13 +117,13 @@ def test_read(proxy):
     ab = proxy.read(BLOB_OID)
     a = proxy.read(BLOB_HEX)
     assert ab == a
-    assert (ObjectType.BLOB, b'a contents\n') == a
+    assert (ObjectType.BLOB, b'a contents\n') == a  # noqa: SIM300
 
 
 def test_read_prefix(proxy):
     a_hex_prefix = BLOB_HEX[:4]
     a3 = proxy.read_prefix(a_hex_prefix)
-    assert (ObjectType.BLOB, b'a contents\n', BLOB_OID) == a3
+    assert (ObjectType.BLOB, b'a contents\n', BLOB_OID) == a3  # noqa: SIM300
 
 
 def test_exists(proxy):
@@ -136,7 +136,7 @@ def test_exists(proxy):
 
 def test_exists_prefix(proxy):
     a_hex_prefix = BLOB_HEX[:4]
-    assert BLOB_HEX == proxy.exists_prefix(a_hex_prefix)
+    assert BLOB_HEX == proxy.exists_prefix(a_hex_prefix)  # noqa: SIM300
 
 
 #
diff --git a/test/test_oid.py b/test/test_oid.py
index c6cbf3e8..e9b9237d 100644
--- a/test/test_oid.py
+++ b/test/test_oid.py
@@ -26,7 +26,7 @@
 """Tests for Object ids."""
 
 # Standard Library
-from binascii import unhexlify
+from binascii import unhexlify  # noqa: I001
 
 from pygit2 import Oid
 import pytest
@@ -85,7 +85,7 @@ def test_cmp():
     # Other
     assert oid1 < oid2
     assert oid1 <= oid2
-    assert not oid1 == oid2
+    assert not oid1 == oid2  # noqa: SIM201
     assert not oid1 > oid2
     assert not oid1 >= oid2
 
@@ -98,7 +98,7 @@ def test_hash():
 
     s.add(Oid(hex='0000000000000000000000000000000000000000'))
     s.add(Oid(hex='0000000000000000000000000000000000000001'))
-    assert len(s) == 3
+    assert len(s) == 3  # noqa: PLR2004
 
 
 def test_bool():
diff --git a/test/test_packbuilder.py b/test/test_packbuilder.py
index 6d4ed0d9..6e4589db 100644
--- a/test/test_packbuilder.py
+++ b/test/test_packbuilder.py
@@ -25,7 +25,7 @@
 
 """Tests for Index files."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pygit2
 from pygit2 import PackBuilder
@@ -41,15 +41,15 @@ def test_create_packbuilder(testrepo):
 def test_add(testrepo):
     # Add a few objects and confirm that the count is correct
     packbuilder = PackBuilder(testrepo)
-    objects_to_add = [obj for obj in testrepo]
+    objects_to_add = [obj for obj in testrepo]  # noqa: C416
     packbuilder.add(objects_to_add[0])
     assert len(packbuilder) == 1
     packbuilder.add(objects_to_add[1])
-    assert len(packbuilder) == 2
+    assert len(packbuilder) == 2  # noqa: PLR2004
 
 
 def test_add_recursively(testrepo):
-    # Add the head object and referenced objects recursively and confirm that the count is correct
+    # Add the head object and referenced objects recursively and confirm that the count is correct  # noqa: E501
     packbuilder = PackBuilder(testrepo)
     packbuilder.add_recur(testrepo.head.target)
 
@@ -59,7 +59,7 @@ def test_add_recursively(testrepo):
     # Blob: hello.txt
     # Blob: .gitignore
 
-    assert len(packbuilder) == 4
+    assert len(packbuilder) == 4  # noqa: PLR2004
 
 
 def test_repo_pack(testrepo, tmp_path):
@@ -96,16 +96,16 @@ def confirm_same_repo_after_packing(testrepo, tmp_path, pack_delegate):
     pack_path = objects_dir / 'pack'
     pack_path.mkdir(parents=True)
 
-    # assert that the number of written objects is the same as the number of objects in the repo
+    # assert that the number of written objects is the same as the number of objects in the repo  # noqa: E501
     written_objects = testrepo.pack(pack_path, pack_delegate=pack_delegate)
-    assert written_objects == len([obj for obj in testrepo])
+    assert written_objects == len([obj for obj in testrepo])  # noqa: C416
 
-    # assert that the number of objects in the pack repo is the same as the original repo
-    orig_objects = [obj for obj in testrepo.odb]
-    packed_objects = [obj for obj in pack_repo.odb]
+    # assert that the number of objects in the pack repo is the same as the original repo  # noqa: E501
+    orig_objects = [obj for obj in testrepo.odb]  # noqa: C416
+    packed_objects = [obj for obj in pack_repo.odb]  # noqa: C416
     assert len(packed_objects) == len(orig_objects)
 
-    # assert that the objects in the packed repo are the same objects as the original repo
-    for i, obj in enumerate(orig_objects):
+    # assert that the objects in the packed repo are the same objects as the original repo  # noqa: E501
+    for i, obj in enumerate(orig_objects):  # noqa: B007
         assert pack_repo[obj].type == testrepo[obj].type
         assert pack_repo[obj].read_raw() == testrepo[obj].read_raw()
diff --git a/test/test_patch.py b/test/test_patch.py
index 5620f9b5..cedd4317 100644
--- a/test/test_patch.py
+++ b/test/test_patch.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pygit2
+import pygit2  # noqa: I001
 import pytest
 
 
@@ -117,7 +117,7 @@ def test_patch_create_from_blob_buffer(testrepo):
     assert patch.text == BLOB_PATCH
 
 
-def test_patch_create_from_blob_buffer_add(testrepo):
+def test_patch_create_from_blob_buffer_add(testrepo):  # noqa: ARG001
     patch = pygit2.Patch.create_from(
         None,
         BLOB_NEW_CONTENT,
diff --git a/test/test_patch_encoding.py b/test/test_patch_encoding.py
index 23f4aca1..647d48c4 100644
--- a/test/test_patch_encoding.py
+++ b/test/test_patch_encoding.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pygit2
+import pygit2  # noqa: I001
 
 
 expected_diff = b"""diff --git a/iso-8859-1.txt b/iso-8859-1.txt
diff --git a/test/test_refdb_backend.py b/test/test_refdb_backend.py
index a7f10cf5..2b8da360 100644
--- a/test/test_refdb_backend.py
+++ b/test/test_refdb_backend.py
@@ -25,7 +25,7 @@
 
 """Tests for Refdb objects."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pygit2
 import pytest
@@ -46,7 +46,7 @@ def exists(testrepo, ref):
     def lookup(testrepo, ref):
         return testrepo.source.lookup(ref)
 
-    def write(testrepo, ref, force, who, message, old, old_target):
+    def write(testrepo, ref, force, who, message, old, old_target):  # noqa: PLR0913
         return testrepo.source.write(ref, force, who, message, old, old_target)
 
     def rename(testrepo, old_name, new_name, force, who, message):
@@ -108,7 +108,7 @@ def test_delete(repo):
 
 
 def test_compress(repo):
-    repo = repo
+    repo = repo  # noqa: PLW0127
     packed_refs_file = Path(repo.path) / 'packed-refs'
     assert not packed_refs_file.exists()
     repo.backend.compress()
diff --git a/test/test_refs.py b/test/test_refs.py
index cddfa038..5ff6a940 100644
--- a/test/test_refs.py
+++ b/test/test_refs.py
@@ -25,7 +25,7 @@
 
 """Tests for reference objects."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pytest
 
@@ -60,8 +60,8 @@ def test_refs_list(testrepo):
 
 def test_head(testrepo):
     head = testrepo.head
-    assert LAST_COMMIT == testrepo[head.target].id
-    assert LAST_COMMIT == testrepo[head.raw_target].id
+    assert LAST_COMMIT == testrepo[head.target].id  # noqa: SIM300
+    assert LAST_COMMIT == testrepo[head.raw_target].id  # noqa: SIM300
 
 
 def test_refs_getitem(testrepo):
@@ -150,11 +150,11 @@ def test_refs_delete(testrepo):
 
     # Access the deleted reference
     with pytest.raises(GitError):
-        getattr(reference, 'name')
+        getattr(reference, 'name')  # noqa: B009
     with pytest.raises(GitError):
-        getattr(reference, 'type')
+        getattr(reference, 'type')  # noqa: B009
     with pytest.raises(GitError):
-        getattr(reference, 'target')
+        getattr(reference, 'target')  # noqa: B009
     with pytest.raises(GitError):
         reference.delete()
     with pytest.raises(GitError):
@@ -261,10 +261,10 @@ def test_refs_equality(testrepo):
 
     assert ref1 is not ref2
     assert ref1 == ref2
-    assert not ref1 != ref2
+    assert not ref1 != ref2  # noqa: SIM202
 
     assert ref1 != ref3
-    assert not ref1 == ref3
+    assert not ref1 == ref3  # noqa: SIM201
 
 
 def test_refs_compress(testrepo):
@@ -583,11 +583,11 @@ def test_delete(testrepo):
 
     # Access the deleted reference
     with pytest.raises(GitError):
-        getattr(reference, 'name')
+        getattr(reference, 'name')  # noqa: B009
     with pytest.raises(GitError):
-        getattr(reference, 'type')
+        getattr(reference, 'type')  # noqa: B009
     with pytest.raises(GitError):
-        getattr(reference, 'target')
+        getattr(reference, 'target')  # noqa: B009
     with pytest.raises(GitError):
         reference.delete()
     with pytest.raises(GitError):
diff --git a/test/test_remote.py b/test/test_remote.py
index 1d414479..046287dc 100644
--- a/test/test_remote.py
+++ b/test/test_remote.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import sys
+import sys  # noqa: I001
 
 import pytest
 
@@ -79,8 +79,8 @@ def test_remote_create_anonymous(testrepo):
     assert remote.name is None
     assert url == remote.url
     assert remote.push_url is None
-    assert [] == remote.fetch_refspecs
-    assert [] == remote.push_refspecs
+    assert [] == remote.fetch_refspecs  # noqa: SIM300
+    assert [] == remote.push_refspecs  # noqa: SIM300
 
 
 def test_remote_delete(testrepo):
@@ -88,21 +88,21 @@ def test_remote_delete(testrepo):
     url = 'https://github.com/libgit2/pygit2.git'
 
     testrepo.remotes.create(name, url)
-    assert 2 == len(testrepo.remotes)
+    assert 2 == len(testrepo.remotes)  # noqa: SIM300, PLR2004
     remote = testrepo.remotes[1]
 
     assert name == remote.name
     testrepo.remotes.delete(remote.name)
-    assert 1 == len(testrepo.remotes)
+    assert 1 == len(testrepo.remotes)  # noqa: SIM300
 
 
 def test_remote_rename(testrepo):
     remote = testrepo.remotes[0]
 
-    assert REMOTE_NAME == remote.name
+    assert REMOTE_NAME == remote.name  # noqa: SIM300
     problems = testrepo.remotes.rename(remote.name, 'new')
-    assert [] == problems
-    assert 'new' != remote.name
+    assert [] == problems  # noqa: SIM300
+    assert 'new' != remote.name  # noqa: SIM300
 
     with pytest.raises(ValueError):
         testrepo.remotes.rename('', '')
@@ -112,7 +112,7 @@ def test_remote_rename(testrepo):
 
 def test_remote_set_url(testrepo):
     remote = testrepo.remotes['origin']
-    assert REMOTE_URL == remote.url
+    assert REMOTE_URL == remote.url  # noqa: SIM300
 
     new_url = 'https://github.com/cholin/pygit2.git'
     testrepo.remotes.set_url('origin', new_url)
@@ -137,31 +137,31 @@ def test_refspec(testrepo):
     assert refspec.src == REMOTE_FETCHSPEC_SRC
     assert refspec.dst == REMOTE_FETCHSPEC_DST
     assert refspec.force is True
-    assert ORIGIN_REFSPEC == refspec.string
+    assert ORIGIN_REFSPEC == refspec.string  # noqa: SIM300
 
     assert list is type(remote.fetch_refspecs)
-    assert 1 == len(remote.fetch_refspecs)
-    assert ORIGIN_REFSPEC == remote.fetch_refspecs[0]
+    assert 1 == len(remote.fetch_refspecs)  # noqa: SIM300
+    assert ORIGIN_REFSPEC == remote.fetch_refspecs[0]  # noqa: SIM300
 
     assert refspec.src_matches('refs/heads/master')
     assert refspec.dst_matches('refs/remotes/origin/master')
-    assert 'refs/remotes/origin/master' == refspec.transform('refs/heads/master')
-    assert 'refs/heads/master' == refspec.rtransform('refs/remotes/origin/master')
+    assert 'refs/remotes/origin/master' == refspec.transform('refs/heads/master')  # noqa: SIM300
+    assert 'refs/heads/master' == refspec.rtransform('refs/remotes/origin/master')  # noqa: SIM300
 
     assert list is type(remote.push_refspecs)
-    assert 0 == len(remote.push_refspecs)
+    assert 0 == len(remote.push_refspecs)  # noqa: SIM300
 
     push_specs = remote.push_refspecs
     assert list is type(push_specs)
-    assert 0 == len(push_specs)
+    assert 0 == len(push_specs)  # noqa: SIM300
 
     testrepo.remotes.add_fetch('origin', '+refs/test/*:refs/test/remotes/*')
     remote = testrepo.remotes['origin']
 
     fetch_specs = remote.fetch_refspecs
     assert list is type(fetch_specs)
-    assert 2 == len(fetch_specs)
-    assert [
+    assert 2 == len(fetch_specs)  # noqa: SIM300, PLR2004
+    assert [  # noqa: SIM300
         '+refs/heads/*:refs/remotes/origin/*',
         '+refs/test/*:refs/test/remotes/*',
     ] == fetch_specs
@@ -172,14 +172,14 @@ def test_refspec(testrepo):
         testrepo.remotes.add_fetch(['+refs/*:refs/*', 5])
 
     remote = testrepo.remotes['origin']
-    assert ['+refs/test/*:refs/test/remotes/*'] == remote.push_refspecs
+    assert ['+refs/test/*:refs/test/remotes/*'] == remote.push_refspecs  # noqa: SIM300
 
 
 def test_remote_list(testrepo):
-    assert 1 == len(testrepo.remotes)
+    assert 1 == len(testrepo.remotes)  # noqa: SIM300
     remote = testrepo.remotes[0]
-    assert REMOTE_NAME == remote.name
-    assert REMOTE_URL == remote.url
+    assert REMOTE_NAME == remote.name  # noqa: SIM300
+    assert REMOTE_URL == remote.url  # noqa: SIM300
 
     name = 'upstream'
     url = 'https://github.com/libgit2/pygit2.git'
@@ -190,7 +190,7 @@ def test_remote_list(testrepo):
 
 @utils.requires_network
 def test_ls_remotes(testrepo):
-    assert 1 == len(testrepo.remotes)
+    assert 1 == len(testrepo.remotes)  # noqa: SIM300
     remote = testrepo.remotes[0]
 
     refs = remote.ls_remotes()
@@ -202,8 +202,8 @@ def test_ls_remotes(testrepo):
 
 def test_remote_collection(testrepo):
     remote = testrepo.remotes['origin']
-    assert REMOTE_NAME == remote.name
-    assert REMOTE_URL == remote.url
+    assert REMOTE_NAME == remote.name  # noqa: SIM300
+    assert REMOTE_URL == remote.url  # noqa: SIM300
 
     with pytest.raises(KeyError):
         testrepo.remotes['upstream']
@@ -227,8 +227,8 @@ def test_remote_refcount(testrepo):
 def test_fetch(emptyrepo):
     remote = emptyrepo.remotes[0]
     stats = remote.fetch()
-    assert stats.received_bytes > 2700
-    assert stats.received_bytes < 3100
+    assert stats.received_bytes > 2700  # noqa: PLR2004
+    assert stats.received_bytes < 3100  # noqa: PLR2004
     assert stats.indexed_objects == REMOTE_REPO_OBJECTS
     assert stats.received_objects == REMOTE_REPO_OBJECTS
 
@@ -377,7 +377,7 @@ def test_push_transfer_progress(origin, clone, remote):
     # on the local filesystem, as is the case in this unit test. (When pushing
     # to a remote over the network, the value is correct.)
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def push_transfer_progress(self, objects_pushed, total_objects, bytes_pushed):
+        def push_transfer_progress(self, objects_pushed, total_objects, bytes_pushed):  # noqa: ARG002
             self.objects_pushed = objects_pushed
             self.total_objects = total_objects
 
@@ -402,7 +402,7 @@ def test_push_interrupted_from_callbacks(origin, clone, remote):
     )
 
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def push_transfer_progress(self, objects_pushed, total_objects, bytes_pushed):
+        def push_transfer_progress(self, objects_pushed, total_objects, bytes_pushed):  # noqa: ARG002
             raise InterruptedError('retreat! retreat!')
 
     assert origin.branches['master'].target == tip.id
@@ -438,7 +438,7 @@ def test_push_non_fast_forward_commits_to_remote_fails(origin, clone, remote):
         remote.push(['refs/heads/master'])
 
 
-def test_push_options(origin, clone, remote):
+def test_push_options(origin, clone, remote):  # noqa: ARG001
     from pygit2 import RemoteCallbacks
 
     callbacks = RemoteCallbacks()
@@ -464,7 +464,7 @@ def test_push_options(origin, clone, remote):
     with pytest.raises(pygit2.GitError, match='push-options not supported by remote'):
         remote.push(['refs/heads/master'], callbacks, push_options=['Opt A', 'Opt B'])
     remote_push_options = callbacks.push_options.remote_push_options
-    assert remote_push_options.count == 2
+    assert remote_push_options.count == 2  # noqa: PLR2004
     # strings pointed to by remote_push_options.strings[] are already freed
 
 
diff --git a/test/test_remote_prune.py b/test/test_remote_prune.py
index 927d812c..05359f7e 100644
--- a/test/test_remote_prune.py
+++ b/test/test_remote_prune.py
@@ -58,7 +58,7 @@ def test_remote_prune(clonerepo):
     pruned = []
 
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def update_tips(self, name, old, new):
+        def update_tips(self, name, old, new):  # noqa: ARG002
             pruned.append(name)
 
     callbacks = MyCallbacks()
diff --git a/test/test_remote_utf8.py b/test/test_remote_utf8.py
index cf58a8d5..8d2a7582 100644
--- a/test/test_remote_utf8.py
+++ b/test/test_remote_utf8.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import pygit2
+import pygit2  # noqa: I001
 import pytest
 from . import utils
 
diff --git a/test/test_repository.py b/test/test_repository.py
index adf339e4..96141a17 100644
--- a/test/test_repository.py
+++ b/test/test_repository.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import shutil
 import tempfile
 
@@ -105,13 +105,13 @@ def __init__(self):
         def checkout_notify_flags(self) -> CheckoutNotify:
             return CheckoutNotify.CONFLICT | CheckoutNotify.UPDATED
 
-        def checkout_notify(self, why, path, baseline, target, workdir):
+        def checkout_notify(self, why, path, baseline, target, workdir):  # noqa: ARG002
             if why == CheckoutNotify.CONFLICT:
                 self.conflicting_paths.add(path)
             elif why == CheckoutNotify.UPDATED:
                 self.updated_paths.add(path)
 
-        def checkout_progress(self, path: str, completed_steps: int, total_steps: int):
+        def checkout_progress(self, path: str, completed_steps: int, total_steps: int):  # noqa: ARG002
             self.completed_steps = completed_steps
             self.total_steps = total_steps
 
@@ -121,7 +121,7 @@ def checkout_progress(self, path: str, completed_steps: int, total_steps: int):
         testrepo.checkout(ref_i18n, callbacks=callbacks)
     # make sure the callbacks caught that
     assert {'bye.txt'} == callbacks.conflicting_paths
-    assert -1 == callbacks.completed_steps  # shouldn't have done anything
+    assert -1 == callbacks.completed_steps  # shouldn't have done anything  # noqa: SIM300
 
     # checkout i18n with GIT_CHECKOUT_FORCE
     head = testrepo.head
@@ -150,28 +150,28 @@ def __init__(self):
             super().__init__()
             self.invoked_times = 0
 
-        def checkout_notify(self, why, path, baseline, target, workdir):
+        def checkout_notify(self, why, path, baseline, target, workdir):  # noqa: ARG002
             self.invoked_times += 1
             # skip one file so we're certain that NO files are affected,
             # even if aborting the checkout from the second file
-            if self.invoked_times == 2:
+            if self.invoked_times == 2:  # noqa: PLR2004
                 raise InterruptedError('Stop the checkout!')
 
     head = testrepo.head
     head = testrepo[head.target]
     assert 'new' not in head.tree
-    assert b'bye world\n' == read_bye_txt()
+    assert b'bye world\n' == read_bye_txt()  # noqa: SIM300
     callbacks = MyCheckoutCallbacks()
 
-    # checkout i18n with GIT_CHECKOUT_FORCE - callbacks should prevent checkout from completing
+    # checkout i18n with GIT_CHECKOUT_FORCE - callbacks should prevent checkout from completing  # noqa: E501
     with pytest.raises(InterruptedError):
         testrepo.checkout(
             ref_i18n, strategy=CheckoutStrategy.FORCE, callbacks=callbacks
         )
 
-    assert callbacks.invoked_times == 2
+    assert callbacks.invoked_times == 2  # noqa: PLR2004
     assert 'new' not in head.tree
-    assert b'bye world\n' == read_bye_txt()
+    assert b'bye world\n' == read_bye_txt()  # noqa: SIM300
 
 
 def test_checkout_branch(testrepo):
@@ -228,7 +228,7 @@ def test_checkout_alternative_dir(testrepo):
     extra_dir.mkdir()
     assert len(list(extra_dir.iterdir())) == 0
     testrepo.checkout(ref_i18n, directory=extra_dir)
-    assert not len(list(extra_dir.iterdir())) == 0
+    assert not len(list(extra_dir.iterdir())) == 0  # noqa: SIM201
 
 
 def test_checkout_paths(testrepo):
@@ -286,15 +286,15 @@ def test_ahead_behind(testrepo):
         '5ebeeebb320790caf276b9fc8b24546d63316533',
         '4ec4389a8068641da2d6578db0419484972284c8',
     )
-    assert 1 == ahead
-    assert 2 == behind
+    assert 1 == ahead  # noqa: SIM300
+    assert 2 == behind  # noqa: SIM300, PLR2004
 
     ahead, behind = testrepo.ahead_behind(
         '4ec4389a8068641da2d6578db0419484972284c8',
         '5ebeeebb320790caf276b9fc8b24546d63316533',
     )
-    assert 2 == ahead
-    assert 1 == behind
+    assert 2 == ahead  # noqa: SIM300, PLR2004
+    assert 1 == behind  # noqa: SIM300
 
 
 def test_reset_hard(testrepo):
@@ -369,7 +369,7 @@ def test_stash(testrepo):
     )
 
     # make sure we're starting with no stashes
-    assert [] == testrepo.listall_stashes()
+    assert [] == testrepo.listall_stashes()  # noqa: SIM300
 
     # some changes to working dir
     with (Path(testrepo.workdir) / 'hello.txt').open('w') as f:
@@ -379,7 +379,7 @@ def test_stash(testrepo):
     assert 'hello.txt' not in testrepo.status()
 
     repo_stashes = testrepo.listall_stashes()
-    assert 1 == len(repo_stashes)
+    assert 1 == len(repo_stashes)  # noqa: SIM300
     assert repr(repo_stashes[0]) == f'<pygit2.Stash{{{stash_hash}}}>'
     assert repo_stashes[0].commit_id == stash_hash
     assert repo_stashes[0].message == 'On master: ' + stash_message
@@ -389,7 +389,7 @@ def test_stash(testrepo):
     assert repo_stashes == testrepo.listall_stashes()  # still the same stashes
 
     testrepo.stash_drop()
-    assert [] == testrepo.listall_stashes()
+    assert [] == testrepo.listall_stashes()  # noqa: SIM300
 
     with pytest.raises(KeyError):
         testrepo.stash_pop()
@@ -402,7 +402,7 @@ def test_stash_partial(testrepo):
     )
 
     # make sure we're starting with no stashes
-    assert [] == testrepo.listall_stashes()
+    assert [] == testrepo.listall_stashes()  # noqa: SIM300
 
     # some changes to working dir
     with (Path(testrepo.workdir) / 'hello.txt').open('w') as f:
@@ -420,7 +420,7 @@ def stash_pathspecs(paths):
         )
         stash_commit = testrepo[stash_id].peel(pygit2.Commit)
         stash_diff = testrepo.diff(stash_commit.parents[0], stash_commit)
-        stash_files = set(patch.delta.new_file.path for patch in stash_diff)
+        stash_files = set(patch.delta.new_file.path for patch in stash_diff)  # noqa: C401
         return stash_files == set(paths)
 
     # Stash a modified file
@@ -499,9 +499,9 @@ def stash_apply_progress(self, progress: StashApplyProgress):
     with (Path(testrepo.workdir) / 'hello.txt').open('r') as f:
         assert f.read() == 'hello world\nhola mundo\nbonjour le monde\n'
 
-    # and since we didn't let stash_pop run to completion, the stash itself should still be here
+    # and since we didn't let stash_pop run to completion, the stash itself should still be here  # noqa: E501
     repo_stashes = testrepo.listall_stashes()
-    assert 1 == len(repo_stashes)
+    assert 1 == len(repo_stashes)  # noqa: SIM300
     assert repo_stashes[0].message == 'On master: custom stash message'
 
 
@@ -521,7 +521,7 @@ def test_stash_apply_checkout_options(testrepo):
 
     # define callbacks that raise an InterruptedError when checkout detects a conflict
     class MyStashApplyCallbacks(pygit2.StashApplyCallbacks):
-        def checkout_notify(self, why, path, baseline, target, workdir):
+        def checkout_notify(self, why, path, baseline, target, workdir):  # noqa: ARG002
             if why == CheckoutNotify.CONFLICT:
                 raise InterruptedError('Applying the stash would create a conflict')
 
@@ -578,7 +578,7 @@ def test_revert(testrepo):
     assert testrepo.state() == RepositoryState.REVERT
     assert (
         testrepo.message
-        == f'Revert "Say hello in French"\n\nThis reverts commit {commit_to_revert.id}.\n'
+        == f'Revert "Say hello in French"\n\nThis reverts commit {commit_to_revert.id}.\n'  # noqa: E501
     )
 
 
@@ -588,8 +588,8 @@ def test_default_signature(testrepo):
     config['user.email'] = 'rjh@example.com'
 
     sig = testrepo.default_signature
-    assert 'Random J Hacker' == sig.name
-    assert 'rjh@example.com' == sig.email
+    assert 'Random J Hacker' == sig.name  # noqa: SIM300
+    assert 'rjh@example.com' == sig.email  # noqa: SIM300
 
 
 def test_new_repo(tmp_path):
@@ -690,7 +690,7 @@ def create_repository(path, bare):
         return init_repository(path, bare)
 
     # here we override the name
-    def create_remote(repo, name, url):
+    def create_remote(repo, name, url):  # noqa: ARG001
         return repo.remotes.create('custom_remote', url)
 
     repo = clone_repository(
@@ -715,7 +715,7 @@ def test_clone_with_credentials(tmp_path):
 @utils.requires_network
 def test_clone_bad_credentials(tmp_path):
     class MyCallbacks(pygit2.RemoteCallbacks):
-        def credentials(self, url, username, allowed):
+        def credentials(self, url, username, allowed):  # noqa: ARG002
             raise RuntimeError('Unexpected error')
 
     url = 'https://github.com/github/github'
@@ -933,7 +933,7 @@ def test_repository_hashfile(testrepo):
 def test_repository_hashfile_filter(testrepo):
     original_hash = testrepo.index['hello.txt'].id
 
-    with open(Path(testrepo.workdir, 'hello.txt'), 'rb') as f:
+    with open(Path(testrepo.workdir, 'hello.txt'), 'rb') as f:  # noqa: PTH123
         original_text = f.read()
 
     crlf_data = original_text.replace(b'\n', b'\r\n')
@@ -941,12 +941,12 @@ def test_repository_hashfile_filter(testrepo):
     assert crlf_hash != original_hash
 
     # Write hellocrlf.txt as a copy of hello.txt with CRLF line endings
-    with open(Path(testrepo.workdir, 'hellocrlf.txt'), 'wb') as f:
+    with open(Path(testrepo.workdir, 'hellocrlf.txt'), 'wb') as f:  # noqa: PTH123
         f.write(crlf_data)
 
     # Set up a CRLF filter
     testrepo.config['core.autocrlf'] = True
-    with open(Path(testrepo.workdir, '.gitattributes'), 'wt') as f:
+    with open(Path(testrepo.workdir, '.gitattributes'), 'wt') as f:  # noqa: PTH123
         f.write('*.txt text\n*.bin binary\n\n')
 
     # By default, hellocrlf.txt should have the same hash as the original,
diff --git a/test/test_repository_bare.py b/test/test_repository_bare.py
index 0274a401..308ef9d1 100644
--- a/test/test_repository_bare.py
+++ b/test/test_repository_bare.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import binascii
+import binascii  # noqa: I001
 import os
 import pathlib
 import sys
@@ -53,7 +53,7 @@ def test_is_bare(barerepo):
 
 def test_head(barerepo):
     head = barerepo.head
-    assert HEAD_SHA == head.target
+    assert HEAD_SHA == head.target  # noqa: SIM300
     assert type(head) is pygit2.Reference
     assert not barerepo.head_is_unborn
     assert not barerepo.head_is_detached
@@ -77,14 +77,14 @@ def test_read(barerepo):
     ab = barerepo.read(BLOB_OID)
     a = barerepo.read(BLOB_HEX)
     assert ab == a
-    assert (ObjectType.BLOB, b'a contents\n') == a
+    assert (ObjectType.BLOB, b'a contents\n') == a  # noqa: SIM300
 
     a2 = barerepo.read('7f129fd57e31e935c6d60a0c794efe4e6927664b')
-    assert (ObjectType.BLOB, b'a contents 2\n') == a2
+    assert (ObjectType.BLOB, b'a contents 2\n') == a2  # noqa: SIM300
 
     a_hex_prefix = BLOB_HEX[:4]
     a3 = barerepo.read(a_hex_prefix)
-    assert (ObjectType.BLOB, b'a contents\n') == a3
+    assert (ObjectType.BLOB, b'a contents\n') == a3  # noqa: SIM300
 
 
 def test_write(barerepo):
@@ -99,7 +99,7 @@ def test_write(barerepo):
 
 def test_contains(barerepo):
     with pytest.raises(TypeError):
-        123 in barerepo
+        123 in barerepo  # noqa: B015, PLR2004
     assert BLOB_OID in barerepo
     assert BLOB_HEX in barerepo
     assert BLOB_HEX[:10] in barerepo
@@ -109,7 +109,7 @@ def test_contains(barerepo):
 
 def test_iterable(barerepo):
     oid = pygit2.Oid(hex=BLOB_HEX)
-    assert oid in [obj for obj in barerepo]
+    assert oid in [obj for obj in barerepo]  # noqa: C416
 
 
 def test_lookup_blob(barerepo):
@@ -117,23 +117,23 @@ def test_lookup_blob(barerepo):
         barerepo[123]
     assert barerepo[BLOB_OID].id == BLOB_HEX
     a = barerepo[BLOB_HEX]
-    assert b'a contents\n' == a.read_raw()
-    assert BLOB_HEX == a.id
-    assert ObjectType.BLOB == a.type
+    assert b'a contents\n' == a.read_raw()  # noqa: SIM300
+    assert BLOB_HEX == a.id  # noqa: SIM300
+    assert ObjectType.BLOB == a.type  # noqa: SIM300
 
 
 def test_lookup_blob_prefix(barerepo):
     a = barerepo[BLOB_HEX[:5]]
-    assert b'a contents\n' == a.read_raw()
-    assert BLOB_HEX == a.id
-    assert ObjectType.BLOB == a.type
+    assert b'a contents\n' == a.read_raw()  # noqa: SIM300
+    assert BLOB_HEX == a.id  # noqa: SIM300
+    assert ObjectType.BLOB == a.type  # noqa: SIM300
 
 
 def test_lookup_commit(barerepo):
     commit_sha = '5fe808e8953c12735680c257f56600cb0de44b10'
     commit = barerepo[commit_sha]
     assert commit_sha == commit.id
-    assert ObjectType.COMMIT == commit.type
+    assert ObjectType.COMMIT == commit.type  # noqa: SIM300
     assert commit.message == (
         'Second test data commit.\n\nThis commit has some additional text.\n'
     )
@@ -145,9 +145,9 @@ def test_lookup_commit_prefix(barerepo):
     too_short_prefix = commit_sha[:3]
     commit = barerepo[commit_sha_prefix]
     assert commit_sha == commit.id
-    assert ObjectType.COMMIT == commit.type
+    assert ObjectType.COMMIT == commit.type  # noqa: SIM300
     assert (
-        'Second test data commit.\n\n'
+        'Second test data commit.\n\n'  # noqa: SIM300
         'This commit has some additional text.\n' == commit.message
     )
     with pytest.raises(ValueError):
diff --git a/test/test_repository_custom.py b/test/test_repository_custom.py
index 5c365e09..4a4851d0 100644
--- a/test/test_repository_custom.py
+++ b/test/test_repository_custom.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 import pytest
 
 import pygit2
@@ -58,4 +58,4 @@ def test_references(repo):
 
 def test_objects(repo):
     a = repo.read('323fae03f4606ea9991df8befbb2fca795e648fa')
-    assert (ObjectType.BLOB, b'foobar\n') == a
+    assert (ObjectType.BLOB, b'foobar\n') == a  # noqa: SIM300
diff --git a/test/test_revparse.py b/test/test_revparse.py
index 10effc49..d21d0595 100644
--- a/test/test_revparse.py
+++ b/test/test_revparse.py
@@ -25,7 +25,7 @@
 
 """Tests for revision parsing."""
 
-from pygit2 import InvalidSpecError
+from pygit2 import InvalidSpecError  # noqa: I001
 from pygit2.enums import RevSpecFlag
 from pytest import raises
 
@@ -88,5 +88,5 @@ def test_revparse_repr(testrepo):
     s = testrepo.revparse('HEAD...i18n')
     assert (
         repr(s)
-        == '<pygit2.RevSpec{from=<pygit2.Object{commit:2be5719152d4f82c7302b1c0932d8e5f0a4a0e98}>,to=<pygit2.Object{commit:5470a671a80ac3789f1a6a8cefbcf43ce7af0563}>}>'
+        == '<pygit2.RevSpec{from=<pygit2.Object{commit:2be5719152d4f82c7302b1c0932d8e5f0a4a0e98}>,to=<pygit2.Object{commit:5470a671a80ac3789f1a6a8cefbcf43ce7af0563}>}>'  # noqa: E501
     )
diff --git a/test/test_revwalk.py b/test/test_revwalk.py
index 483984c0..91b5a6bf 100644
--- a/test/test_revwalk.py
+++ b/test/test_revwalk.py
@@ -25,7 +25,7 @@
 
 """Tests for revision walk."""
 
-from pygit2.enums import SortMode
+from pygit2.enums import SortMode  # noqa: I001
 
 
 # In the order given by git log
@@ -71,13 +71,13 @@ def test_reverse(testrepo):
 def test_hide(testrepo):
     walker = testrepo.walk(log[0], SortMode.TIME)
     walker.hide('4ec4389a8068641da2d6578db0419484972284c8')
-    assert len(list(walker)) == 2
+    assert len(list(walker)) == 2  # noqa: PLR2004
 
 
 def test_hide_prefix(testrepo):
     walker = testrepo.walk(log[0], SortMode.TIME)
     walker.hide('4ec4389a')
-    assert len(list(walker)) == 2
+    assert len(list(walker)) == 2  # noqa: PLR2004
 
 
 def test_reset(testrepo):
@@ -103,13 +103,13 @@ def test_sort(testrepo):
 def test_simplify_first_parent(testrepo):
     walker = testrepo.walk(log[0], SortMode.TIME)
     walker.simplify_first_parent()
-    assert len(list(walker)) == 3
+    assert len(list(walker)) == 3  # noqa: PLR2004
 
 
 def test_default_sorting(testrepo):
     walker = testrepo.walk(log[0], SortMode.NONE)
-    list1 = list([x.id for x in walker])
+    list1 = list([x.id for x in walker])  # noqa: C411
     walker = testrepo.walk(log[0])
-    list2 = list([x.id for x in walker])
+    list2 = list([x.id for x in walker])  # noqa: C411
 
     assert list1 == list2
diff --git a/test/test_signature.py b/test/test_signature.py
index a28a1e07..04ea8deb 100644
--- a/test/test_signature.py
+++ b/test/test_signature.py
@@ -44,7 +44,7 @@ def __assert(signature, encoding):
 def test_encoding(encoding):
     signature = pygit2.Signature('Foo Ibáñez', 'foo@example.com', encoding=encoding)
     __assert(signature, encoding)
-    assert abs(signature.time - time.time()) < 5
+    assert abs(signature.time - time.time()) < 5  # noqa: PLR2004
     assert str(signature) == 'Foo Ibáñez <foo@example.com>'
 
 
@@ -63,7 +63,7 @@ def test_repr(encoding):
     signature = pygit2.Signature(
         'Foo Ibáñez', 'foo@bar.com', 1322174594, 60, encoding=encoding
     )
-    expected = f"pygit2.Signature('Foo Ibáñez', 'foo@bar.com', 1322174594, 60, {repr(encoding)})"
+    expected = f"pygit2.Signature('Foo Ibáñez', 'foo@bar.com', 1322174594, 60, {repr(encoding)})"  # noqa: E501
     assert repr(signature) == expected
     assert signature == eval(expected)
 
@@ -99,7 +99,7 @@ def test_incorrect_encoding():
     )
 
     # repr() and str() may display junk, but they must not crash
-    assert "pygit2.Signature('(error)', '(error)', 999, 0, '(error)')" == repr(
+    assert "pygit2.Signature('(error)', '(error)', 999, 0, '(error)')" == repr(  # noqa: SIM300
         signature
     )
-    assert '(error) <(error)>' == str(signature)
+    assert '(error) <(error)>' == str(signature)  # noqa: SIM300
diff --git a/test/test_submodule.py b/test/test_submodule.py
index 235fed66..1f3eba3f 100644
--- a/test/test_submodule.py
+++ b/test/test_submodule.py
@@ -25,7 +25,7 @@
 
 """Tests for Submodule objects."""
 
-from pathlib import Path
+from pathlib import Path  # noqa: I001
 
 import pygit2
 import pytest
@@ -108,22 +108,22 @@ class CustomRepoClass(pygit2.Repository):
 
 def test_name(repo):
     s = repo.submodules[SUBM_PATH]
-    assert SUBM_NAME == s.name
+    assert SUBM_NAME == s.name  # noqa: SIM300
 
 
 def test_path(repo):
     s = repo.submodules[SUBM_PATH]
-    assert SUBM_PATH == s.path
+    assert SUBM_PATH == s.path  # noqa: SIM300
 
 
 def test_url(repo):
     s = repo.submodules[SUBM_PATH]
-    assert SUBM_URL == s.url
+    assert SUBM_URL == s.url  # noqa: SIM300
 
 
 def test_missing_url(repo):
     # Remove "url" from .gitmodules
-    with open(Path(repo.workdir, '.gitmodules'), 'wt') as f:
+    with open(Path(repo.workdir, '.gitmodules'), 'wt') as f:  # noqa: PTH123
         f.write('[submodule "TestGitRepository"]\n')
         f.write('\tpath = TestGitRepository\n')
     s = repo.submodules[SUBM_PATH]
@@ -219,7 +219,7 @@ def test_head_id_null(repo):
         '    url = https://github.com/libgit2/pygit2\n'
         '\n'
     )
-    with open(Path(repo.workdir, '.gitmodules'), 'a') as f:
+    with open(Path(repo.workdir, '.gitmodules'), 'a') as f:  # noqa: PTH123
         f.write(gitmodules_newlines)
 
     subm = repo.submodules['uncommitted_submodule']
@@ -239,7 +239,7 @@ def test_add_submodule(repo, depth):
 
     sm_repo = sm.open()
     assert sm_repo_path == sm.path
-    assert SUBM_URL == sm.url
+    assert SUBM_URL == sm.url  # noqa: SIM300
     assert not sm_repo.is_empty
 
     if depth == 0:
@@ -278,7 +278,7 @@ def test_submodule_status(repo):
     sm_repo.checkout('refs/heads/master')
 
     # Touch some file in the submodule's workdir (WD_WD_MODIFIED)
-    with open(Path(repo.workdir, SUBM_PATH, 'master.txt'), 'wt') as f:
+    with open(Path(repo.workdir, SUBM_PATH, 'master.txt'), 'wt') as f:  # noqa: PTH123
         f.write('modifying master.txt')
     assert (
         repo.submodules.status(SUBM_PATH)
@@ -286,7 +286,7 @@ def test_submodule_status(repo):
     )
 
     # Add an untracked file in the submodule's workdir (WD_UNTRACKED)
-    with open(Path(repo.workdir, SUBM_PATH, 'some_untracked_file.txt'), 'wt') as f:
+    with open(Path(repo.workdir, SUBM_PATH, 'some_untracked_file.txt'), 'wt') as f:  # noqa: PTH123
         f.write('hi')
     assert (
         repo.submodules.status(SUBM_PATH)
@@ -303,7 +303,7 @@ def test_submodule_status(repo):
 
 
 def test_submodule_cache(repo):
-    # When the cache is turned on, looking up the same submodule twice must return the same git_submodule object
+    # When the cache is turned on, looking up the same submodule twice must return the same git_submodule object  # noqa: E501
     repo.submodules.cache_all()
     sm1 = repo.submodules[SUBM_NAME]
     sm2 = repo.submodules[SUBM_NAME]
@@ -322,7 +322,7 @@ def test_submodule_reload(repo):
     assert sm.url == 'https://github.com/libgit2/TestGitRepository'
 
     # Doctor the config file outside of libgit2
-    with open(Path(repo.workdir, '.gitmodules'), 'wt') as f:
+    with open(Path(repo.workdir, '.gitmodules'), 'wt') as f:  # noqa: PTH123
         f.write('[submodule "TestGitRepository"]\n')
         f.write('\tpath = TestGitRepository\n')
         f.write('\turl = https://github.com/libgit2/pygit2\n')
diff --git a/test/test_tag.py b/test/test_tag.py
index e0e73322..e917092b 100644
--- a/test/test_tag.py
+++ b/test/test_tag.py
@@ -25,7 +25,7 @@
 
 """Tests for Tag objects."""
 
-import pytest
+import pytest  # noqa: I001
 
 import pygit2
 from pygit2.enums import ObjectType
@@ -39,11 +39,11 @@ def test_read_tag(barerepo):
     tag = repo[TAG_SHA]
     target = repo[tag.target]
     assert isinstance(tag, pygit2.Tag)
-    assert ObjectType.TAG == tag.type
-    assert ObjectType.COMMIT == target.type
-    assert 'root' == tag.name
-    assert 'Tagged root commit.\n' == tag.message
-    assert 'Initial test data commit.\n' == target.message
+    assert ObjectType.TAG == tag.type  # noqa: SIM300
+    assert ObjectType.COMMIT == target.type  # noqa: SIM300
+    assert 'root' == tag.name  # noqa: SIM300
+    assert 'Tagged root commit.\n' == tag.message  # noqa: SIM300
+    assert 'Initial test data commit.\n' == target.message  # noqa: SIM300
     assert tag.tagger == pygit2.Signature(
         'Dave Borowitz', 'dborowitz@google.com', 1288724692, -420
     )
@@ -63,7 +63,7 @@ def test_new_tag(barerepo):
     sha = barerepo.create_tag(name, target_prefix, ObjectType.BLOB, tagger, message)
     tag = barerepo[sha]
 
-    assert '3ee44658fd11660e828dfc96b9b5c5f38d5b49bb' == tag.id
+    assert '3ee44658fd11660e828dfc96b9b5c5f38d5b49bb' == tag.id  # noqa: SIM300
     assert name == tag.name
     assert target == tag.target
     assert tagger == tag.tagger
@@ -79,13 +79,13 @@ def test_modify_tag(barerepo):
 
     tag = barerepo[TAG_SHA]
     with pytest.raises(AttributeError):
-        setattr(tag, 'name', name)
+        setattr(tag, 'name', name)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(tag, 'target', target)
+        setattr(tag, 'target', target)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(tag, 'tagger', tagger)
+        setattr(tag, 'tagger', tagger)  # noqa: B010
     with pytest.raises(AttributeError):
-        setattr(tag, 'message', message)
+        setattr(tag, 'message', message)  # noqa: B010
 
 
 def test_get_object(barerepo):
diff --git a/test/test_tree.py b/test/test_tree.py
index c5000083..482aca61 100644
--- a/test/test_tree.py
+++ b/test/test_tree.py
@@ -23,7 +23,7 @@
 # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-import operator
+import operator  # noqa: I001
 import pytest
 
 import pygit2
@@ -54,7 +54,7 @@ def test_read_tree(barerepo):
     utils.assertRaisesWithArg(IndexError, 3, lambda: tree[3])
     utils.assertRaisesWithArg(KeyError, 'abcd', lambda: tree / 'abcd')
 
-    assert 3 == len(tree)
+    assert 3 == len(tree)  # noqa: SIM300, PLR2004
     sha = '7f129fd57e31e935c6d60a0c794efe4e6927664b'
     assert 'a' in tree
     assertTreeEntryEqual(tree[0], sha, 'a', 0o0100644)
@@ -93,7 +93,7 @@ def test_equality(barerepo):
 
 def test_sorting(barerepo):
     tree_a = barerepo['18e2d2e9db075f9eb43bcb2daa65a2867d29a15e']
-    assert list(tree_a) == sorted(reversed(list(tree_a)), key=pygit2.tree_entry_key)
+    assert list(tree_a) == sorted(reversed(list(tree_a)), key=pygit2.tree_entry_key)  # noqa: C414
     assert list(tree_a) != reversed(list(tree_a))
 
 
@@ -111,7 +111,7 @@ def test_read_subtree(barerepo):
     assert subtree_entry.type_str == 'tree'
 
     subtree = barerepo[subtree_entry.id]
-    assert 1 == len(subtree)
+    assert 1 == len(subtree)  # noqa: SIM300
     sha = '297efb891a47de80be0cfe9c639e4b8c9b450989'
     assertTreeEntryEqual(subtree[0], sha, 'd', 0o0100644)
 
@@ -185,7 +185,7 @@ def test_iterate_tree_nested(barerepo):
     tree = barerepo[TREE_SHA]
     for tree_entry in tree:
         if isinstance(tree_entry, pygit2.Tree):
-            for tree_entry2 in tree_entry:
+            for tree_entry2 in tree_entry:  # noqa: B007
                 pass
 
 
diff --git a/test/utils.py b/test/utils.py
index 3a5dcf46..1254ac97 100644
--- a/test/utils.py
+++ b/test/utils.py
@@ -24,7 +24,7 @@
 # Boston, MA 02110-1301, USA.
 
 # Standard library
-import hashlib
+import hashlib  # noqa: I001
 from pathlib import Path
 import shutil
 import socket
@@ -79,7 +79,7 @@ def gen_blob_sha1(data):
     return m.hexdigest()
 
 
-def force_rm_handle(remove_path, path, excinfo):
+def force_rm_handle(remove_path, path, excinfo):  # noqa: ARG001
     path = Path(path)
     path.chmod(path.stat().st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
     remove_path(path)