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

Add codespell config, pre-commit hook, and GH action (to catch new typos) + make it fix some it finds #1392

Merged
merged 1 commit into from
Jun 4, 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
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ repos:
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion asv/step_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def sigma_star(rights, values, rho):
def solve_potts_approx(y, w, gamma=None, min_size=1, **kw):
"""
Fit penalized stepwise constant function (Potts model) to data
approximatively, in linear time.
approximately, in linear time.

Do this by running the exact solver using a small maximum interval
size, and then combining consecutive intervals together if it
Expand Down
2 changes: 1 addition & 1 deletion asv/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def load_json(path, api_version=None, js_comments=False):
path : str
File name
api_version : str or None
API version indentifier
API version identifier
js_comments : bool, optional
Whether to allow nonstandard javascript-style comments
in the file. Note that this slows down the loading
Expand Down
4 changes: 2 additions & 2 deletions docs/source/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ benchmark types:

For the purposes of identifying benchmarks in the UI, ``repr()`` is called
on the elements of ``params``. In the event these strings contain memory
addresses, those adresses are stripped to allow comparison across runs.
addresses, those addresses are stripped to allow comparison across runs.
Additionally, if this results in a non-unique mapping, each duplicated
element will be suffixed with a distinct integer identifier corresponding
to order of appearance.
Expand Down Expand Up @@ -154,7 +154,7 @@ Timing benchmarks
``number`` times, and after that ``teardown`` runs.

- ``sample_time``: ``asv`` will automatically select ``number`` so that
each sample takes approximatively ``sample_time`` seconds. If not
each sample takes approximately ``sample_time`` seconds. If not
specified, ``sample_time`` defaults to 10 milliseconds.

- ``min_run_count``: the function is run at least this many times during
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,10 @@ archs = ['AMD64']
where = ["."]
exclude = ["wheelhouse"]
namespaces = true

[tool.codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = '.git,*.css'
check-hidden = true
ignore-regex = '- Boris Feld\b'
# ignore-words-list = ''
2 changes: 1 addition & 1 deletion test/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ def get_env():
assert not os.listdir(cache_dir)
env._set_installed_commit_hash(None)

# It should succed with nonzero cache size
# It should succeed with nonzero cache size
conf.build_cache_size = 1
env = get_env()
env.install_project(conf, repo, commit_hash)
Expand Down
2 changes: 1 addition & 1 deletion test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _test_run(range_spec, branches, expected_commits):
assert set(result_files) == expected

for branches, expected_commits in (
# Without branches in config, shoud just use main
# Without branches in config, should just use main
([None], [initial_commit, main_commit]),

# With one branch in config, should just use that branch
Expand Down
2 changes: 1 addition & 1 deletion test/test_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_is_different():

def _check_ci(estimator, sampler, nsamples=300):
"""
Check whether confidence behaves as advertized.
Check whether confidence behaves as advertised.

Draw random samples from a distribution and check how often the
true value (assumed 0) falls in the estimated CI.
Expand Down
2 changes: 1 addition & 1 deletion test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_parallelfailure():
assert str(exc) == "Exception: test\n something"

# Check multiprocessing does not hang (it would hang on Python
# 2.7.8 if the 'raise utill.ParallelFailure ...' above is changed
# 2.7.8 if the 'raise util.ParallelFailure ...' above is changed
# to just 'raise')
pool = multiprocessing.Pool(4)
try:
Expand Down
Loading