Skip to content

Commit

Permalink
add typos spell checker to pre-commit (#2568)
Browse files Browse the repository at this point in the history
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
Adam-D-Lewis and krassowski authored Aug 2, 2024
1 parent bb54646 commit dce1381
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_azure_integration.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Azure Delpoyment
name: Azure Deployment

on:
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_helm_charts.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Right now the trigger is set to run on every Monday at 13:00 UTC,
# or when the workflow file is modified. An aditional manual trigger
# or when the workflow file is modified. An additional manual trigger
# is also available.
name: "Validate Helm Charts downloads"

Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ repos:
- id: check-executables-have-shebangs
exclude: "^src/_nebari/template/"

- repo: https://github.com/crate-ci/typos
rev: v1.23.2
hooks:
- id: typos

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ command and follow the instructions
* paginator for boto3 ec2 instance types by @sblair-metrostar in https://github.com/nebari-dev/nebari/pull/1923
* Update README.md -- fix typo. by @teoliphant in https://github.com/nebari-dev/nebari/pull/1925
* Add more unit tests, add cleanup step for Digital Ocean integration test by @iameskild in https://github.com/nebari-dev/nebari/pull/1910
* Add cleanup step for AWS integration test, ensure diable_prompt is passed through by @iameskild in https://github.com/nebari-dev/nebari/pull/1921
* Add cleanup step for AWS integration test, ensure disable_prompt is passed through by @iameskild in https://github.com/nebari-dev/nebari/pull/1921
* K8s 1.25 + More Improvements by @Adam-D-Lewis in https://github.com/nebari-dev/nebari/pull/1856
* adding lifecycle ignore to eks node group by @sblair-metrostar in https://github.com/nebari-dev/nebari/pull/1905
* nebari init unit tests by @sblair-metrostar in https://github.com/nebari-dev/nebari/pull/1931
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,9 @@ exclude_also = [
"@(abc\\.)?abstractmethod",
]
ignore_errors = false

[tool.typos]
files.extend-exclude = ["_build", "*/build/*", "*/node_modules/*", "nebari.egg-info", "*.git", "*.js", "*.json", "*.yaml", "*.yml", "pre-commit-config.yaml"]
default.extend-ignore-re = ["(?Rm)^.*(#|//)\\s*typos: ignore$"]
default.extend-ignore-words-re = ["aks", "AKS"]
default.check-filename = false # Turn off initially, enable once https://github.com/nebari-dev/nebari/issues/2598 is addressed
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[pytest]
addopts =
# show tests that (f)ailed, (E)rror, or (X)passed in the summary
# show tests that (f)ailed, (E)rror, or (X)passed in the summary # typos: ignore
-rfEX
# Make tracebacks shorter
--tb=native
Expand Down
16 changes: 8 additions & 8 deletions src/_nebari/stages/infrastructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ class GoogleCloudPlatformProvider(schema.Base):
@classmethod
def _check_input(cls, data: Any) -> Any:
google_cloud.check_credentials()
avaliable_regions = google_cloud.regions()
if data["region"] not in avaliable_regions:
available_regions = google_cloud.regions()
if data["region"] not in available_regions:
raise ValueError(
f"Google Cloud region={data['region']} is not one of {avaliable_regions}"
f"Google Cloud region={data['region']} is not one of {available_regions}"
)

available_kubernetes_versions = google_cloud.kubernetes_versions(data["region"])
Expand Down Expand Up @@ -584,16 +584,16 @@ def check_provider(cls, data: Any) -> Any:
f"'{provider}' is not a valid enumeration member; permitted: local, existing, do, aws, gcp, azure"
)
else:
setted_providers = [
set_providers = [
provider
for provider in provider_name_abbreviation_map.keys()
if provider in data
]
num_providers = len(setted_providers)
num_providers = len(set_providers)
if num_providers > 1:
raise ValueError(f"Multiple providers set: {setted_providers}")
raise ValueError(f"Multiple providers set: {set_providers}")
elif num_providers == 1:
data["provider"] = provider_name_abbreviation_map[setted_providers[0]]
data["provider"] = provider_name_abbreviation_map[set_providers[0]]
elif num_providers == 0:
data["provider"] = schema.ProviderEnum.local.value
return data
Expand All @@ -606,7 +606,7 @@ class NodeSelectorKeyValue(schema.Base):

class KubernetesCredentials(schema.Base):
host: str
cluster_ca_certifiate: str
cluster_ca_certifiate: str # ignored for now. More info in https://github.com/nebari-dev/nebari/issues/2597. # typos: ignore
token: Optional[str] = None
username: Optional[str] = None
password: Optional[str] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ variable "availability_zones" {
}

variable "vpc_cidr_block" {
description = "VPC cidr block for infastructure"
description = "VPC cidr block for infrastructure"
type = string
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
output "credentials" {
description = "Credentials required for connecting to kubernets cluster"
description = "Credentials required for connecting to kubernetes cluster"
sensitive = true
value = {
endpoint = "https://${google_container_cluster.main.endpoint}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def base_node_group(options):
default_node_group if worker_node_group is None else worker_node_group
)

# check `schduler_extra_pod_config` first
# check `scheduler_extra_pod_config` first
scheduler_node_group = (
config["profiles"][options.profile]
.get("scheduler_extra_pod_config", {})
Expand Down
18 changes: 9 additions & 9 deletions tests/common/run_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run(
expected_outputs: List[str],
conda_env: str,
timeout: float = 1000,
complition_wait_time: float = 2,
completion_wait_time: float = 2,
retry: int = 2,
retry_wait_time: float = 5,
exact_match: bool = True,
Expand All @@ -47,7 +47,7 @@ def run(
timeout: float
Time in seconds to wait for the expected output text to appear.
default: 1000
complition_wait_time: float
completion_wait_time: float
Time in seconds to wait between checking for expected output text.
default: 2
retry: int
Expand Down Expand Up @@ -77,7 +77,7 @@ def run(
self._restart_run_all()
# Wait for a couple of seconds to make sure it's re-started
time.sleep(retry_wait_time)
self._wait_for_commands_completion(timeout, complition_wait_time)
self._wait_for_commands_completion(timeout, completion_wait_time)
all_outputs = self._get_outputs()
assert_match_all_outputs(expected_outputs, all_outputs, exact_match)

Expand Down Expand Up @@ -126,7 +126,7 @@ def assert_code_output(
code: str,
expected_output: str,
timeout: float = 1000,
complition_wait_time: float = 2,
completion_wait_time: float = 2,
exact_match: bool = True,
):
"""
Expand All @@ -143,11 +143,11 @@ def assert_code_output(
timeout: float
Time in seconds to wait for the expected output text to appear.
default: 1000
complition_wait_time: float
completion_wait_time: float
Time in seconds to wait between checking for expected output text.
"""
self.run_in_last_cell(code)
self._wait_for_commands_completion(timeout, complition_wait_time)
self._wait_for_commands_completion(timeout, completion_wait_time)
outputs = self._get_outputs()
actual_output = outputs[-1] if outputs else ""
assert_match_output(expected_output, actual_output, exact_match)
Expand Down Expand Up @@ -177,7 +177,7 @@ def _get_last_cell(self):
raise ValueError("Unable to get last cell")

def _wait_for_commands_completion(
self, timeout: float, complition_wait_time: float
self, timeout: float, completion_wait_time: float
):
"""
Wait for commands to finish running
Expand All @@ -186,7 +186,7 @@ def _wait_for_commands_completion(
----------
timeout: float
Time in seconds to wait for the expected output text to appear.
complition_wait_time: float
completion_wait_time: float
Time in seconds to wait between checking for expected output text.
"""
elapsed_time = 0.0
Expand All @@ -198,7 +198,7 @@ def _wait_for_commands_completion(
if not still_visible:
break
elapsed_time = time.time() - start_time
time.sleep(complition_wait_time)
time.sleep(completion_wait_time)
if still_visible:
raise ValueError(
f"Timeout Waited for commands to finish, "
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_unit/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_multiple_providers(config_schema):
config_schema(**config_dict)


def test_aws_premissions_boundary(config_schema):
def test_aws_permissions_boundary(config_schema):
permissions_boundary = "arn:aws:iam::123456789012:policy/MyBoundaryPolicy"
config_dict = {
"project_name": "test",
Expand All @@ -156,7 +156,7 @@ def test_aws_premissions_boundary(config_schema):


@pytest.mark.parametrize("provider", ["local", "existing"])
def test_setted_provider(config_schema, provider):
def test_set_provider(config_schema, provider):
config_dict = {
"project_name": "test",
"provider": provider,
Expand Down

0 comments on commit dce1381

Please sign in to comment.