Skip to content

Commit

Permalink
codespell: add config, workflow (so no new typos sneak in) and get so…
Browse files Browse the repository at this point in the history
…me typos fixed (#5608)

* Add github action to codespell master on push and PRs

* Add rudimentary codespell config

* add various "legitimate" skips

* Fix some ambigious typos

* more of intricate skips

* Avoid use of a variable fle close to a typo for file

* [DATALAD RUNCMD] run codespell throughout

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic committed Aug 14, 2023
1 parent d3223ed commit bea98eb
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[codespell]
skip = .git,*.pdf,*.svg,msvc_strings.pyx,cython.st,test_genericclass_exttype.pyx,e_invalid_special_cython_modules.py
# case sensitive etc
# Tripple -- relates to kate. Not sure if could be fixed
ignore-regex= Tripple|/Fo|ist das|TOi|respect to the includee
# forin - ? tag used in 3 files. may be could be renamed?
# delimeters - typo, but used in API so kept as is
ignore-words-list = asend,forin,nd,mis,te,nin,ue,ccompiler,ket,defin,delimeters,filetests,crasher
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
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@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
6 changes: 3 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ Related changes
Patch by David Woods. (Github issue :issue:`4935`)

* ``np.long_t`` and ``np.ulong_t`` were removed from the NumPy declarations,
synching Cython with upstream NumPy v1.25.0. The aliases were confusing
syncing Cython with upstream NumPy v1.25.0. The aliases were confusing
since they could mean different things on different platforms.


Expand Down Expand Up @@ -1599,7 +1599,7 @@ Other changes
to make it more visible.

* ``np.long_t`` and ``np.ulong_t`` were removed from the NumPy declarations,
synching Cython with upstream NumPy v1.25.0. The aliases were confusing
syncing Cython with upstream NumPy v1.25.0. The aliases were confusing
since they could mean different things on different platforms.


Expand Down Expand Up @@ -3140,7 +3140,7 @@ Bugs fixed
Bugs fixed
----------

* A refence leak of the for-loop list/tuple iterable was resolved if the for-loop's
* A reference leak of the for-loop list/tuple iterable was resolved if the for-loop's
``else:`` branch executes a ``break`` for an outer loop.
(Github issue :issue:`5347`)

Expand Down
2 changes: 1 addition & 1 deletion Cython/Compiler/PyrexTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ class PyObjectType(PyrexType):
#
# Base class for all Python object types (reference-counted).
#
# buffer_defaults dict or None Default options for bu
# buffer_defaults dict or None Default options for buffer

name = "object"
is_pyobject = 1
Expand Down
4 changes: 2 additions & 2 deletions Cython/Tempita/_tempita.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def __init__(self, content, name=None, namespace=None, stacklevel=None,
delimeters = (self.default_namespace['start_braces'],
self.default_namespace['end_braces'])
else:
#assert len(delimeters) == 2 and all([isinstance(delimeter, basestring)
# for delimeter in delimeters])
#assert len(delimeters) == 2 and all([isinstance(delimiter, basestring)
# for delimiter in delimeters])
self.default_namespace = self.__class__.default_namespace.copy()
self.default_namespace['start_braces'] = delimeters[0]
self.default_namespace['end_braces'] = delimeters[1]
Expand Down
2 changes: 1 addition & 1 deletion Tools/cython-numpy-mode-kate.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<!-- Python syntax highlightning v0.9 by Per Wigren -->
<!-- Python syntax highlighting v0.9 by Per Wigren -->
<!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) -->
<!-- Python syntax highlighting v1.97 by Paul Giannaros -->
<!-- Pyrex syntax highlighting v0.1 by Matthew Marshall -->
Expand Down
6 changes: 3 additions & 3 deletions Tools/gen_tests_for_posix_pxds.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
TEST_PATH = PROJECT_ROOT / "tests/compile/posix_pxds.pyx"

def main():
datas = [
data = [
"# tag: posix\n"
"# mode: compile\n"
"\n"
Expand All @@ -32,10 +32,10 @@ def main():
"from posix.{name} cimport *\n"
).format(name=name)

datas.append(s)
data.append(s)

with open(TEST_PATH, "w", encoding="utf-8", newline="\n") as f:
f.write("\n".join(datas))
f.write("\n".join(data))

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion Tools/kate.diff
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ diff -r db4133d43a7e -r 0a6ce52272f6 Tools/cython-numpy-mode-kate.xml
@@ -0,0 +1,1133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language>
+<!-- Python syntax highlightning v0.9 by Per Wigren -->
+<!-- Python syntax highlighting v0.9 by Per Wigren -->
+<!-- Python syntax highlighting v1.9 by Michael Bueker (improved keyword differentiation) -->
+<!-- Python syntax highlighting v1.97 by Paul Giannaros -->
+<!-- Pyrex syntax highlighting v0.1 by Matthew Marshall -->
Expand Down
9 changes: 4 additions & 5 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ def skip_c(tags):
# dictionary so we check before looping.
if 'distutils' in tags:
for option in tags['distutils']:
splitted = option.split('=')
if len(splitted) == 2:
argument, value = splitted
split = option.split('=')
if len(split) == 2:
argument, value = split
if argument.strip() == 'language' and value.strip() == 'c++':
return True
return False
Expand Down Expand Up @@ -2097,8 +2097,7 @@ def test_embed(self):

def load_listfile(filename):
# just re-use the FileListExclude implementation
fle = FileListExcluder(filename)
return list(fle.excludes)
return list(FileListExcluder(filename))

class MissingDependencyExcluder(object):
def __init__(self, deps):
Expand Down
2 changes: 1 addition & 1 deletion tests/run/cpp_classes_def.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cdef cppclass RegularPolygon(Shape):
void do_with() except *:
# only a compile test - the file doesn't actually have to exist
# "with" was broken by https://github.com/cython/cython/issues/4212
with open("doesnt matter") as f:
with open("does not matter") as f:
return

def test_Poly(int n, float radius=1):
Expand Down
2 changes: 1 addition & 1 deletion tests/run/pep448_test_extcall.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def call_method(Foo):

# A PyCFunction that takes only positional parameters should allow an
# empty keyword dictionary to pass without a complaint, but raise a
# TypeError if te dictionary is not empty
# TypeError if the dictionary is not empty

def call_builtin_empty_dict():
"""
Expand Down

0 comments on commit bea98eb

Please sign in to comment.