diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..e21712e4 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ad27b3..6f4ba3c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -259,7 +259,7 @@ Deprecations: - New `keep_all` and `paths` optional arguments for `Repository.stash(...)` [#1202](https://github.com/libgit2/pygit2/pull/1202) -- New `Respository.state()` +- New `Repository.state()` [#1204](https://github.com/libgit2/pygit2/pull/1204) - Improve `Repository.write_archive(...)` performance [#1183](https://github.com/libgit2/pygit2/pull/1183) @@ -439,7 +439,7 @@ Breaking changes: Breaking changes: -- Remove deprecated `GIT_CREDTYPE_XXX` contants, use +- Remove deprecated `GIT_CREDTYPE_XXX` constants, use `GIT_CREDENTIAL_XXX` instead. - Remove deprecated `Patch.patch` getter, use `Patch.text` instead. @@ -536,7 +536,7 @@ Deprecations: - Deprecate `Repository.create_remote(...)`, use instead `Repository.remotes.create(...)` -- Deprecate `GIT_CREDTYPE_XXX` contants, use `GIT_CREDENTIAL_XXX` +- Deprecate `GIT_CREDTYPE_XXX` constants, use `GIT_CREDENTIAL_XXX` instead. # 1.2.0 (2020-04-05) @@ -657,7 +657,7 @@ Breaking changes: Breaking changes: -- Now the Repository has a new attribue `odb` for object database: +- Now the Repository has a new attribute `odb` for object database: # Before repository.read(...) @@ -862,7 +862,7 @@ Other changes: [#610](https://github.com/libgit2/pygit2/issues/610) - Fix tests failing in some cases [#795](https://github.com/libgit2/pygit2/issues/795) -- Automatize wheels upload to pypi +- Automate wheels upload to pypi [#563](https://github.com/libgit2/pygit2/issues/563) # 0.27.0 (2018-03-30) diff --git a/docs/development.rst b/docs/development.rst index 771a7080..b9422bf3 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -82,7 +82,7 @@ Step 3. Build pygit2 with debug symbols:: Step 4. Install requirements:: $ $PYTHONBIN/python3 setup.py install - $ pip insall pytest + $ pip install pytest Step 4. Run valgrind:: diff --git a/docs/install.rst b/docs/install.rst index bdfbbd86..eec1cdbd 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -60,7 +60,7 @@ Python requirements (these are specified in ``setup.py``): Libgit2 **v1.9.x**; binary wheels already include libgit2, so you only need to worry about this if you install the source package. -Optional libgit2 dependecies to support ssh and https: +Optional libgit2 dependencies to support ssh and https: - https: WinHTTP (Windows), SecureTransport (OS X) or OpenSSL. - ssh: libssh2 1.9.0 or later, pkg-config @@ -214,7 +214,7 @@ libgit2 within a virtual environment This is how to install both libgit2 and pygit2 within a virtual environment. -This is useful if you don't have root acces to install libgit2 system wide. +This is useful if you don't have root access to install libgit2 system wide. Or if you wish to have different versions of libgit2/pygit2 installed in different virtual environments, isolated from each other. @@ -265,7 +265,7 @@ So you need to either set ``LD_LIBRARY_PATH`` before using pygit2, like: Or, like we have done in the instructions above, use the `rpath `_, it hard-codes extra search paths within the pygit2 extension modules, so you don't need to set ``LD_LIBRARY_PATH`` -everytime. Verify yourself if curious: +every time. Verify yourself if curious: .. code-block:: sh @@ -317,7 +317,7 @@ source package. The easiest way is to first install libgit2 with the `Homebrew `_ package manager and then use pip3 for pygit2. The following example assumes that -XCode and Hombrew are already installed. +XCode and Homebrew are already installed. .. code-block:: sh diff --git a/docs/merge.rst b/docs/merge.rst index 43c99d48..dcc8c528 100644 --- a/docs/merge.rst +++ b/docs/merge.rst @@ -66,7 +66,7 @@ The following methods perform the calculation for a base to an n-way merge. .. automethod:: pygit2.Repository.merge_base_many .. automethod:: pygit2.Repository.merge_base_octopus -With this base at hand one can do repeated invokations of +With this base at hand one can do repeated invocations of :py:meth:`.Repository.merge_commits` and :py:meth:`.Repository.merge_trees` to perform the actual merge into one tree (and deal with conflicts along the way). \ No newline at end of file diff --git a/docs/objects.rst b/docs/objects.rst index 97ef286a..7d323a3a 100644 --- a/docs/objects.rst +++ b/docs/objects.rst @@ -16,7 +16,7 @@ Object lookup In the previous chapter we learnt about Object IDs. With an Oid we can ask the repository to get the associated object. To do that the ``Repository`` class -implementes a subset of the mapping interface. +implements a subset of the mapping interface. .. autoclass:: pygit2.Repository :noindex: @@ -90,7 +90,7 @@ Blobs ================= A blob is just a raw byte string. They are the Git equivalent to files in -a filesytem. +a filesystem. This is their API: @@ -221,7 +221,7 @@ Creating trees Commits ================= -A commit is a snapshot of the working dir with meta informations like author, +A commit is a snapshot of the working dir with meta information like author, committer and others. .. autoclass:: pygit2.Commit diff --git a/pygit2/__init__.py b/pygit2/__init__.py index e3589610..0fc6f488 100644 --- a/pygit2/__init__.py +++ b/pygit2/__init__.py @@ -86,7 +86,7 @@ def init_repository( The *flags* may be a combination of enums.RepositoryInitFlag constants: - - BARE (overriden by the *bare* parameter) + - BARE (overridden by the *bare* parameter) - NO_REINIT - NO_DOTGIT_DIR - MKDIR diff --git a/pygit2/_build.py b/pygit2/_build.py index d8deed4f..30e0d13f 100644 --- a/pygit2/_build.py +++ b/pygit2/_build.py @@ -38,7 +38,7 @@ # -# Utility functions to get the paths required for bulding extensions +# Utility functions to get the paths required for building extensions # def _get_libgit2_path(): # LIBGIT2 environment variable takes precedence diff --git a/pygit2/callbacks.py b/pygit2/callbacks.py index 6c1b6022..855ef12c 100644 --- a/pygit2/callbacks.py +++ b/pygit2/callbacks.py @@ -405,10 +405,10 @@ def git_remote_callbacks(payload): # # C callbacks # -# These functions are called by libgit2. They cannot raise execptions, since +# These functions are called by libgit2. They cannot raise exceptions, since # they return to libgit2, they can only send back error codes. # -# They cannot be overriden, but sometimes the only thing these functions do is +# They cannot be overridden, but sometimes the only thing these functions do is # to proxy the call to a user defined function. If user defined functions # raises an exception, the callback must store it somewhere and return # GIT_EUSER to libgit2, then the outer Python code will be able to reraise the diff --git a/pygit2/config.py b/pygit2/config.py index 10b5bd02..3b739840 100644 --- a/pygit2/config.py +++ b/pygit2/config.py @@ -304,7 +304,7 @@ def get_xdg_config(): class ConfigEntry: - """An entry in a configuation object.""" + """An entry in a configuration object.""" @classmethod def _from_c(cls, ptr, iterator=None): @@ -321,7 +321,7 @@ def _from_c(cls, ptr, iterator=None): # git_config_iterator_free when we've deleted all ConfigEntry objects. # But it's not, to reproduce the error comment the lines below and run # the script in https://github.com/libgit2/pygit2/issues/970 - # So instead we load the Python object immmediately. Ideally we should + # So instead we load the Python object immediately. Ideally we should # investigate libgit2 source code. if iterator is not None: entry.raw_name = entry.raw_name diff --git a/pygit2/decl/repository.h b/pygit2/decl/repository.h index cf646816..297d8710 100644 --- a/pygit2/decl/repository.h +++ b/pygit2/decl/repository.h @@ -81,7 +81,7 @@ int git_repository_set_head( int git_repository_set_head_detached( git_repository* repo, - const git_oid* commitish); + const git_oid* committish); int git_repository_hashfile(git_oid *out, git_repository *repo, const char *path, git_object_t type, const char *as_path); int git_repository_ident(const char **name, const char **email, const git_repository *repo); diff --git a/pygit2/refspec.py b/pygit2/refspec.py index 7c5660b0..447cf7dc 100644 --- a/pygit2/refspec.py +++ b/pygit2/refspec.py @@ -43,7 +43,7 @@ def src(self): @property def dst(self): - """Destinaton or rhs of the refspec""" + """Destination or rhs of the refspec""" return ffi.string(C.git_refspec_dst(self._refspec)).decode('utf-8') @property diff --git a/pygit2/remotes.py b/pygit2/remotes.py index fe6310cf..d2fe5142 100644 --- a/pygit2/remotes.py +++ b/pygit2/remotes.py @@ -246,7 +246,7 @@ def push(self, specs, callbacks=None, proxy=None, push_options=None): function will return successfully. Thus it is strongly recommended to install a callback, that implements :py:meth:`RemoteCallbacks.push_update_reference` and check the passed - parameters for successfull operations. + parameters for successful operations. Parameters: diff --git a/pygit2/repository.py b/pygit2/repository.py index ed4bcb2a..c3270e26 100644 --- a/pygit2/repository.py +++ b/pygit2/repository.py @@ -987,7 +987,7 @@ def describe( always_use_long_format : bool Always output the long format (the nearest tag, the number of - commits, and the abbrevated commit name) even when the committish + commits, and the abbreviated commit name) even when the committish matches a tag. dirty_suffix : str diff --git a/pyproject.toml b/pyproject.toml index 44619b81..93498d38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,3 +37,10 @@ extend-exclude = [ [tool.ruff.format] quote-style = "single" + +[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/src/odb_backend.c b/src/odb_backend.c index fa6901e9..a189aec5 100644 --- a/src/odb_backend.c +++ b/src/odb_backend.c @@ -103,7 +103,7 @@ pgit_odb_backend_read_prefix(git_oid *oid_out, void **ptr, size_t *sz, git_objec if (result == NULL) return git_error_for_exc(); - // Parse output from calback + // Parse output from callback PyObject *py_oid_out; Py_ssize_t type_value; const char *bytes; diff --git a/src/pygit2.c b/src/pygit2.c index c2381aa8..ca473968 100644 --- a/src/pygit2.c +++ b/src/pygit2.c @@ -290,7 +290,7 @@ PyDoc_STRVAR(filter_register__doc__, "\n" "`priority` defaults to GIT_FILTER_DRIVER_PRIORITY which imitates a core\n" "Git filter driver that will be run last on checkout (smudge) and first \n" - "on checkin (clean).\n" + "on check-in (clean).\n" "\n" "Note that the filter registry is not thread safe. Any registering or\n" "deregistering of filters should be done outside of any possible usage\n" diff --git a/src/reference.c b/src/reference.c index 1e05d085..7ba37642 100644 --- a/src/reference.c +++ b/src/reference.c @@ -230,7 +230,7 @@ Reference_rename(Reference *self, PyObject *py_name) if (err) return Error_set(err); - // Upadate reference + // Update reference git_reference_free(self->reference); self->reference = new_reference; diff --git a/src/repository.c b/src/repository.c index 116ac442..4be614bf 100644 --- a/src/repository.c +++ b/src/repository.c @@ -69,7 +69,7 @@ extern PyObject *FileStatusEnum; extern PyObject *MergeAnalysisEnum; extern PyObject *MergePreferenceEnum; -/* forward-declaration for Repsository._from_c() */ +/* forward-declaration for Repository._from_c() */ PyTypeObject RepositoryType; PyObject * @@ -2078,7 +2078,7 @@ Repository_free(Repository *self) PyDoc_STRVAR(Repository_expand_id__doc__, "expand_id(hex: str) -> Oid\n" "\n" - "Expand a string into a full Oid according to the objects in this repsitory.\n"); + "Expand a string into a full Oid according to the objects in this repository.\n"); PyObject * Repository_expand_id(Repository *self, PyObject *py_hex) diff --git a/src/signature.c b/src/signature.c index 126cdea9..f384bd7d 100644 --- a/src/signature.c +++ b/src/signature.c @@ -81,7 +81,7 @@ Signature_init(Signature *self, PyObject *args, PyObject *kwds) void Signature_dealloc(Signature *self) { - /* self->obj is the owner of the git_signature C structure, so we musn't free it */ + /* self->obj is the owner of the git_signature C structure, so we mustn't free it */ if (self->obj) { Py_CLEAR(self->obj); } else { diff --git a/test/test_repository_bare.py b/test/test_repository_bare.py index e950233f..dfd22269 100644 --- a/test/test_repository_bare.py +++ b/test/test_repository_bare.py @@ -60,7 +60,7 @@ def test_head(barerepo): def test_set_head(barerepo): - # Test setting a detatched HEAD. + # Test setting a detached HEAD. barerepo.set_head(pygit2.Oid(hex=PARENT_SHA)) assert barerepo.head.target == PARENT_SHA # And test setting a normal HEAD. diff --git a/test/test_tree.py b/test/test_tree.py index a8f8fb0f..c5000083 100644 --- a/test/test_tree.py +++ b/test/test_tree.py @@ -169,7 +169,7 @@ def test_modify_tree(barerepo): def test_iterate_tree(barerepo): """ Testing that we're able to iterate of a Tree object and that the - resulting sha strings are consitent with the sha strings we could + resulting sha strings are consistent with the sha strings we could get with other Tree access methods. """ tree = barerepo[TREE_SHA]