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

ci: spell-check the code as part of linting #1388

Merged
merged 1 commit into from
Sep 25, 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
9 changes: 8 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -24,3 +24,10 @@ repos:
args: [ --preview ]
- id: ruff-format
args: [ --preview ]
# Spellcheck the code.
- repo: https://github.com/codespell-project/codespell
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this, or can we set this, to British English (Canonical style)? At a cursory look "socio-economic" is more common in British English, so that made me wonder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that it will currently accept both en-UK and en-US spellings, so it fails to help with that. There is an option to make en-UK spellings an error with the en-US the suggestion, but there doesn't seem to be the reverse option, which is what we would want.

There's a lot of customisation possible in terms of which dictionaries are used, so maybe it's possible to eliminate en-US? I'm not totally sure, and the docs don't seem to say anything about it.

rev: v2.2.4
hooks:
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
level of experience, education, socioeconomic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards
Expand Down
2 changes: 1 addition & 1 deletion ops/_private/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def begin(self) -> None:
if self._charm is not None:
raise RuntimeError('cannot call the begin method on the harness more than once')

# The Framework adds attributes to class objects for events, etc. As such, we can't re-use
# The Framework adds attributes to class objects for events, etc. As such, we can't reuse
# the original class against multiple Frameworks. So create a locally defined class
# and register it.
# TODO: jam 2020-03-16 We are looking to changes this to Instance attributes instead of
Expand Down
4 changes: 2 additions & 2 deletions ops/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3133,7 +3133,7 @@ def _format_action_result_dict(
parent_key: Optional[str] = None,
output: Optional[Dict[str, str]] = None,
) -> Dict[str, str]:
"""Turn a nested dictionary into a flattened dictionary, using '.' as a key seperator.
"""Turn a nested dictionary into a flattened dictionary, using '.' as a key separator.

This is used to allow nested dictionaries to be translated into the dotted format required by
the Juju `action-set` hook tool in order to set nested data on an action.
Expand Down Expand Up @@ -3973,7 +3973,7 @@ class CloudSpec:
"""A list of CA certificates."""

skip_tls_verify: bool = False
"""Whether to skip TLS verfication."""
"""Whether to skip TLS verification."""

is_controller_cloud: bool = False
"""If this is the cloud used by the controller, defaults to False."""
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,7 @@ reportUnnecessaryComparison = false
reportUnnecessaryTypeIgnoreComment = "error"
disableBytesTypePromotions = false
stubPath = ""

[tool.codespell]
skip = './docs/_build,.venv,venv,build'
quiet-level = 3
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ commands =
description = Check code against coding style standards
deps =
ruff==0.4.5
codespell==2.3.0
commands =
ruff check --preview
ruff format --preview --check
codespell

[testenv:static]
description = Run static type checker
Expand Down
Loading