Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure automatic spelling check via codespell within pre-commit #152

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codespell/ignore_lines.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
;; Please include filenames and explanations for each ignored line.
;; See https://docs.openverse.org/meta/codespell.html for docs.
11 changes: 11 additions & 0 deletions .codespell/ignore_words.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
23 changes: 23 additions & 0 deletions news/codespell.rst
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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?$'
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/utils/parsers/loaddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/utils/parsers/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/diffpy/utils/parsers/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down