Skip to content

Commit

Permalink
chore: Add typos pre-commit hook (#503)
Browse files Browse the repository at this point in the history
Automated typo fixes

---

### Changes are visible to end-users: yes

Typos were mainly fixed in the docs/docstrings

---------

Co-authored-by: Alex Eagle <[email protected]>
  • Loading branch information
hofbi and alexeagle authored Jan 24, 2025
1 parent 0090277 commit 23f0f01
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:

test-release:
runs-on: ubuntu-latest
permissions:
pull-requests: write # allow commenting to the PR with the token
defaults:
run:
working-directory: e2e/use_release
Expand All @@ -71,6 +73,7 @@ jobs:
# The github-actions-report-lcov doesn't follow symlinks, so get an absolute path
- run: echo "bazel_testlogs=$(bazel info bazel-testlogs)" >> $GITHUB_ENV
- name: Report code coverage
if: github.event.pull_request.head.repo.fork == false # Forks always have read-only tokens
uses: zgosalvez/github-actions-report-lcov@5989987f8058a03137e90bc16f9c0baaac5e069a # v4.1.22
with:
working-directory: ${{ env.bazel_testlogs }}
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ repos:
rev: "v3.1.0"
hooks:
- id: prettier
- repo: https://github.com/crate-ci/typos
rev: v1.28.4
hooks:
- id: typos
exclude: |
(?x)^(
examples/django/mysite/settings.py|
gazelle_python.yaml
)
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default.extend-identifiers]
MODULEs = "MODULEs" # Else it becomes MODULEEs
alocation = "alocation" # Used as 'a location'
2 changes: 1 addition & 1 deletion docs/py_binary.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/py_test.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/venv.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/system-interpreter/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Test system interperter
# Test system interpreter

This is a minimal test that rules_py can use a toolchain that relies on the system interpreter.
Note that this is setup to run on Aspect's CI, and locally on a MacOS, paths may vary on your system if running this.
2 changes: 1 addition & 1 deletion py/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PyWheelInfo = provider(
PyVirtualInfo = provider(
doc = "FIXME",
fields = {
"dependencies": "Depset of required virtual dependencies, independant of their resolution status",
"dependencies": "Depset of required virtual dependencies, independent of their resolution status",
"resolutions": "FIXME",
},
)
2 changes: 1 addition & 1 deletion py/private/py_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ _attrs = dict({
),
"package_collisions": attr.string(
doc = """The action that should be taken when a symlink collision is encountered when creating the venv.
A collision can occour when multiple packages providing the same file are installed into the venv. The possible values are:
A collision can occur when multiple packages providing the same file are installed into the venv. The possible values are:
* "error": When conflicting symlinks are found, an error is reported and venv creation halts.
* "warning": When conflicting symlinks are found, an warning is reported, however venv creation continues.
Expand Down
2 changes: 1 addition & 1 deletion py/private/py_venv.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ py_venv_rule = rule(
),
"package_collisions": attr.string(
doc = """The action that should be taken when a symlink collision is encountered when creating the venv.
A collision can occour when multiple packages providing the same file are installed into the venv. The possible values are:
A collision can occur when multiple packages providing the same file are installed into the venv. The possible values are:
* "error": When conflicting symlinks are found, an error is reported and venv creation halts.
* "warning": When conflicting symlinks are found, an warning is reported, however venv creation continues.
Expand Down
8 changes: 4 additions & 4 deletions py/private/virtual.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Utility functions around managing virtual dependencies and resoloutions"""

_RESOLUTION_SENTINAL_KEY = "_RESOLUTION_SENTINAL"
_RESOLUTION_SENTINEL_KEY = "_RESOLUTION_SENTINEL"

def _make_resolutions(base, requirement_fn = lambda r: r):
"""Returns data representing the resolution for a given set of dependencies
Expand All @@ -13,7 +13,7 @@ def _make_resolutions(base, requirement_fn = lambda r: r):
A resolution struct for use with virtual deps.
"""

if not _RESOLUTION_SENTINAL_KEY in base:
if not _RESOLUTION_SENTINEL_KEY in base:
_resolutions = dict([
[
k,
Expand All @@ -23,14 +23,14 @@ def _make_resolutions(base, requirement_fn = lambda r: r):
),
]
for k in base.keys()
], **{_RESOLUTION_SENTINAL_KEY: True})
], **{_RESOLUTION_SENTINEL_KEY: True})
else:
_resolutions = base

return struct(
resolutions = _resolutions,
override = lambda overrides, **kwargs: _make_resolutions(_make_overrides(_resolutions, overrides)),
to_label_keyed_dict = lambda: dict({v.requirement: v.name for k, v in _resolutions.items() if k != _RESOLUTION_SENTINAL_KEY}),
to_label_keyed_dict = lambda: dict({v.requirement: v.name for k, v in _resolutions.items() if k != _RESOLUTION_SENTINEL_KEY}),
)

def _make_overrides(resolutions, overrides):
Expand Down
2 changes: 1 addition & 1 deletion py/tools/pex/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __call__(self, parser, namespace, value, option_str=None):
INJECT_TEMPLATE.append("sys.path.append(os.path.abspath(os.path.join(__entry_point__, '%s')))" % path)

import_idx = BE.index("from pex.pex_bootstrapper import bootstrap_pex")
# This is here to catch potential future bugs where pex package is updated here but the boostrap
# This is here to catch potential future bugs where pex package is updated here but the bootstrap
# script was not checked again to see if we are still injecting values in the right place.
assert import_idx == 3703, "Check bootstrap template monkey patching."

Expand Down
2 changes: 1 addition & 1 deletion py/tools/py/src/unpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn unpack_wheel(version: &str, location: &Path, wheel: &Path) -> Result<()>
let filename = wheel
.file_name()
.and_then(|f| f.to_str())
.expect("Exepected to get filename from wheel path");
.expect("Expected to get filename from wheel path");
let wheel_file_name =
uv_distribution_filename::WheelFilename::from_str(filename).into_diagnostic()?;

Expand Down
2 changes: 1 addition & 1 deletion py/tools/unpack_bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct UnpackArgs {
wheel: PathBuf,

/// Python version, eg 3.8.12
/// Must be seperated by dots.
/// Must be separated by dots.
#[arg(long)]
python_version: String,
}
Expand Down

0 comments on commit 23f0f01

Please sign in to comment.