diff --git a/.codespell/ignore_lines.txt b/.codespell/ignore_lines.txt new file mode 100644 index 00000000..07fa7c8c --- /dev/null +++ b/.codespell/ignore_lines.txt @@ -0,0 +1,2 @@ +;; Please include filenames and explanations for each ignored line. +;; See https://docs.openverse.org/meta/codespell.html for docs. diff --git a/.codespell/ignore_words.txt b/.codespell/ignore_words.txt new file mode 100644 index 00000000..9757d7c0 --- /dev/null +++ b/.codespell/ignore_words.txt @@ -0,0 +1,11 @@ +;; Please include explanations for each ignored word (lowercase). +;; See https://docs.openverse.org/meta/codespell.html for docs. + +;; abbreviation for "materials" often used in a journal title +mater + +;; alternative use of socioeconomic +socio-economic + +;; Frobenius norm used in np.linalg.norm +fro diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3070e199..aee43d0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,3 +44,9 @@ repos: name: Prevent Commit to Main Branch args: ["--branch", "main"] stages: [pre-commit] + - repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b57c7e79..ceed2511 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -90,7 +90,7 @@ v3.2.3 **Added:** -* Compatability with Python 3.12.0rc3, 3.11. +* Compatibility with Python 3.12.0rc3, 3.11. * CI Coverage. * New tests for loadData function. * loadData function now toggleable. Can return either (a) data read from data blocks or (b) header information stored diff --git a/README.rst b/README.rst index 98e34649..48967571 100644 --- a/README.rst +++ b/README.rst @@ -134,7 +134,7 @@ trying to commit again. Improvements and fixes are always appreciated. -Before contribuing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE_OF_CONDUCT.rst>`_. +Before contributing, please read our `Code of Conduct <https://github.com/diffpy/diffpy.utils/blob/main/CODE_OF_CONDUCT.rst>`_. Contact ------- diff --git a/news/codespell.rst b/news/codespell.rst new file mode 100644 index 00000000..8c5ba6d2 --- /dev/null +++ b/news/codespell.rst @@ -0,0 +1,23 @@ +**Added:** + +* Spelling check via Codespell in pre-commit + +**Changed:** + +* <news item> + +**Deprecated:** + +* <news item> + +**Removed:** + +* <news item> + +**Fixed:** + +* <news item> + +**Security:** + +* <news item> diff --git a/pyproject.toml b/pyproject.toml index 421f8886..53e14e82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,11 @@ namespaces = false # to disable scanning PEP 420 namespaces (true by default) [tool.setuptools.dynamic] dependencies = {file = ["requirements/pip.txt"]} +[tool.codespell] +exclude-file = ".codespell/ignore_lines.txt" +ignore-words = ".codespell/ignore_words.txt" +skip = "*.cif,*.dat" + [tool.black] line-length = 115 include = '\.pyi?$' diff --git a/src/diffpy/utils/parsers/loaddata.py b/src/diffpy/utils/parsers/loaddata.py index 4bb0d792..18375d90 100644 --- a/src/diffpy/utils/parsers/loaddata.py +++ b/src/diffpy/utils/parsers/loaddata.py @@ -30,7 +30,7 @@ def loadData(filename, minrows=10, headers=False, hdel="=", hignore=None, **kwar Minimum number of rows in the first data block. All rows must have the same number of floating point values. headers: bool - when False (defualt), the function returns a numpy array of the data in the data block. + when False (default), the function returns a numpy array of the data in the data block. When True, the function instead returns a dictionary of parameters and their corresponding values parsed from header (information prior the data block). See hdel and hignore for options to help with parsing header information. diff --git a/src/diffpy/utils/parsers/resample.py b/src/diffpy/utils/parsers/resample.py index f81fc2a2..e88c4f0b 100644 --- a/src/diffpy/utils/parsers/resample.py +++ b/src/diffpy/utils/parsers/resample.py @@ -113,7 +113,7 @@ def resample(r, s, dr): # spad = numpy.concatenate([s,spad]) # rnew = numpy.arange(0, rpad[-1], dr) # snew = numpy.zeros_like(rnew) - # Accomodate for the fact that r[0] might not be 0 + # Accommodate for the fact that r[0] might not be 0 # u = (rnew-r[0]) / dr0 # for n in range(len(spad)): # snew += spad[n] * numpy.sinc(u - n) diff --git a/src/diffpy/utils/parsers/serialization.py b/src/diffpy/utils/parsers/serialization.py index a0bec92c..46d4b8ff 100644 --- a/src/diffpy/utils/parsers/serialization.py +++ b/src/diffpy/utils/parsers/serialization.py @@ -56,7 +56,7 @@ def serialize_data( include a path element in the database entry (default True). If 'path' is not included in hddata, extract path from filename. serial_file - Serial language file to dump dictionary into. If None (defualt), no dumping will occur. + Serial language file to dump dictionary into. If None (default), no dumping will occur. Returns -------